fix: refuse a data key the platform does not use

Under --key the platform restriction was not applied, so dolphin-sys
was downloaded again for RomM, which never reads it. A key whose
platforms exclude the one named is now refused.
This commit is contained in:
Abdessamad Derraz committed 2026-10-18 05:20:25 +02:00
1 parent 32d32e5718
commit 999a77a96a
2 files changed
+26

No files matched your search

+17
View File
@@ -138,5 +138,22 @@ class TheVersionIsReadBeforeTheDownload(unittest.TestCase):
self.assertEqual(json.loads(versions.read_text())["sys"]["sha"], "build-1")
class AKeyMustServeThePlatform(unittest.TestCase):
"""--platform narrowed only a full refresh: under --key it was ignored and
dolphin-sys was refreshed for RomM, which never reads it."""
def test_a_key_outside_the_platform_is_refused(self):
import subprocess # noqa: PLC0415
root = Path(__file__).resolve().parents[1]
refused = subprocess.run(
[sys.executable, "scripts/refresh_data_dirs.py", "--key", "dolphin-sys",
"--platform", "romm", "--dry-run"],
cwd=root, capture_output=True, text=True, timeout=120, check=False,
)
self.assertEqual(refused.returncode, 2)
self.assertIn("does not serve romm", refused.stdout + refused.stderr)
if __name__ == "__main__":
unittest.main()