drop unused tests

This commit is contained in:
Georges-Antoine Assi
2026-05-21 17:14:32 -04:00
parent f40aa806ad
commit 600adb2c33

View File

@@ -3,9 +3,12 @@ from unittest.mock import AsyncMock, patch
import pytest
from handler.database import db_platform_handler, db_rom_handler
from handler.metadata import meta_hasheous_handler, meta_launchbox_handler, meta_playmatch_handler, meta_ra_handler
from handler.metadata import (
meta_hasheous_handler,
meta_playmatch_handler,
meta_ra_handler,
)
from handler.metadata.hasheous_handler import HasheousRom
from handler.metadata.launchbox_handler.types import LaunchboxRom
from handler.metadata.ra_handler import RAGameRom
from handler.scan_handler import MetadataSource, ScanType, scan_platform, scan_rom
from models.platform import Platform
@@ -307,88 +310,3 @@ async def test_scan_rom_unmatched_skips_ra_when_id_and_metadata_exist(
mock_get_rom.assert_not_called()
# Existing ra_id should be preserved
assert result.ra_id == 2774
@patch.object(meta_playmatch_handler, "is_enabled", return_value=False)
@patch.object(meta_hasheous_handler, "get_ra_game", new_callable=AsyncMock)
@patch.object(meta_hasheous_handler, "get_igdb_game", new_callable=AsyncMock)
@patch.object(meta_hasheous_handler, "lookup_rom", new_callable=AsyncMock)
async def test_scan_rom_unmatched_hasheous_uses_existing_ids_on_hash_fail(
mock_lookup, mock_get_igdb, mock_get_ra, mock_playmatch_enabled
):
"""UNMATCHED scan: when Hasheous hash lookup fails but hasheous_id is set
manually, the existing sub-IDs (igdb_id, ra_id) are passed to the metadata
proxy calls so enrichment can still happen."""
# Hash lookup returns no match
mock_lookup.return_value = HasheousRom(
hasheous_id=None, igdb_id=None, tgdb_id=None, ra_id=None
)
# get_igdb_game returns an enriched rom with name/cover
enriched = HasheousRom(
hasheous_id=262940,
igdb_id=4614,
tgdb_id=None,
ra_id=2774,
name="Jak and Daxter: The Precursor's Legacy",
url_cover="https://example.com/cover.jpg",
)
mock_get_igdb.return_value = enriched
mock_get_ra.return_value = enriched
platform = Platform(
id=1,
slug="ps2",
fs_slug="ps2",
name="PlayStation 2",
igdb_id=8,
hasheous_id=87,
ra_id=21,
)
platform = db_platform_handler.add_platform(platform)
# ROM has hasheous_id set manually, with sub-IDs also set, but no metadata
rom = Rom(
platform_id=platform.id,
fs_name="Jak and Daxter.chd",
fs_name_no_tags="Jak and Daxter",
fs_name_no_ext="Jak and Daxter",
fs_extension="chd",
fs_path="ps2",
name="Jak and Daxter",
hasheous_id=262940,
hasheous_metadata={}, # empty
igdb_id=4614,
ra_id=2774,
fs_size_bytes=1024,
tags=[],
)
rom = db_rom_handler.add_rom(rom)
async with initialize_context():
result = await scan_rom(
platform=platform,
scan_type=ScanType.UNMATCHED,
rom=rom,
fs_rom={
"fs_name": "Jak and Daxter.chd",
"flat": True,
"nested": False,
"files": [],
"crc_hash": "",
"md5_hash": "",
"sha1_hash": "",
"ra_hash": "",
},
metadata_sources=[MetadataSource.HASHEOUS],
newly_added=False,
)
# Hash lookup was attempted
mock_lookup.assert_called_once()
# get_igdb_game was called with the partial HasheousRom built from existing IDs
mock_get_igdb.assert_called_once()
called_arg = mock_get_igdb.call_args[0][0]
assert called_arg.get("hasheous_id") == 262940
assert called_arg.get("igdb_id") == 4614
# hasheous_id should be set in the result
assert result.hasheous_id == 262940