|
@@ 293-305 (lines=13) @@
|
| 290 |
|
assert dom.find('.alert-danger').text() == 'Error: Invalid JSON config.' |
| 291 |
|
|
| 292 |
|
|
| 293 |
|
def test_update_valid(monkeypatch, ctx, client): |
| 294 |
|
app, test = client |
| 295 |
|
monkeypatch.setattr(charts_builder, 'auth', auth_ok) |
| 296 |
|
view = get_json_config('inputs.json') |
| 297 |
|
readfunc = read(override=dict(view)) |
| 298 |
|
monkeypatch.setattr(charts_builder.adapter, 'read', readfunc) |
| 299 |
|
res = test.post( |
| 300 |
|
url_for('jsondash.update', c_id=view['id']), |
| 301 |
|
data=dict(name='newname'), |
| 302 |
|
follow_redirects=True) |
| 303 |
|
dom = pq(res.data) |
| 304 |
|
flash_msg = 'Updated view "{}"'.format(view['id']) |
| 305 |
|
assert dom.find('.alert-info').text() == flash_msg |
| 306 |
|
|
|
@@ 279-290 (lines=12) @@
|
| 276 |
|
assert REDIRECT_MSG in res.data |
| 277 |
|
|
| 278 |
|
|
| 279 |
|
def test_update_invalid_config(monkeypatch, ctx, client): |
| 280 |
|
app, test = client |
| 281 |
|
monkeypatch.setattr(charts_builder, 'auth', auth_ok) |
| 282 |
|
view = get_json_config('inputs.json') |
| 283 |
|
readfunc = read(override=dict(view)) |
| 284 |
|
monkeypatch.setattr(charts_builder.adapter, 'read', readfunc) |
| 285 |
|
res = test.post( |
| 286 |
|
url_for('jsondash.update', c_id=view['id']), |
| 287 |
|
data={'edit-raw': 'on'}, |
| 288 |
|
follow_redirects=True) |
| 289 |
|
dom = pq(res.data) |
| 290 |
|
assert dom.find('.alert-danger').text() == 'Error: Invalid JSON config.' |
| 291 |
|
|
| 292 |
|
|
| 293 |
|
def test_update_valid(monkeypatch, ctx, client): |