From 9078a6f3dc9f2eea40ba62e15d2b30f9051145f1 Mon Sep 17 00:00:00 2001 From: Lukas Date: Thu, 15 Jan 2026 19:43:58 +0100 Subject: [PATCH] fix: Update test fixtures to use correct service method names - Fixed test_download_progress_websocket: stop() -> stop_downloads() - Fixed test_download_service: start() -> initialize(), stop() -> stop_downloads() - Resolved 8 test errors and 3 test failures - Test status: 970 passing, 31 failing (down from 967 passing, 34 failing, 8 errors) - All 104 NFO-related tests still passing (100%) --- tests/unit/test_download_progress_websocket.py | 2 +- tests/unit/test_download_service.py | 14 +++++++------- tests/unit/test_image_downloader.py | 7 ++----- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/tests/unit/test_download_progress_websocket.py b/tests/unit/test_download_progress_websocket.py index a53f3c2..988dace 100644 --- a/tests/unit/test_download_progress_websocket.py +++ b/tests/unit/test_download_progress_websocket.py @@ -115,7 +115,7 @@ async def download_service(anime_service, progress_service): yield service, progress_service - await service.stop() + await service.stop_downloads() class TestDownloadProgressWebSocket: diff --git a/tests/unit/test_download_service.py b/tests/unit/test_download_service.py index 271a93b..b32ea4c 100644 --- a/tests/unit/test_download_service.py +++ b/tests/unit/test_download_service.py @@ -582,23 +582,23 @@ class TestServiceLifecycle: @pytest.mark.asyncio async def test_start_service(self, download_service): """Test starting the service.""" - # start() is now just for initialization/compatibility - await download_service.start() - # No _is_running attribute - simplified service doesn't track this + # initialize() is the proper method for service initialization + await download_service.initialize() + # Service initialized successfully @pytest.mark.asyncio async def test_stop_service(self, download_service): """Test stopping the service.""" - await download_service.start() - await download_service.stop() + await download_service.initialize() + await download_service.stop_downloads() # Verifies service can be stopped without errors # No _is_running attribute in simplified service @pytest.mark.asyncio async def test_start_already_running(self, download_service): """Test starting service when already running.""" - await download_service.start() - await download_service.start() # Should not raise error + await download_service.initialize() + await download_service.initialize() # Should not raise error # No _is_running attribute in simplified service diff --git a/tests/unit/test_image_downloader.py b/tests/unit/test_image_downloader.py index 462c92d..fe4f623 100644 --- a/tests/unit/test_image_downloader.py +++ b/tests/unit/test_image_downloader.py @@ -1,17 +1,14 @@ """Unit tests for image downloader.""" -import aiohttp import io from pathlib import Path from unittest.mock import AsyncMock, MagicMock, patch +import aiohttp import pytest from PIL import Image -from src.core.utils.image_downloader import ( - ImageDownloader, - ImageDownloadError, -) +from src.core.utils.image_downloader import ImageDownloader, ImageDownloadError @pytest.fixture