88 |
88 |
'name': 'seventh visualization (loop/X/Y)',
|
89 |
89 |
'slug': 'seventh',
|
90 |
90 |
},
|
91 |
|
|
|
91 |
{
|
|
92 |
'data-url': 'https://bijoe.example.com/visualization/8/json/',
|
|
93 |
'path': 'https://bijoe.example.com/visualization/8/iframe/?signature=123',
|
|
94 |
'name': 'eighth visualization (duration)',
|
|
95 |
'slug': 'eighth',
|
|
96 |
},
|
92 |
97 |
]
|
93 |
98 |
|
94 |
99 |
|
... | ... | |
175 |
180 |
}
|
176 |
181 |
}
|
177 |
182 |
return {'content': json.dumps(response), 'request': request, 'status_code': 200}
|
|
183 |
if url.path == '/visualization/8/json/':
|
|
184 |
response = {
|
|
185 |
'format': '1',
|
|
186 |
'data': [1000, 123000, 8600, 86400],
|
|
187 |
'axis': {
|
|
188 |
'y_labels': ['web', 'mail', 'email', 'fax']
|
|
189 |
},
|
|
190 |
'unit': 'seconds',
|
|
191 |
}
|
|
192 |
return {'content': json.dumps(response), 'request': request, 'status_code': 200}
|
178 |
193 |
|
179 |
194 |
|
180 |
195 |
def test_chartng_cell(app):
|
... | ... | |
273 |
288 |
with pytest.raises(UnsupportedDataSet):
|
274 |
289 |
chart = cell.get_chart()
|
275 |
290 |
|
|
291 |
# duration
|
|
292 |
cell.data_reference = 'plop:eighth'
|
|
293 |
cell.save()
|
|
294 |
chart = cell.get_chart()
|
|
295 |
|
276 |
296 |
|
277 |
297 |
def test_chartng_cell_view(app, normal_user):
|
278 |
298 |
page = Page(title='One', slug='index')
|
... | ... | |
331 |
351 |
resp = app.get('/api/dataviz/graph/1/?width=400', status=200)
|
332 |
352 |
assert 'Unsupported dataset' in resp.text
|
333 |
353 |
|
|
354 |
# durations
|
|
355 |
cell.data_reference = 'plop:eighth'
|
|
356 |
cell.chart_type = 'table'
|
|
357 |
cell.save()
|
|
358 |
resp = app.get('/api/dataviz/graph/1/') # get data in cache
|
|
359 |
resp = app.get('/')
|
|
360 |
assert '<td>Less than an hour</td>' in resp.text
|
|
361 |
assert '<td>1 day and 10 hours</td>' in resp.text
|
|
362 |
assert '<td>2 hours</td>' in resp.text
|
|
363 |
assert '<td>1 day</td>' in resp.text
|
|
364 |
|
|
365 |
cell.chart_type = 'bar'
|
|
366 |
cell.save()
|
|
367 |
resp = app.get('/api/dataviz/graph/1/?width=400', status=200)
|
|
368 |
assert '>Less than an hour<' in resp.text
|
|
369 |
assert '>1 day and 10 hours<' in resp.text
|
|
370 |
assert '>2 hours<' in resp.text
|
|
371 |
assert '>1 day<' in resp.text
|
|
372 |
|
334 |
373 |
|
335 |
374 |
def test_chartng_cell_manager(app, admin_user):
|
336 |
375 |
page = Page(title='One', slug='index')
|
... | ... | |
347 |
386 |
cell.save()
|
348 |
387 |
resp = app.get('/manage/pages/%s/' % page.id)
|
349 |
388 |
assert resp.form['cdataviz_chartngcell-%s-data_reference' % cell.id].options == [
|
|
389 |
(u'plop:eighth', False, u'eighth visualization (duration)'),
|
350 |
390 |
(u'plop:example', True, u'example visualization (X)'),
|
351 |
391 |
(u'plop:fifth', False, u'fifth visualization (loop/X)'),
|
352 |
392 |
(u'plop:fourth', False, u'fourth visualization (no axis)'),
|
353 |
|
-
|