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

@@ -224,35 +224,6 @@ class TestQueueControlOperations:
data = response.json()
assert data["status"] == "success"
async def test_pause_queue_processing(self, authenticated_client):
"""Test pausing the queue processor."""
# Start first
await authenticated_client.post("/api/queue/start")
# Then pause
response = await authenticated_client.post("/api/queue/pause")
assert response.status_code in [200, 503]
if response.status_code == 200:
data = response.json()
assert data["status"] == "success"
async def test_resume_queue_processing(self, authenticated_client):
"""Test resuming the queue processor."""
# Start and pause first
await authenticated_client.post("/api/queue/start")
await authenticated_client.post("/api/queue/pause")
# Then resume
response = await authenticated_client.post("/api/queue/resume")
assert response.status_code in [200, 503]
if response.status_code == 200:
data = response.json()
assert data["status"] == "success"
async def test_clear_completed_downloads(self, authenticated_client):
"""Test clearing completed downloads from the queue."""
response = await authenticated_client.delete("/api/queue/completed")
@@ -294,36 +265,9 @@ class TestQueueItemOperations:
# For now, test the endpoint with a dummy ID
response = await authenticated_client.post("/api/queue/items/dummy-id/retry")
# Should return 404 if item doesn't exist, or 503 if service unavailable
# Should return 404 if item doesn't exist, or 503 if unavailable
assert response.status_code in [200, 404, 503]
async def test_reorder_queue_items(self, authenticated_client):
"""Test reordering queue items."""
# Add multiple items
item_ids = []
for i in range(3):
add_response = await authenticated_client.post(
"/api/queue/add",
json={
"serie_id": f"series-{i}",
"serie_name": f"Series {i}",
"episodes": [{"season": 1, "episode": 1}],
"priority": "normal"
}
)
if add_response.status_code == 201:
item_ids.extend(add_response.json()["item_ids"])
if len(item_ids) >= 2:
# Reorder items
response = await authenticated_client.post(
"/api/queue/reorder",
json={"item_order": list(reversed(item_ids))}
)
assert response.status_code in [200, 503]
class TestDownloadProgressTracking:
"""Test progress tracking during downloads."""
@@ -598,33 +542,7 @@ class TestCompleteDownloadWorkflow:
assert progress_response.status_code in [200, 503]
# 5. Verify final state (completed or still processing)
final_response = await authenticated_client.get("/api/queue/status")
final_response = await authenticated_client.get(
"/api/queue/status"
)
assert final_response.status_code in [200, 503]
async def test_workflow_with_pause_and_resume(self, authenticated_client):
"""Test download workflow with pause and resume."""
# Add items
await authenticated_client.post(
"/api/queue/add",
json={
"serie_id": "pause-test",
"serie_name": "Pause Test Series",
"episodes": [{"season": 1, "episode": 1}],
"priority": "normal"
}
)
# Start processing
await authenticated_client.post("/api/queue/control/start")
# Pause
pause_response = await authenticated_client.post("/api/queue/control/pause")
assert pause_response.status_code in [200, 503]
# Resume
resume_response = await authenticated_client.post("/api/queue/control/resume")
assert resume_response.status_code in [200, 503]
# Verify queue status
status_response = await authenticated_client.get("/api/queue/status")
assert status_response.status_code in [200, 503]