Beispiel #1
0
def test_load_missing_file():
    settings = Settings()
    file_path = '/does/not/exist/62c889d0-39a0-4f5b-838b-abb635dee5fc.txt'

    with pytest.raises(IOError):
        # noinspection PyProtectedMember
        settings._load(file_path)
Beispiel #2
0
def test_load_file():
    settings = Settings()
    # noinspection PyProtectedMember
    settings._load(asset_config_path)

    assert settings.FOO == 'bar'
    assert settings.BAR == [1, 2, 3]
Beispiel #3
0
def test_read_missing_key():
    settings = Settings()

    with pytest.raises(AttributeError):
        assert settings.DOES_NOT_EXIST
Beispiel #4
0
def test_set_settings():
    settings = Settings()
    settings.NEW_KEY = 'new_value'
    assert settings.NEW_KEY == 'new_value'