download re implemented

This commit is contained in:
2025-10-30 22:06:41 +01:00
parent 6ebc2ed2ea
commit 3be175522f
16 changed files with 359 additions and 1335 deletions

View File

@@ -60,7 +60,6 @@ async def download_service(anime_service, progress_service):
"""Create a DownloadService with dependencies."""
service = DownloadService(
anime_service=anime_service,
max_concurrent_downloads=2,
progress_service=progress_service,
persistence_path="/tmp/test_queue.json",
)
@@ -173,40 +172,6 @@ class TestWebSocketDownloadIntegration:
assert stop_broadcast is not None
assert stop_broadcast["data"]["is_running"] is False
@pytest.mark.asyncio
async def test_queue_pause_resume_broadcast(
self, download_service
):
"""Test that pause/resume operations broadcast updates."""
broadcasts: List[Dict[str, Any]] = []
async def mock_broadcast(update_type: str, data: dict):
broadcasts.append({"type": update_type, "data": data})
download_service.set_broadcast_callback(mock_broadcast)
# Pause queue
await download_service.pause_queue()
# Resume queue
await download_service.resume_queue()
# Find pause/resume broadcasts
pause_broadcast = next(
(b for b in broadcasts if b["type"] == "queue_paused"),
None,
)
resume_broadcast = next(
(b for b in broadcasts if b["type"] == "queue_resumed"),
None,
)
assert pause_broadcast is not None
assert pause_broadcast["data"]["is_paused"] is True
assert resume_broadcast is not None
assert resume_broadcast["data"]["is_paused"] is False
@pytest.mark.asyncio
async def test_clear_completed_broadcast(
self, download_service