117 |
117 |
response = response.click(href='save')
|
118 |
118 |
response.form['name'] = 'test'
|
119 |
119 |
response.form.submit()
|
120 |
120 |
|
121 |
121 |
visu = Visualization.objects.get(name='test')
|
122 |
122 |
assert visu.parameters['warehouse_slug'] == 'schema1_slug'
|
123 |
123 |
|
124 |
124 |
|
125 |
|
def test_import_visualization(schema1, app, admin, visualization):
|
|
125 |
def test_import_visualization(schema1, app, admin, visualization, settings):
|
|
126 |
settings.LANGUAGE_CODE = 'en-us'
|
126 |
127 |
login(app, admin)
|
127 |
128 |
resp = app.get('/visualization/%s/' % visualization.id)
|
128 |
129 |
resp = resp.click('Export as JSON')
|
129 |
130 |
assert resp.headers['content-type'] == 'application/json'
|
130 |
131 |
visualization_export = resp.text
|
131 |
132 |
|
132 |
133 |
# invalid json
|
133 |
134 |
resp = app.get('/', status=200)
|
... | ... | |
186 |
187 |
resp = app.get('/')
|
187 |
188 |
resp = resp.click('Import')
|
188 |
189 |
resp.form['visualizations_json'] = Upload('export.json', visualizations_export.encode('utf-8'), 'application/json')
|
189 |
190 |
resp = resp.form.submit().follow()
|
190 |
191 |
assert '3 visualizations have been created. No visualization updated.' in resp.text
|
191 |
192 |
assert Visualization.objects.count() == 3
|
192 |
193 |
|
193 |
194 |
|
194 |
|
def test_save_as(schema1, app, admin, visualization):
|
|
195 |
def test_save_as(schema1, app, admin, visualization, settings):
|
|
196 |
settings.LANGUAGE_CODE = 'en-us'
|
195 |
197 |
login(app, admin)
|
196 |
198 |
resp = app.get('/visualization/%s/' % visualization.id)
|
197 |
199 |
resp = resp.click('Save as')
|
198 |
200 |
assert resp.form['name'].value == 'test (Copy)'
|
199 |
201 |
resp.form['name'] = 'zob'
|
200 |
202 |
resp = resp.form.submit().follow()
|
201 |
203 |
assert Visualization.objects.count() == 2
|
202 |
204 |
new_visualization = Visualization.objects.get(name='zob')
|
203 |
|
-
|