dataviz: do not raise error in check_validity (#65615)
This commit is contained in:
parent
d05406d9a0
commit
f3727f829d
|
@ -302,7 +302,7 @@ class ChartNgCell(CellBase):
|
|||
resp = None
|
||||
try:
|
||||
resp = self.get_statistic_data()
|
||||
except RequestException:
|
||||
except (RequestException, MissingRequest, MissingVariable):
|
||||
pass
|
||||
|
||||
self.set_validity_from_url(
|
||||
|
|
|
@ -2121,7 +2121,7 @@ def test_chartng_cell_new_api_filter_params_page_variables_table(new_api_statist
|
|||
|
||||
|
||||
def test_dataviz_check_validity(nocache):
|
||||
page = Page.objects.create(title='One', slug='index')
|
||||
page = Page.objects.create(title='One', slug='index', extra_variables={'foo': 'bar'})
|
||||
stat = Statistic.objects.create(url='https://stat.com/stats/1/')
|
||||
cell = ChartNgCell.objects.create(page=page, order=1, placeholder='content', statistic=stat)
|
||||
|
||||
|
@ -2133,6 +2133,17 @@ def test_dataviz_check_validity(nocache):
|
|||
cell.check_validity()
|
||||
assert ValidityInfo.objects.exists() is False
|
||||
|
||||
# cell using page variable is valid even if it cannot be evaluated
|
||||
cell.filter_params = {'test': 'variable:foo'}
|
||||
cell.save()
|
||||
|
||||
with HTTMock(url_mock):
|
||||
cell.check_validity()
|
||||
assert ValidityInfo.objects.exists() is False
|
||||
|
||||
cell.filter_params.clear()
|
||||
cell.save()
|
||||
|
||||
@urlmatch(scheme='https', netloc=r'stat.com', path='/stats/1/')
|
||||
def url_mock2(url, request):
|
||||
return {'content': json.dumps({'data': [], 'err': 1}), 'status_code': 404}
|
||||
|
|
Loading…
Reference in New Issue