@@ 69-79 (lines=11) @@ | ||
66 | assert 'No dashboards exist. Create one below to get started.' in res |
|
67 | ||
68 | ||
69 | def test_dashboards_override_perpage_pagination(monkeypatch, client): |
|
70 | _, test = client |
|
71 | monkeypatch.setattr(charts_builder, 'auth', auth_valid) |
|
72 | for i in range(10): |
|
73 | data = dict(name=i, modules=[]) |
|
74 | res = test.post(url_for('jsondash.create'), data=data) |
|
75 | res = test.get(url_for('jsondash.dashboard') + '?per_page=2') |
|
76 | # Ensure 10 exist, but only 5 are shown |
|
77 | assert len(read()) == 10 |
|
78 | dom = pq(res.data) |
|
79 | assert len(dom.find('.pagination').find('li:not(.active)')) == 5 |
|
80 | ||
81 | ||
82 | def test_create_dashboards_check_index_count(monkeypatch, client): |
|
@@ 130-139 (lines=10) @@ | ||
127 | assert len(dom.find('.item')) == len(view['modules']) |
|
128 | ||
129 | ||
130 | def test_view_valid_dashboard_count_and_inputs(monkeypatch, client): |
|
131 | _, test = client |
|
132 | monkeypatch.setattr(charts_builder, 'auth', auth_valid) |
|
133 | view = get_json_config('inputs.json') |
|
134 | readfunc = read(override=dict(view)) |
|
135 | monkeypatch.setattr(adapter, 'read', readfunc) |
|
136 | res = test.get(url_for('jsondash.view', c_id=view['id'])) |
|
137 | dom = pq(res.data) |
|
138 | assert len(dom.find('.item')) == len(view['modules']) |
|
139 | assert len(dom.find('.charts-input-icon')) == 1 |
|
140 | ||
141 | ||
142 | def test_view_valid_dashboard_inputs_form(monkeypatch, client): |
|
@@ 82-91 (lines=10) @@ | ||
79 | assert len(dom.find('.pagination').find('li:not(.active)')) == 5 |
|
80 | ||
81 | ||
82 | def test_create_dashboards_check_index_count(monkeypatch, client): |
|
83 | _, test = client |
|
84 | monkeypatch.setattr(charts_builder, 'auth', auth_valid) |
|
85 | for i in range(10): |
|
86 | data = dict(name=i, modules=[]) |
|
87 | res = test.post(url_for('jsondash.create'), data=data) |
|
88 | res = test.get(url_for('jsondash.dashboard')) |
|
89 | assert len(read()) == 10 |
|
90 | heading = pq(res.data).find('h1.lead').text() |
|
91 | assert 'Showing 10 dashboards with 0 charts' in heading |
|
92 | ||
93 | ||
94 | def test_get_view_valid_id_invalid_config(monkeypatch, client): |