@@ 433-444 (lines=12) @@ | ||
430 | assert dom.find('.chart-header .dropdown-toggle') |
|
431 | ||
432 | ||
433 | def test_demo_mode(monkeypatch, client): |
|
434 | # Test that certain UI elements are removed when in demo mode. |
|
435 | _, test = client |
|
436 | monkeypatch.setattr(charts_builder, 'auth', auth_valid) |
|
437 | data = dict(name='newname', modules=[]) |
|
438 | test.post(url_for('jsondash.create'), data=data, follow_redirects=True) |
|
439 | view_id = read()[0]['id'] |
|
440 | url = url_for('jsondash.view', c_id=view_id) + '?jsondash_demo_mode=1' |
|
441 | res = test.get(url) |
|
442 | dom = pq(res.data) |
|
443 | assert not dom.find('.chart-header > small .btn') |
|
444 | assert not dom.find('.chart-header .dropdown-toggle') |
|
445 | ||
446 | ||
447 | def test_correct_charts_count(monkeypatch, client): |
|
@@ 419-430 (lines=12) @@ | ||
416 | assert len(read()) == 1 |
|
417 | ||
418 | ||
419 | def test_no_demo_mode(monkeypatch, client): |
|
420 | _, test = client |
|
421 | monkeypatch.setattr(charts_builder, 'auth', auth_valid) |
|
422 | data = dict(name='newname', modules=[]) |
|
423 | test.post(url_for('jsondash.create'), data=data, follow_redirects=True) |
|
424 | view_id = read()[0]['id'] |
|
425 | url = url_for('jsondash.view', c_id=view_id) |
|
426 | res = test.get(url) |
|
427 | dom = pq(res.data) |
|
428 | assert dom.find('.chart-header small > .btn') |
|
429 | assert dom.find('.chart-header small > .btn').text().strip() == 'Back' |
|
430 | assert dom.find('.chart-header .dropdown-toggle') |
|
431 | ||
432 | ||
433 | def test_demo_mode(monkeypatch, client): |