|
@@ 271-282 (lines=12) @@
|
| 268 |
|
assert len(read()) == 0 |
| 269 |
|
|
| 270 |
|
|
| 271 |
|
def test_update_invalid_config(monkeypatch, ctx, client): |
| 272 |
|
app, test = client |
| 273 |
|
monkeypatch.setattr(charts_builder, 'auth', auth_valid) |
| 274 |
|
view = get_json_config('inputs.json') |
| 275 |
|
readfunc = read(override=dict(view)) |
| 276 |
|
monkeypatch.setattr(charts_builder.adapter, 'read', readfunc) |
| 277 |
|
res = test.post( |
| 278 |
|
url_for('jsondash.update', c_id=view['id']), |
| 279 |
|
data={'edit-raw': 'on'}, |
| 280 |
|
follow_redirects=True) |
| 281 |
|
dom = pq(res.data) |
| 282 |
|
assert dom.find('.alert-danger').text() == 'Error: Invalid JSON config.' |
| 283 |
|
|
| 284 |
|
|
| 285 |
|
def test_update_valid(monkeypatch, ctx, client): |
|
@@ 76-84 (lines=9) @@
|
| 73 |
|
assert 'Showing 10 dashboards with 0 charts' in heading |
| 74 |
|
|
| 75 |
|
|
| 76 |
|
def test_get_view_valid_id_invalid_config(monkeypatch, ctx, client): |
| 77 |
|
app, test = client |
| 78 |
|
monkeypatch.setattr(charts_builder, 'auth', auth_valid) |
| 79 |
|
view = dict(modules=[dict(foo='bar')]) |
| 80 |
|
readfunc = read(override=dict(view)) |
| 81 |
|
monkeypatch.setattr(charts_builder.adapter, 'read', readfunc) |
| 82 |
|
with pytest.raises(ValueError): |
| 83 |
|
res = test.get(url_for('jsondash.view', c_id='123')) |
| 84 |
|
assert 'Invalid config!' in str(res.data) |
| 85 |
|
|
| 86 |
|
|
| 87 |
|
def test_get_view_valid_id_invalid_modules(monkeypatch, ctx, client): |