Migrate download queue from JSON to SQLite database

- Created QueueRepository adapter in src/server/services/queue_repository.py
- Refactored DownloadService to use repository pattern instead of JSON
- Updated application startup to initialize download service from database
- Updated all test fixtures to use MockQueueRepository
- All 1104 tests passing
This commit is contained in:
2025-12-02 16:01:25 +01:00
parent 48daeba012
commit b0f3b643c7
18 changed files with 1393 additions and 330 deletions

View File

@@ -69,16 +69,17 @@ async def anime_service(mock_series_app, progress_service):
@pytest.fixture
async def download_service(anime_service, progress_service, tmp_path):
"""Create a DownloadService with dependencies.
"""Create a DownloadService with mock repository for testing.
Uses tmp_path to ensure each test has isolated queue storage.
Uses mock repository to ensure each test has isolated queue storage.
"""
import uuid
persistence_path = tmp_path / f"test_queue_{uuid.uuid4()}.json"
from tests.unit.test_download_service import MockQueueRepository
mock_repo = MockQueueRepository()
service = DownloadService(
anime_service=anime_service,
progress_service=progress_service,
persistence_path=str(persistence_path),
queue_repository=mock_repo,
)
yield service, progress_service
await service.stop()