Code Duplication    Length = 9-12 lines in 2 locations

tests/test_charts_builder.py 2 locations

@@ 320-331 (lines=12) @@
317
    assert REDIRECT_MSG in res.data
318
319
320
def test_update_invalid_config(monkeypatch, ctx, client):
321
    app, test = client
322
    monkeypatch.setattr(charts_builder, 'auth', auth_ok)
323
    view = get_json_config('inputs.json')
324
    readfunc = read(override=dict(view))
325
    monkeypatch.setattr(charts_builder.adapter, 'read', readfunc)
326
    res = test.post(
327
        url_for('jsondash.update', c_id=view['id']),
328
        data={'edit-raw': 'on'},
329
        follow_redirects=True)
330
    dom = pq(res.data)
331
    assert dom.find('.alert-danger').text() == 'Error: Invalid JSON config.'
332
333
334
def test_update_valid(monkeypatch, ctx, client):
@@ 198-206 (lines=9) @@
195
    assert 'No dashboards exist. Create one below to get started.' in res.data
196
197
198
def test_get_view_valid_id_invalid_config(monkeypatch, ctx, client):
199
    app, test = client
200
    monkeypatch.setattr(charts_builder, 'auth', auth_ok)
201
    view = dict(modules=[dict(foo='bar')])
202
    readfunc = read(override=dict(view))
203
    monkeypatch.setattr(charts_builder.adapter, 'read', readfunc)
204
    with pytest.raises(ValueError):
205
        res = test.get(url_for('jsondash.view', c_id='123'))
206
        assert 'Invalid config!' in res.data
207
208
209
def test_get_view_valid_id_invalid_modules(monkeypatch, ctx, client):