예제 #1
0
def test_default_config():
    cfgfile.load(paths.default_config_file_path())
    assert cfg.log_enabled
    assert cfg.log_stdout_level == 'warn'
    assert cfg.log_file_level == 'info'
    assert cfg.log_file_path is None
    assert cfg.persistence_enabled
    assert cfg.plugins == ()
예제 #2
0
def test_defaults():
    create_test_config(dict())
    cfgfile.load()
    assert not cfg.log_enabled
    assert cfg.log_stdout_level == 'off'
    assert cfg.log_file_level == 'off'
    assert cfg.log_file_path is None
    assert not cfg.persistence_enabled
    assert cfg.plugins == ()
예제 #3
0
def test_not_str_type_raises_error():
    create_test_config({"log": {"stdout": {"level": 3}}})  # Non-str value
    with pytest.raises(TypeError):
        cfgfile.load()
예제 #4
0
def test_plugins_array():
    create_test_config({"plugins": ["p1", "p2"]})
    cfgfile.load()
    assert cfg.plugins == ("p1", "p2")
예제 #5
0
def test_plugins_single_value():
    create_test_config({"plugins": "plugin"})
    cfgfile.load()
    assert cfg.plugins == ("plugin", )