0001-dataviz-do-not-accept-nested-lists-as-valid-data-516.patch
combo/apps/dataviz/models.py | ||
---|---|---|
378 | 378 |
x_labels = response['axis'].get('x_labels') or [] |
379 | 379 |
y_labels = response['axis'].get('y_labels') or [] |
380 | 380 |
if loop_labels: |
381 |
if x_labels and y_labels:
|
|
381 |
if 'x_labels' in response['axis'] and 'y_labels' in response['axis']:
|
|
382 | 382 |
# no support for three dimensions |
383 | 383 |
raise UnsupportedDataSet() |
384 | 384 |
if not y_labels: |
tests/test_dataviz.py | ||
---|---|---|
126 | 126 |
'name': 'twelth visualization (all null)', |
127 | 127 |
'slug': 'twelth', |
128 | 128 |
}, |
129 |
{ |
|
130 |
'data-url': 'https://bijoe.example.com/visualization/13/json/', |
|
131 |
'path': 'https://bijoe.example.com/visualization/13/iframe/?signature=123', |
|
132 |
'name': 'thirteenth visualization (loop with empty x_labels)', |
|
133 |
'slug': 'thirteenth', |
|
134 |
}, |
|
129 | 135 |
] |
130 | 136 | |
131 | 137 | |
... | ... | |
257 | 263 |
'measure': 'integer', |
258 | 264 |
} |
259 | 265 |
return {'content': json.dumps(response), 'request': request, 'status_code': 200} |
266 |
if url.path == '/visualization/13/json/': |
|
267 |
response = { |
|
268 |
'format': '1', |
|
269 |
'data': [[[], []], [[], []], [[], []]], |
|
270 |
'axis': { |
|
271 |
'x_labels': [], |
|
272 |
'y_labels': ['web', 'mail'], |
|
273 |
'loop': ['a', 'b', 'c'], |
|
274 |
}, |
|
275 |
} |
|
276 |
return {'content': json.dumps(response), 'request': request, 'status_code': 200} |
|
260 | 277 | |
261 | 278 | |
262 | 279 |
STATISTICS_LIST = { |
... | ... | |
477 | 494 |
with pytest.raises(HTTPError): |
478 | 495 |
chart = cell.get_chart() |
479 | 496 | |
497 |
# loop and empty x_labels |
|
498 |
cell.statistic = Statistic.objects.get(slug='thirteenth') |
|
499 |
cell.save() |
|
500 |
with pytest.raises(UnsupportedDataSet): |
|
501 |
chart = cell.get_chart() |
|
502 | ||
480 | 503 | |
481 | 504 |
@with_httmock(new_api_mock) |
482 | 505 |
def test_chartng_cell_new_api(app, new_api_statistics): |
483 |
- |