| 17 | |
| 18 | |
| 19 | class 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 | |
| 44 | class TestConversationContext(unittest.TestCase): |
nothing calls this directly
no outgoing calls
no test coverage detected