Code Duplication    Length = 13-16 lines in 2 locations

tests/test_model_factories.py 2 locations

@@ 101-116 (lines=16) @@
98
    assert len(read()) == 0
99
100
101
def test_dump_fixtures_delete_bad_path_show_errors_no_exception(monkeypatch):
102
    records = [
103
        model_factories.make_fake_dashboard(name=i, max_charts=1)
104
        for i in range(1)]
105
106
    def delete_all():
107
        global records
108
        records = []
109
110
    monkeypatch.setattr(_db, 'read', lambda *args, **kwargs: records)
111
    runner = CliRunner()
112
    args = ['--dump', '/fakepath/', '--delete']
113
    result = runner.invoke(model_factories.insert_dashboards, args)
114
    assert 'Saving db as fixtures to:' in result.output
115
    assert result.exit_code == 0
116
    assert len(read()) == 0
117
@@ 66-78 (lines=13) @@
63
    assert len(records) == 16  # Changed as new examples are added.
64
65
66
def test_dump_fixtures(monkeypatch, tmpdir):
67
    records = [
68
        model_factories.make_fake_dashboard(name=i, max_charts=1)
69
        for i in range(10)]
70
71
    monkeypatch.setattr(_db, 'read', lambda *args, **kwargs: records)
72
    runner = CliRunner()
73
    tmp = tmpdir.mkdir('dumped_fixtures_test')
74
    args = ['--dump', tmp.strpath]
75
    result = runner.invoke(model_factories.insert_dashboards, args)
76
    assert 'Saving db as fixtures to:' in result.output
77
    assert result.exit_code == 0
78
    assert len(os.listdir(tmp.strpath)) == len(records)
79
80
81
def test_dump_fixtures_delete(monkeypatch, tmpdir):