mirror of
https://github.com/rommapp/romm.git
synced 2026-11-28 17:48:31 +01:00
A complete rescan clears the id of every source it consulted that came back empty. That reads an outage as a conclusive miss for the providers that report a failure as an empty match, so a rescan run while one was down wiped the id it would otherwise have confirmed, hand-set ones included. Each of those now reports the failure and leaves the tolerance to the caller, which is what the gather loop's discard already assumed: - Pouët, CSDb and Demozoo stop swallowing the 503 their own `_request` raises, and Pouët's title search raises it rather than answering "no unique title". - SteamGridDB and Flashpoint stop catching `Exception` around a whole lookup; HLTB stops catching it around its search. - ScreenScraper answers empty for every remaining ROM once its daily-quota or credentials breaker trips, so the scan reads that state off the service and drops it from the sources the rescan may clear. SteamGridDB resolves outside the gather and so needs the discard at its call site. Search keeps degrading to no thumbnail, since its cover art sits on top of matches the other providers already produced. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
"""Tests for the Flashpoint handler's lookup failure reporting."""
|
|
|
|
from unittest.mock import AsyncMock, patch
|
|
|
|
import pytest
|
|
from fastapi import HTTPException
|
|
|
|
from handler.metadata.flashpoint_handler import FlashpointHandler
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_search_games_propagates_an_unreachable_flashpoint():
|
|
"""A failed search has to stay distinguishable from a term with no hits."""
|
|
handler = FlashpointHandler()
|
|
|
|
with (
|
|
patch.object(FlashpointHandler, "is_enabled", return_value=True),
|
|
patch.object(
|
|
FlashpointHandler,
|
|
"_request",
|
|
new_callable=AsyncMock,
|
|
side_effect=HTTPException(status_code=503, detail="down"),
|
|
),
|
|
pytest.raises(HTTPException),
|
|
):
|
|
await handler.search_games("Interactive Buddy")
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_get_rom_by_id_propagates_an_unreachable_flashpoint():
|
|
handler = FlashpointHandler()
|
|
|
|
with (
|
|
patch("handler.metadata.flashpoint_handler.FLASHPOINT_API_ENABLED", True),
|
|
patch.object(
|
|
FlashpointHandler,
|
|
"_request",
|
|
new_callable=AsyncMock,
|
|
side_effect=HTTPException(status_code=503, detail="down"),
|
|
),
|
|
pytest.raises(HTTPException),
|
|
):
|
|
await handler.get_rom_by_id("dc1f7d99-9a3d-4f3f-8f2a-000000000000")
|