예제 #1
0
def test_load_configuration_happy_path():
    cfg = functions.load_configuration('tests/data/examples/valid')

    # Assert loaded values (some samples)
    assert len(cfg['hosters']['ignored']) == 1
    assert len(cfg['hosters']['preferred']) == 1
    assert cfg['series'][0]['imdb'] == 'tt2467372'
    assert cfg['series'][0]['name'] == 'Brooklyn Nine-Nine'
    assert cfg['series'][0]['tvdb'] == '269586'

    # Asset dynamic properties
    assert cfg['working_directory'].endswith('tests/data/examples/valid')
    assert cfg['config_path'].endswith('examples/valid/seriesbutler.json')
예제 #2
0
def test_load_configuration_missing_cfg():
    with pytest.raises(FileNotFoundError) as exceptionInfo:
        functions.load_configuration('tests/data/examples/missing')
예제 #3
0
def test_load_configuration_without_working_directory():
    # Switch working directory
    with functions._pushd('tests/data/examples/valid'):
        cfg = functions.load_configuration()
        assert cfg['working_directory'].endswith('tests/data/examples/valid')
예제 #4
0
def test_load_configuration_invalid_cfg():
    with pytest.raises(ConfigurationException) as exceptionInfo:
        functions.load_configuration('tests/data/examples/invalid')
    assert (str(exceptionInfo.value) == 'series.0.start_from.season -> '
            '-1 is less than the minimum of 0')