test(arch-boundary): migrate whitelist test to tmp_path; fix indentation

This commit is contained in:
ed
2026-06-02 21:34:56 -04:00
parent 1660114bc7
commit 7646fc14a2
+6 -3
View File
@@ -21,18 +21,21 @@ class TestArchBoundaryPhase1(unittest.TestCase):
def test_mcp_client_whitelist_enforcement(self) -> None: def test_mcp_client_whitelist_enforcement(self) -> None:
"""TEST 2: mcp_client._is_allowed must return False for config.toml""" """TEST 2: mcp_client._is_allowed must return False for config.toml"""
import tempfile
from src import mcp_client from src import mcp_client
from pathlib import Path from pathlib import Path
tmp = Path(tempfile.mkdtemp())
# Configure with some dummy file items (as dicts) # Configure with some dummy file items (as dicts)
file_items = [{"path": "src/gui_2.py"}] file_items = [{"path": "src/gui_2.py"}]
mcp_client.configure(file_items, []) mcp_client.configure(file_items, [])
# Should allow src files # Should allow src files
self.assertTrue(mcp_client._is_allowed(Path("src/gui_2.py"))) self.assertTrue(mcp_client._is_allowed(Path("src/gui_2.py")))
# Should REJECT config files # Should REJECT config files (using tmp_path versions; check is by basename)
self.assertFalse(mcp_client._is_allowed(Path("config.toml"))) self.assertFalse(mcp_client._is_allowed(tmp / "config.toml"))
self.assertFalse(mcp_client._is_allowed(Path("credentials.toml"))) self.assertFalse(mcp_client._is_allowed(tmp / "credentials.toml"))
def test_mma_exec_no_hardcoded_path(self) -> None: def test_mma_exec_no_hardcoded_path(self) -> None:
"""TEST 4: mma_exec.execute_agent must not contain hardcoded machine paths.""" """TEST 4: mma_exec.execute_agent must not contain hardcoded machine paths."""