def test_add_series_series_already_exists(config, series): config['series'].append(series) with pytest.raises(SeriesbutlerException) as exceptionInfo: functions.add_series(config, series) assert (str(exceptionInfo.value) == 'Series with imdbid tt2467372 is ' 'already registered!')
def test_add_series_happy_path(config, series): assert series not in config['series'] functions.add_series(config, series) assert series in config['series'] assert os.path.exists(os.path.join(config['working_directory'], series['name'])) assert len(open(config['config_path']).read()) == 291
def test_fetch_all_called_with_invalid_series_cfg(monkeypatch, config, series): monkeypatch.delitem(series, 'start_from') with pytest.raises(ConfigurationException) as exceptionInfo: functions.add_series(config, series)
def test_add_series_directory_already_exists(config, series): os.mkdir(os.path.join(config['working_directory'], series['name'])) functions.add_series(config, series) assert os.path.exists(os.path.join(config['working_directory'], series['name']))