MCPcopy Create free account
hub / github.com/bcefghj/miniClaudeCode / TestPermissionGate

Class TestPermissionGate

tests/test_agent_loop.py:19–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17
18
19class TestPermissionGate(unittest.TestCase):
20 def test_auto_mode_allows_all(self):
21 config = Config(permission_mode=PermissionMode.AUTO)
22 gate = PermissionGate(config)
23 tool = BashTool()
24 result = gate.check(tool, {"command": "echo hello"})
25 self.assertIsNone(result)
26
27 def test_plan_mode_blocks_writes(self):
28 config = Config(permission_mode=PermissionMode.PLAN)
29 gate = PermissionGate(config)
30 tool = BashTool()
31 result = gate.check(tool, {"command": "echo hello"})
32 self.assertIsNotNone(result)
33 self.assertTrue(result.is_error)
34
35 def test_tool_level_denial_takes_priority(self):
36 config = Config(permission_mode=PermissionMode.AUTO)
37 gate = PermissionGate(config)
38 tool = BashTool()
39 result = gate.check(tool, {"command": "rm -rf /"})
40 self.assertIsNotNone(result)
41 self.assertTrue(result.is_error)
42
43
44class TestConversationContext(unittest.TestCase):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected