16 |
16 |
|
17 |
17 |
pytestmark = pytest.mark.django_db
|
18 |
18 |
|
|
19 |
|
19 |
20 |
@pytest.fixture
|
20 |
21 |
def cell():
|
21 |
22 |
page = Page(title='One', slug='index')
|
... | ... | |
133 |
134 |
response = {
|
134 |
135 |
'format': '1',
|
135 |
136 |
'data': [222, 134, 0, 53],
|
136 |
|
'axis': {
|
137 |
|
'x_labels': ['web', 'mail', 'phone', 'email']
|
138 |
|
},
|
|
137 |
'axis': {'x_labels': ['web', 'mail', 'phone', 'email']},
|
139 |
138 |
'measure': 'integer',
|
140 |
139 |
}
|
141 |
140 |
return {'content': json.dumps(response), 'request': request, 'status_code': 200}
|
... | ... | |
143 |
142 |
response = {
|
144 |
143 |
'format': '1',
|
145 |
144 |
'data': [222, 134, 0, 53],
|
146 |
|
'axis': {
|
147 |
|
'y_labels': ['web', 'mail', 'phone', 'email']
|
148 |
|
},
|
|
145 |
'axis': {'y_labels': ['web', 'mail', 'phone', 'email']},
|
149 |
146 |
'measure': 'integer',
|
150 |
147 |
}
|
151 |
148 |
return {'content': json.dumps(response), 'request': request, 'status_code': 200}
|
152 |
149 |
if url.path == '/visualization/3/json/':
|
153 |
150 |
response = {
|
154 |
151 |
'format': '1',
|
155 |
|
'data': [
|
156 |
|
[222, 134, 0, 53],
|
157 |
|
[122, 114, 2, 33],
|
158 |
|
],
|
159 |
|
'axis': {
|
160 |
|
'x_labels': ['web', 'mail', 'phone', 'email'],
|
161 |
|
'y_labels': ['foo', 'bar'],
|
162 |
|
},
|
|
152 |
'data': [[222, 134, 0, 53], [122, 114, 2, 33],],
|
|
153 |
'axis': {'x_labels': ['web', 'mail', 'phone', 'email'], 'y_labels': ['foo', 'bar'],},
|
163 |
154 |
'measure': 'integer',
|
164 |
155 |
}
|
165 |
156 |
return {'content': json.dumps(response), 'request': request, 'status_code': 200}
|
... | ... | |
174 |
165 |
if url.path == '/visualization/5/json/':
|
175 |
166 |
response = {
|
176 |
167 |
'format': '1',
|
177 |
|
'data': [
|
178 |
|
[222, 134, 0, 53],
|
179 |
|
[122, 114, 2, 33],
|
180 |
|
],
|
181 |
|
'axis': {
|
182 |
|
'x_labels': ['web', 'mail', 'phone', 'email'],
|
183 |
|
'loop': ['foo', 'bar'],
|
184 |
|
}
|
|
168 |
'data': [[222, 134, 0, 53], [122, 114, 2, 33],],
|
|
169 |
'axis': {'x_labels': ['web', 'mail', 'phone', 'email'], 'loop': ['foo', 'bar'],},
|
185 |
170 |
}
|
186 |
171 |
return {'content': json.dumps(response), 'request': request, 'status_code': 200}
|
187 |
172 |
if url.path == '/visualization/6/json/':
|
188 |
173 |
response = {
|
189 |
174 |
'format': '1',
|
190 |
|
'data': [
|
191 |
|
[222, 134, 0, 53],
|
192 |
|
[122, 114, 2, 33],
|
193 |
|
],
|
194 |
|
'axis': {
|
195 |
|
'y_labels': ['web', 'mail', 'phone', 'email'],
|
196 |
|
'loop': ['foo', 'bar'],
|
197 |
|
}
|
|
175 |
'data': [[222, 134, 0, 53], [122, 114, 2, 33],],
|
|
176 |
'axis': {'y_labels': ['web', 'mail', 'phone', 'email'], 'loop': ['foo', 'bar'],},
|
198 |
177 |
}
|
199 |
178 |
return {'content': json.dumps(response), 'request': request, 'status_code': 200}
|
200 |
179 |
if url.path == '/visualization/7/json/':
|
... | ... | |
210 |
189 |
'x_labels': ['foo', 'bar'],
|
211 |
190 |
'y_labels': ['web', 'mail', 'phone', 'email'],
|
212 |
191 |
'loop': ['a', 'b', 'c', 'd'],
|
213 |
|
}
|
|
192 |
},
|
214 |
193 |
}
|
215 |
194 |
return {'content': json.dumps(response), 'request': request, 'status_code': 200}
|
216 |
195 |
if url.path == '/visualization/8/json/':
|
217 |
196 |
response = {
|
218 |
197 |
'format': '1',
|
219 |
198 |
'data': [1000, 123000, 8600, 86400],
|
220 |
|
'axis': {
|
221 |
|
'y_labels': ['web', 'mail', 'email', 'fax']
|
222 |
|
},
|
|
199 |
'axis': {'y_labels': ['web', 'mail', 'email', 'fax']},
|
223 |
200 |
'unit': 'seconds',
|
224 |
201 |
'measure': 'duration',
|
225 |
202 |
}
|
... | ... | |
227 |
204 |
if url.path == '/visualization/9/json/':
|
228 |
205 |
response = {
|
229 |
206 |
'format': '1',
|
230 |
|
'data': [
|
231 |
|
[1, 1, 1, 1],
|
232 |
|
[1],
|
233 |
|
[1, 1],
|
234 |
|
],
|
235 |
|
'axis': {
|
236 |
|
'y_labels': ['web', 'mail', 'email'],
|
237 |
|
'loop': ['a', 'b', 'c', 'd'],
|
238 |
|
}
|
|
207 |
'data': [[1, 1, 1, 1], [1], [1, 1],],
|
|
208 |
'axis': {'y_labels': ['web', 'mail', 'email'], 'loop': ['a', 'b', 'c', 'd'],},
|
239 |
209 |
}
|
240 |
210 |
return {'content': json.dumps(response), 'request': request, 'status_code': 200}
|
241 |
211 |
if url.path == '/visualization/10/json/':
|
242 |
212 |
response = {
|
243 |
213 |
'format': '1',
|
244 |
214 |
'data': [10, 20, 30, 40, 0],
|
245 |
|
'axis': {
|
246 |
|
'y_labels': ['web', 'mail', 'email', 'fax', 'phone']
|
247 |
|
},
|
|
215 |
'axis': {'y_labels': ['web', 'mail', 'email', 'fax', 'phone']},
|
248 |
216 |
'unit': None,
|
249 |
217 |
'measure': 'percent',
|
250 |
218 |
}
|
... | ... | |
256 |
224 |
return {'content': json.dumps(response), 'request': request, 'status_code': 404}
|
257 |
225 |
|
258 |
226 |
|
259 |
|
|
260 |
227 |
@with_httmock(bijoe_mock)
|
261 |
228 |
def test_chartng_cell(app):
|
262 |
229 |
page = Page(title='One', slug='index')
|
... | ... | |
288 |
255 |
assert chart.raw_series == [
|
289 |
256 |
([222], {'title': u'web'}),
|
290 |
257 |
([134], {'title': u'mail'}),
|
291 |
|
([53], {'title': u'email'})
|
|
258 |
([53], {'title': u'email'}),
|
292 |
259 |
]
|
293 |
260 |
|
294 |
261 |
# data in Y
|
... | ... | |
400 |
367 |
assert chart.raw_series == [
|
401 |
368 |
([222], {'title': u'web'}),
|
402 |
369 |
([134], {'title': u'mail'}),
|
403 |
|
([53], {'title': u'email'})
|
|
370 |
([53], {'title': u'email'}),
|
404 |
371 |
]
|
405 |
372 |
|
406 |
373 |
# data in Y
|
... | ... | |
489 |
456 |
assert chart.raw_series == [
|
490 |
457 |
([53], {'title': u'email'}),
|
491 |
458 |
([134], {'title': u'mail'}),
|
492 |
|
([222], {'title': u'web'})
|
|
459 |
([222], {'title': u'web'}),
|
493 |
460 |
]
|
494 |
461 |
|
495 |
462 |
# data in Y
|
... | ... | |
578 |
545 |
assert chart.raw_series == [
|
579 |
546 |
([222], {'title': u'web'}),
|
580 |
547 |
([134], {'title': u'mail'}),
|
581 |
|
([53], {'title': u'email'})
|
|
548 |
([53], {'title': u'email'}),
|
582 |
549 |
]
|
583 |
550 |
|
584 |
551 |
# data in Y
|
585 |
|
-
|