simplify queue ops, handle broken pipe errors

- Add OSError errno 32 (broken pipe) handling in progress broadcast
- Remove progress service calls from add/clear queue operations
- Add pending_by_episode cleanup on clear
- Update tests accordingly
This commit is contained in:
2026-06-26 19:50:13 +02:00
parent 5028d4ea27
commit d00e80e240
5 changed files with 44 additions and 51 deletions

View File

@@ -246,7 +246,10 @@ async def test_remove_from_queue_single(
"""Test DELETE /api/queue/{item_id} endpoint."""
response = await authenticated_client.delete("/api/queue/item-id-1")
assert response.status_code == 204
assert response.status_code == 200
data = response.json()
assert data["status"] == "success"
assert data["removed_id"] == "item-id-1"
mock_download_service.remove_from_queue.assert_called_once_with(
["item-id-1"]
@@ -287,15 +290,15 @@ async def test_start_download_success(
async def test_start_download_empty_queue(
authenticated_client, mock_download_service
):
"""Test starting download with empty queue returns 400."""
"""Test starting download with empty queue returns 200 with info message."""
mock_download_service.start_queue_processing.return_value = None
response = await authenticated_client.post("/api/queue/start")
assert response.status_code == 400
assert response.status_code == 200
data = response.json()
message = data["message"].lower()
assert "empty" in message or "no pending" in message
assert "no pending" in message or "empty" in message
@pytest.mark.asyncio