tests: add null values to chart visualisation data (#45503)
This commit is contained in:
parent
ee8c7b2306
commit
8828b94050
|
@ -122,9 +122,9 @@ def bijoe_mock(url, request):
|
|||
if url.path == '/visualization/1/json/':
|
||||
response = {
|
||||
'format': '1',
|
||||
'data': [222, 134, 53],
|
||||
'data': [222, 134, 0, 53],
|
||||
'axis': {
|
||||
'x_labels': ['web', 'mail', 'email']
|
||||
'x_labels': ['web', 'mail', 'phone', 'email']
|
||||
},
|
||||
'measure': 'integer',
|
||||
}
|
||||
|
@ -132,9 +132,9 @@ def bijoe_mock(url, request):
|
|||
if url.path == '/visualization/2/json/':
|
||||
response = {
|
||||
'format': '1',
|
||||
'data': [222, 134, 53],
|
||||
'data': [222, 134, 0, 53],
|
||||
'axis': {
|
||||
'y_labels': ['web', 'mail', 'email']
|
||||
'y_labels': ['web', 'mail', 'phone', 'email']
|
||||
},
|
||||
'measure': 'integer',
|
||||
}
|
||||
|
@ -143,11 +143,11 @@ def bijoe_mock(url, request):
|
|||
response = {
|
||||
'format': '1',
|
||||
'data': [
|
||||
[222, 134, 53],
|
||||
[122, 114, 33],
|
||||
[222, 134, 0, 53],
|
||||
[122, 114, 2, 33],
|
||||
],
|
||||
'axis': {
|
||||
'x_labels': ['web', 'mail', 'email'],
|
||||
'x_labels': ['web', 'mail', 'phone', 'email'],
|
||||
'y_labels': ['foo', 'bar'],
|
||||
},
|
||||
'measure': 'integer',
|
||||
|
@ -165,11 +165,11 @@ def bijoe_mock(url, request):
|
|||
response = {
|
||||
'format': '1',
|
||||
'data': [
|
||||
[222, 134, 53],
|
||||
[122, 114, 33],
|
||||
[222, 134, 0, 53],
|
||||
[122, 114, 2, 33],
|
||||
],
|
||||
'axis': {
|
||||
'x_labels': ['web', 'mail', 'email'],
|
||||
'x_labels': ['web', 'mail', 'phone', 'email'],
|
||||
'loop': ['foo', 'bar'],
|
||||
}
|
||||
}
|
||||
|
@ -178,11 +178,11 @@ def bijoe_mock(url, request):
|
|||
response = {
|
||||
'format': '1',
|
||||
'data': [
|
||||
[222, 134, 53],
|
||||
[122, 114, 33],
|
||||
[222, 134, 0, 53],
|
||||
[122, 114, 2, 33],
|
||||
],
|
||||
'axis': {
|
||||
'y_labels': ['web', 'mail', 'email'],
|
||||
'y_labels': ['web', 'mail', 'phone', 'email'],
|
||||
'loop': ['foo', 'bar'],
|
||||
}
|
||||
}
|
||||
|
@ -191,14 +191,14 @@ def bijoe_mock(url, request):
|
|||
response = {
|
||||
'format': '1',
|
||||
'data': [
|
||||
[[222, 134, 53], [122, 114, 33]],
|
||||
[[222, 134, 53], [122, 114, 33]],
|
||||
[[222, 134, 53], [122, 114, 33]],
|
||||
[[222, 134, 53], [122, 114, 33]],
|
||||
[[222, 134, 0, 53], [122, 114, 2, 33]],
|
||||
[[222, 134, 0, 53], [122, 114, 2, 33]],
|
||||
[[222, 134, 0, 53], [122, 114, 2, 33]],
|
||||
[[222, 134, 0, 53], [122, 114, 2, 33]],
|
||||
],
|
||||
'axis': {
|
||||
'x_labels': ['foo', 'bar'],
|
||||
'y_labels': ['web', 'mail', 'email'],
|
||||
'y_labels': ['web', 'mail', 'phone', 'email'],
|
||||
'loop': ['a', 'b', 'c', 'd'],
|
||||
}
|
||||
}
|
||||
|
@ -231,9 +231,9 @@ def bijoe_mock(url, request):
|
|||
if url.path == '/visualization/10/json/':
|
||||
response = {
|
||||
'format': '1',
|
||||
'data': [10, 20, 30, 40],
|
||||
'data': [10, 20, 30, 40, 0],
|
||||
'axis': {
|
||||
'y_labels': ['web', 'mail', 'email', 'fax']
|
||||
'y_labels': ['web', 'mail', 'email', 'fax', 'phone']
|
||||
},
|
||||
'unit': None,
|
||||
'measure': 'percent',
|
||||
|
@ -263,21 +263,21 @@ def test_chartng_cell(app):
|
|||
# bar
|
||||
chart = cell.get_chart()
|
||||
assert chart.__class__.__name__ == 'Bar'
|
||||
assert chart.x_labels == ['web', 'mail', 'email']
|
||||
assert chart.raw_series == [([222, 134, 53], {'title': ''})]
|
||||
assert chart.x_labels == ['web', 'mail', 'phone', 'email']
|
||||
assert chart.raw_series == [([222, 134, 0, 53], {'title': ''})]
|
||||
|
||||
# horizontal bar
|
||||
cell.chart_type = 'horizontal-bar'
|
||||
chart = cell.get_chart()
|
||||
assert chart.__class__.__name__ == 'HorizontalBar'
|
||||
assert chart.x_labels == ['web', 'mail', 'email']
|
||||
assert chart.raw_series == [([222, 134, 53], {'title': ''})]
|
||||
assert chart.x_labels == ['web', 'mail', 'phone', 'email']
|
||||
assert chart.raw_series == [([222, 134, 0, 53], {'title': ''})]
|
||||
|
||||
# pie
|
||||
cell.chart_type = 'pie'
|
||||
chart = cell.get_chart()
|
||||
assert chart.__class__.__name__ == 'Pie'
|
||||
assert chart.x_labels == ['web', 'mail', 'email']
|
||||
assert chart.x_labels == ['web', 'mail', 'phone', 'email']
|
||||
assert chart.raw_series == [
|
||||
([222], {'title': u'web'}),
|
||||
([134], {'title': u'mail'}),
|
||||
|
@ -291,8 +291,8 @@ def test_chartng_cell(app):
|
|||
assert cell.cached_json == VISUALIZATION_JSON[1]
|
||||
|
||||
chart = cell.get_chart()
|
||||
assert chart.x_labels == ['web', 'mail', 'email']
|
||||
assert chart.raw_series == [([222, 134, 53], {'title': ''})]
|
||||
assert chart.x_labels == ['web', 'mail', 'phone', 'email']
|
||||
assert chart.raw_series == [([222, 134, 0, 53], {'title': ''})]
|
||||
|
||||
# data in X/Y
|
||||
cell.chart_type = 'bar'
|
||||
|
@ -301,10 +301,10 @@ def test_chartng_cell(app):
|
|||
assert cell.cached_json == VISUALIZATION_JSON[2]
|
||||
|
||||
chart = cell.get_chart()
|
||||
assert chart.x_labels == ['web', 'mail', 'email']
|
||||
assert chart.x_labels == ['web', 'mail', 'phone', 'email']
|
||||
assert chart.raw_series == [
|
||||
([222, 134, 53], {'title': u'foo'}),
|
||||
([122, 114, 33], {'title': u'bar'}),
|
||||
([222, 134, 0, 53], {'title': u'foo'}),
|
||||
([122, 114, 2, 33], {'title': u'bar'}),
|
||||
]
|
||||
|
||||
# single data point
|
||||
|
@ -321,20 +321,20 @@ def test_chartng_cell(app):
|
|||
cell.data_reference = 'plop:fifth'
|
||||
cell.save()
|
||||
chart = cell.get_chart()
|
||||
assert chart.x_labels == ['web', 'mail', 'email']
|
||||
assert chart.x_labels == ['web', 'mail', 'phone', 'email']
|
||||
assert chart.raw_series == [
|
||||
([222, 134, 53], {'title': u'foo'}),
|
||||
([122, 114, 33], {'title': u'bar'}),
|
||||
([222, 134, 0, 53], {'title': u'foo'}),
|
||||
([122, 114, 2, 33], {'title': u'bar'}),
|
||||
]
|
||||
|
||||
# loop/Y
|
||||
cell.data_reference = 'plop:sixth'
|
||||
cell.save()
|
||||
chart = cell.get_chart()
|
||||
assert chart.x_labels == ['web', 'mail', 'email']
|
||||
assert chart.x_labels == ['web', 'mail', 'phone', 'email']
|
||||
assert chart.raw_series == [
|
||||
([222, 134, 53], {'title': u'foo'}),
|
||||
([122, 114, 33], {'title': u'bar'}),
|
||||
([222, 134, 0, 53], {'title': u'foo'}),
|
||||
([122, 114, 2, 33], {'title': u'bar'}),
|
||||
]
|
||||
|
||||
# loop/X/Y
|
||||
|
|
Loading…
Reference in New Issue