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:
@@ -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
|
||||
|
||||
@@ -116,8 +116,13 @@ Retry Failed Item
|
||||
${json}= Convert String To Json ${add_resp.text}
|
||||
${ids}= Get Value From Json ${json} $.item_ids
|
||||
${item_id}= Set Variable ${ids}[0]
|
||||
${retry_resp}= POST API /api/queue/item/${item_id}/retry
|
||||
# Retry endpoint accepts item_ids list, returns 200 even if no items actually failed
|
||||
# (retried_count will be 0 if item wasn't in failed state)
|
||||
${retry_payload}= Create Dictionary item_ids=${item_id}
|
||||
${retry_resp}= POST API /api/queue/retry ${retry_payload}
|
||||
Response Should Have Status ${retry_resp} 200
|
||||
${retry_json}= Convert String To Json ${retry_resp.text}
|
||||
Dictionary Should Contain Key ${retry_json} retried_count
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Queue Statistics Accuracy
|
||||
|
||||
Reference in New Issue
Block a user