Code Duplication    Length = 11-13 lines in 2 locations

tests/test_charts_builder.py 2 locations

@@ 290-302 (lines=13) @@
287
    assert len(read()) == 0
288
289
290
@pytest.mark.update_raw
291
def test_update_edit_raw_invalid(monkeypatch, client):
292
    _, test = client
293
    monkeypatch.setattr(charts_builder, 'auth', auth_valid)
294
    view = get_json_config('inputs.json')
295
    readfunc = read(override=dict(view))
296
    monkeypatch.setattr(adapter, 'read', readfunc)
297
    res = test.post(
298
        url_for('jsondash.update', c_id=view['id']),
299
        data={'edit-raw': 'on'},
300
        follow_redirects=True)
301
    dom = pq(res.data)
302
    assert 'Error: Invalid JSON config.' in dom.find('.alert-danger').text()
303
304
305
@pytest.mark.schema
@@ 117-127 (lines=11) @@
114
    assert 'Invalid configuration - missing modules.' in str(res.data)
115
116
117
def test_get_view_valid_id_ensure_id_popped(monkeypatch, client):
118
    _, test = client
119
    monkeypatch.setattr(charts_builder, 'auth', auth_valid)
120
    view = get_json_config('inputs.json')
121
    view = dict(view)
122
    view.update(_id='foo')
123
    readfunc = read(override=view)
124
    monkeypatch.setattr(adapter, 'read', readfunc)
125
    res = test.get(url_for('jsondash.view', c_id=view['id']))
126
    dom = pq(res.data)
127
    assert len(dom.find('.item')) == len(view['modules'])
128
129
130
def test_view_valid_dashboard_count_and_inputs(monkeypatch, client):