Files
couchos/tests/test_discovery.py
jackmhny 04ef2a0d74
Some checks failed
ci / verify (push) Has been cancelled
feat: build CouchOS Melee appliance
2026-08-03 02:52:28 +02:00

24 lines
909 B
Python

from pathlib import Path
import unittest
from couchd.discovery import AllowlistError, allowlisted_target
class AllowlistTests(unittest.TestCase):
def test_rejects_target_outside_allowed_roots(self) -> None:
with self.assertRaises(AllowlistError):
allowlisted_target(
candidate=Path("/tmp/SlippiLauncher.AppImage"),
allowed_roots=[Path("/home/couch/Applications")],
allowed_names={"SlippiLauncher.AppImage"},
)
def test_accepts_allowed_target_name_under_allowed_root(self) -> None:
target = allowlisted_target(
candidate=Path("/home/couch/Applications/SlippiLauncher.AppImage"),
allowed_roots=[Path("/home/couch/Applications")],
allowed_names={"SlippiLauncher.AppImage"},
)
self.assertEqual(target, Path("/home/couch/Applications/SlippiLauncher.AppImage"))