tests: add dataviz null visualization (#48865)

This commit is contained in:
Valentin Deniaud 2020-12-16 11:09:55 +01:00
parent 4f878ac96a
commit b615b7fa99
1 changed files with 21 additions and 0 deletions

View File

@ -119,6 +119,12 @@ VISUALIZATION_JSON = [
'name': 'eleventh visualization (not found)',
'slug': 'eleventh',
},
{
'data-url': 'https://bijoe.example.com/visualization/12/json/',
'path': 'https://bijoe.example.com/visualization/12/iframe/?signature=123',
'name': 'twelth visualization (all null)',
'slug': 'twelth',
},
]
@ -217,6 +223,14 @@ def bijoe_mock(url, request):
'detail': 'not found',
}
return {'content': json.dumps(response), 'request': request, 'status_code': 404}
if url.path == '/visualization/12/json/':
response = {
'format': '1',
'data': [None, None],
'axis': {'x_labels': ['web', 'mail']},
'measure': 'integer',
}
return {'content': json.dumps(response), 'request': request, 'status_code': 200}
@pytest.fixture
@ -423,6 +437,13 @@ def test_chartng_cell_hide_null_values(app, statistics):
([122, 114, 2, 33], {'title': u'bar'}),
]
# all null
cell.statistic = Statistic.objects.get(slug='twelth')
cell.save()
chart = cell.get_chart()
assert chart.x_labels == []
assert chart.raw_series == [([], {'title': ''})]
@with_httmock(bijoe_mock)
def test_chartng_cell_sort_order_alpha(app, statistics):