Fix integration test failures
- Fix test_data_file_db_sync.py: Remove unused mock logger parameters - Fix test_nfo_workflow.py: Add missing async mocks for TMDB methods * Add get_tv_show_content_ratings mock for FSK rating support * Add get_image_url mock to return proper URL strings * Fix test_nfo_update_workflow to include TMDB ID in existing NFO - Fix DownloadService method calls in test fixtures * Change stop() to stop_downloads() (correct method name) * Change start() to start_queue_processing() * Add exception handling for ProgressServiceError in teardown - All 1380 tests now passing with 0 failures and 0 errors
This commit is contained in:
@@ -99,9 +99,8 @@ class TestCompleteNFOWorkflow:
|
||||
mock_tmdb.search_tv_show = AsyncMock(return_value={"results": [mock_tmdb_show]})
|
||||
mock_tmdb.get_tv_show = AsyncMock(return_value=mock_tmdb_show)
|
||||
mock_tmdb.get_tv_show_details = AsyncMock(return_value=mock_tmdb_show)
|
||||
# Mock async context manager
|
||||
mock_tmdb.__aenter__ = AsyncMock(return_value=mock_tmdb)
|
||||
mock_tmdb.__aexit__ = AsyncMock(return_value=None)
|
||||
mock_tmdb.get_tv_show_content_ratings = AsyncMock(return_value={"results": []})
|
||||
mock_tmdb.get_image_url = Mock(return_value="https://image.tmdb.org/t/p/original/test.jpg")
|
||||
|
||||
# Create NFO service with mocked TMDB
|
||||
with patch(
|
||||
@@ -166,13 +165,14 @@ class TestCompleteNFOWorkflow:
|
||||
"first_air_date": "2020-01-01",
|
||||
}]}
|
||||
)
|
||||
mock_tmdb.get_tv_show = AsyncMock(
|
||||
mock_tmdb.get_tv_show_details = AsyncMock(
|
||||
return_value={
|
||||
"id": 999,
|
||||
"name": "Test Anime",
|
||||
"first_air_date": "2020-01-01",
|
||||
}
|
||||
)
|
||||
mock_tmdb.get_tv_show_content_ratings = AsyncMock(return_value={"results": []})
|
||||
|
||||
with patch(
|
||||
"src.core.services.nfo_service.TMDBClient",
|
||||
@@ -246,6 +246,7 @@ class TestCompleteNFOWorkflow:
|
||||
<tvshow>
|
||||
<title>Test Anime</title>
|
||||
<year>2020</year>
|
||||
<uniqueid type="tmdb" default="true">999</uniqueid>
|
||||
</tvshow>"""
|
||||
)
|
||||
|
||||
@@ -261,7 +262,7 @@ class TestCompleteNFOWorkflow:
|
||||
"vote_average": 9.0,
|
||||
}]}
|
||||
)
|
||||
mock_tmdb.get_tv_show = AsyncMock(
|
||||
mock_tmdb.get_tv_show_details = AsyncMock(
|
||||
return_value={
|
||||
"id": 999,
|
||||
"name": "Test Anime Updated",
|
||||
@@ -270,6 +271,7 @@ class TestCompleteNFOWorkflow:
|
||||
"vote_average": 9.0,
|
||||
}
|
||||
)
|
||||
mock_tmdb.get_tv_show_content_ratings = AsyncMock(return_value={"results": []})
|
||||
|
||||
with patch(
|
||||
"src.core.services.nfo_service.TMDBClient",
|
||||
@@ -282,10 +284,7 @@ class TestCompleteNFOWorkflow:
|
||||
|
||||
# Update NFO
|
||||
await nfo_service.update_tvshow_nfo(
|
||||
serie_folder="Test Anime",
|
||||
download_poster=False,
|
||||
download_logo=False,
|
||||
download_fanart=False,
|
||||
serie_folder="Test Anime"
|
||||
)
|
||||
|
||||
# Verify NFO updated
|
||||
@@ -314,12 +313,13 @@ class TestCompleteNFOWorkflow:
|
||||
{"results": [{"id": 2, "name": "Anime 2", "first_air_date": "2021-01-01"}]},
|
||||
]
|
||||
)
|
||||
mock_tmdb.get_tv_show = AsyncMock(
|
||||
mock_tmdb.get_tv_show_details = AsyncMock(
|
||||
side_effect=[
|
||||
{"id": 1, "name": "Anime 1", "first_air_date": "2020-01-01"},
|
||||
{"id": 2, "name": "Anime 2", "first_air_date": "2021-01-01"},
|
||||
]
|
||||
)
|
||||
mock_tmdb.get_tv_show_content_ratings = AsyncMock(return_value={"results": []})
|
||||
|
||||
with patch(
|
||||
"src.core.services.nfo_service.TMDBClient",
|
||||
@@ -373,13 +373,14 @@ class TestNFOWorkflowWithDownloads:
|
||||
"first_air_date": "2020-01-01",
|
||||
}]}
|
||||
)
|
||||
mock_tmdb.get_tv_show = AsyncMock(
|
||||
mock_tmdb.get_tv_show_details = AsyncMock(
|
||||
return_value={
|
||||
"id": 999,
|
||||
"name": "Test Anime",
|
||||
"first_air_date": "2020-01-01",
|
||||
}
|
||||
)
|
||||
mock_tmdb.get_tv_show_content_ratings = AsyncMock(return_value={"results": []})
|
||||
|
||||
with patch(
|
||||
"src.core.services.nfo_service.TMDBClient",
|
||||
|
||||
Reference in New Issue
Block a user