Task 2: guard SeriesApp NFOService init on NFOServiceFactory fallback and document config-only TMDB API key support
This commit is contained in:
@@ -49,6 +49,33 @@ class TestSeriesAppInitialization:
|
||||
with pytest.raises(RuntimeError):
|
||||
SeriesApp(test_dir)
|
||||
|
||||
@patch('src.core.SeriesApp.Loaders')
|
||||
@patch('src.core.SeriesApp.SerieScanner')
|
||||
@patch('src.core.SeriesApp.SerieList')
|
||||
@patch('src.core.services.nfo_factory.get_nfo_factory')
|
||||
@patch('src.core.SeriesApp.settings')
|
||||
def test_init_uses_config_fallback_for_nfo_service(
|
||||
self,
|
||||
mock_settings,
|
||||
mock_get_factory,
|
||||
mock_serie_list,
|
||||
mock_scanner,
|
||||
mock_loaders,
|
||||
):
|
||||
"""SeriesApp should initialize NFO via config.json even when TMDB_API_KEY is unset."""
|
||||
test_dir = "/test/anime"
|
||||
mock_settings.tmdb_api_key = None
|
||||
|
||||
mock_factory = Mock()
|
||||
mock_service = Mock()
|
||||
mock_factory.create.return_value = mock_service
|
||||
mock_get_factory.return_value = mock_factory
|
||||
|
||||
app = SeriesApp(test_dir)
|
||||
|
||||
assert app.nfo_service is mock_service
|
||||
mock_get_factory.assert_called_once()
|
||||
|
||||
|
||||
class TestSeriesAppSearch:
|
||||
"""Test search functionality."""
|
||||
|
||||
Reference in New Issue
Block a user