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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user