Code Duplication    Length = 10-11 lines in 2 locations

tests/test_charts_builder.py 2 locations

@@ 51-61 (lines=11) @@
48
    monkeypatch.setattr(charts_builder, 'auth', auth_valid)
49
    res = str(test.get(url_for('jsondash.dashboard')).data)
50
    assert 'No dashboards exist. Create one below to get started.' in res
51
52
53
def test_dashboards_override_perpage_pagination(monkeypatch, ctx, client):
54
    app, test = client
55
    monkeypatch.setattr(charts_builder, 'auth', auth_valid)
56
    for i in range(10):
57
        data = dict(name=i, modules=[])
58
        res = test.post(url_for('jsondash.create'), data=data)
59
    res = test.get(url_for('jsondash.dashboard') + '?per_page=2')
60
    # Ensure 10 exist, but only 5 are shown
61
    assert len(read()) == 10
62
    dom = pq(res.data)
63
    assert len(dom.find('.pagination').find('li:not(.active)')) == 5
64
@@ 64-73 (lines=10) @@
61
    assert len(read()) == 10
62
    dom = pq(res.data)
63
    assert len(dom.find('.pagination').find('li:not(.active)')) == 5
64
65
66
def test_create_dashboards_check_index_count(monkeypatch, ctx, client):
67
    app, test = client
68
    monkeypatch.setattr(charts_builder, 'auth', auth_valid)
69
    for i in range(10):
70
        data = dict(name=i, modules=[])
71
        res = test.post(url_for('jsondash.create'), data=data)
72
    res = test.get(url_for('jsondash.dashboard'))
73
    assert len(read()) == 10
74
    heading = pq(res.data).find('h1.lead').text()
75
    assert 'Showing 10 dashboards with 0 charts' in heading
76