Code Duplication    Length = 12-12 lines in 2 locations

tests/test_charts_builder.py 2 locations

@@ 422-433 (lines=12) @@
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):
434
    # Test that certain UI elements are removed when in demo mode.
435
    _, test = client
436
    monkeypatch.setattr(charts_builder, 'auth', auth_valid)
@@ 408-419 (lines=12) @@
405
    assert res.status_code == 200
406
    assert len(read()) == 1
407
    view_id = read()[0]['id']
408
    dash_data.update(mode='grid')
409
    res = test.post(url_for('jsondash.update', c_id=view_id),
410
                    data=dash_data,
411
                    follow_redirects=True)
412
    dom = pq(res.data)
413
    flash_msg = ('Cannot use grid layout without specifying row(s)! '
414
                 'Edit JSON manually to override this.')
415
    assert flash_msg in dom.find('.alert-danger').text()
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=[])