From 7646fc14a2794752afc728163fdec88a0cdc603e Mon Sep 17 00:00:00 2001 From: Ed_ Date: Tue, 2 Jun 2026 21:34:56 -0400 Subject: [PATCH] test(arch-boundary): migrate whitelist test to tmp_path; fix indentation --- tests/test_arch_boundary_phase1.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/tests/test_arch_boundary_phase1.py b/tests/test_arch_boundary_phase1.py index 6e7b16ce..b7eaeb4b 100644 --- a/tests/test_arch_boundary_phase1.py +++ b/tests/test_arch_boundary_phase1.py @@ -20,19 +20,22 @@ class TestArchBoundaryPhase1(unittest.TestCase): self.assertNotIn("UNFETTERED_MODULES", content) def test_mcp_client_whitelist_enforcement(self) -> None: - """TEST 2: mcp_client._is_allowed must return False for config.toml""" - from src import mcp_client - from pathlib import Path - - # Configure with some dummy file items (as dicts) - file_items = [{"path": "src/gui_2.py"}] - mcp_client.configure(file_items, []) - - # Should allow src files - self.assertTrue(mcp_client._is_allowed(Path("src/gui_2.py"))) - # Should REJECT config files - self.assertFalse(mcp_client._is_allowed(Path("config.toml"))) - self.assertFalse(mcp_client._is_allowed(Path("credentials.toml"))) + """TEST 2: mcp_client._is_allowed must return False for config.toml""" + import tempfile + from src import mcp_client + from pathlib import Path + + tmp = Path(tempfile.mkdtemp()) + + # Configure with some dummy file items (as dicts) + file_items = [{"path": "src/gui_2.py"}] + mcp_client.configure(file_items, []) + + # Should allow src files + self.assertTrue(mcp_client._is_allowed(Path("src/gui_2.py"))) + # Should REJECT config files (using tmp_path versions; check is by basename) + self.assertFalse(mcp_client._is_allowed(tmp / "config.toml")) + self.assertFalse(mcp_client._is_allowed(tmp / "credentials.toml")) def test_mma_exec_no_hardcoded_path(self) -> None: """TEST 4: mma_exec.execute_agent must not contain hardcoded machine paths."""