mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-25 19:08:51 -06:00
refactor: share the placement rule of validate_pr
placement() decides the folder and name of a file not under bios/ yet, so the wanted page and the gaps page send an upload where the review asks for it. A declared file whose name the collection holds now gets the .variants/ slot beside it.
This commit is contained in:
1 parent
9d8dcb1634
commit
b18e478db0
2 files changed
+133
-40
No files matched your search
@@ -186,6 +186,33 @@ class AFileOnlyACoreReadsIsKnown(_Fixture):
|
||||
self.assertTrue(any("Placed under bios/Other/Place/" in m for _s, m in placed.checks))
|
||||
|
||||
|
||||
class ADeclaredFileBesideItsHeldNameIsAVariant(_Fixture):
|
||||
"""A file a profile declares, of a system the collection files nowhere
|
||||
yet, whose name the collection holds: the review named the folder and
|
||||
left the copy to land on the held file of that name."""
|
||||
|
||||
def test_place_copies_it_beside_the_held_name(self):
|
||||
import hashlib # noqa: PLC0415
|
||||
|
||||
data = b"declared revision"
|
||||
emulators = self.tmp / "emulators"
|
||||
emulators.mkdir()
|
||||
(emulators / "engine.yml").write_text(
|
||||
"emulator: Engine\ntype: standalone\nsystems: [x, y]\nfiles:\n"
|
||||
f" - name: \"v.bin\"\n sha1: \"{hashlib.sha1(data).hexdigest()}\"\n"
|
||||
)
|
||||
db = {"files": {"a" * 40: {"path": "bios/Maker/Console/v.bin"}},
|
||||
"indexes": {"by_md5": {}, "by_sha256": {}, "by_name": {"v.bin": ["a" * 40]}}}
|
||||
known = validate_pr.load_profile_hashes(str(emulators), db)
|
||||
result = validate_pr.validate_file(
|
||||
self._bios_file("card/v.bin", data), db, EMPTY_HASHES, known)
|
||||
slot = f"bios/Maker/Console/.variants/v.bin.{result.sha1[:8]}"
|
||||
self.assertEqual(result.destination, slot)
|
||||
self.assertIn(("WARN", "File is not under bios/ yet. The collection keeps this name in "
|
||||
f"`bios/Maker/Console/`. --place copies it to `{slot}`"),
|
||||
result.checks)
|
||||
|
||||
|
||||
class ASizeEveryDeclarationRulesOutIsNotAVariant(_Fixture):
|
||||
"""1024 random bytes named scph5501.bin, a name every declaration sizes
|
||||
at 524288, were told "File size OK" and offered a .variants slot at the
|
||||
|
||||
Reference in new issue
Block a user