Code Duplication    Length = 12-13 lines in 2 locations

tests/test_charts_builder.py 2 locations

@@ 293-305 (lines=13) @@
290
    app, test = client
291
    monkeypatch.setattr(charts_builder, 'auth', auth_ok)
292
    res = test.post(
293
        url_for('jsondash.delete', c_id='123'))
294
    assert REDIRECT_MSG in res.data
295
296
297
def test_delete_valid(monkeypatch, ctx, client):
298
    app, test = client
299
    monkeypatch.setattr(charts_builder, 'auth', auth_ok)
300
    view = get_json_config('inputs.json')
301
    readfunc = read(override=dict(view))
302
    monkeypatch.setattr(charts_builder.adapter, 'read', readfunc)
303
    res = test.post(
304
        url_for('jsondash.delete', c_id=view['id']),
305
        follow_redirects=True)
306
    dom = pq(res.data)
307
    flash_msg = 'Deleted dashboard "{}"'.format(view['id'])
308
    assert dom.find('.alert-info').text() == flash_msg
@@ 279-290 (lines=12) @@
276
    view = get_json_config('inputs.json')
277
    readfunc = read(override=dict(view))
278
    monkeypatch.setattr(charts_builder.adapter, 'read', readfunc)
279
    res = test.post(
280
        url_for('jsondash.clone', c_id=view['id']),
281
        follow_redirects=True)
282
    dom = pq(res.data)
283
    flash_msg = 'Created new dashboard clone "Clone of {}"'.format(
284
                 view['name'])
285
    assert dom.find('.alert-info').text() == flash_msg
286
287
288
@pytest.mark.invalid_id_redirect
289
def test_delete_invalid_id_redirect(monkeypatch, ctx, client):
290
    app, test = client
291
    monkeypatch.setattr(charts_builder, 'auth', auth_ok)
292
    res = test.post(
293
        url_for('jsondash.delete', c_id='123'))