Completed
Push — master ( bfcca1...8524f7 )
by Chris
01:05
created

test_no_config_sanity_test()   A

Complexity

Conditions 4

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
c 1
b 0
f 0
dl 0
loc 4
rs 9.2
1
import json
2
from datetime import datetime as dt
3
4
from flask import Flask
5
import pytest
6
7
from flask_jsondash import charts_builder
8
9
10
app = Flask('test_flask_jsondash')
11
app.debug = True
12
app.register_blueprint(charts_builder.charts)
13
14
15
@pytest.fixture
16
def client(request):
17
    app.config.update(
18
        JSONDASH_GLOBALDASH=False,
19
        JSONDASH_FILTERUSERS=False,
20
        JSONDASH_GLOBAL_USER='global-test',
21
    )
22
    return app.test_client()
23
24
25
def test_no_config_sanity_test(client):
26
    assert app.config.get('JSONDASH_GLOBALDASH') == False
27
    assert app.config.get('JSONDASH_FILTERUSERS') == False
28
    assert app.config.get('JSONDASH_GLOBAL_USER') == 'global-test'
29
30
31
def test_setting(client):
32
    with app.app_context():
33
        _get = charts_builder.setting
34
        assert _get('JSONDASH_GLOBALDASH') == False
35
        assert _get('JSONDASH_FILTERUSERS') == False
36
        assert _get('JSONDASH_GLOBAL_USER') == 'global-test'
37