MCPcopy Create free account
hub / github.com/AI45Lab/Code / test_manager_remove_session_policy

Function test_manager_remove_session_policy

core/src/permissions/tests.rs:366–384  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

364
365#[test]
366fn test_manager_remove_session_policy() {
367 let mut manager = PermissionManager::new();
368
369 let session_policy = PermissionPolicy {
370 default_decision: PermissionDecision::Allow,
371 ..PermissionPolicy::default()
372 };
373 manager.set_session_policy("session-1", session_policy);
374
375 // Before removal
376 let decision = manager.check("session-1", "Bash", &json!({"command": "anything"}));
377 assert_eq!(decision, PermissionDecision::Allow);
378
379 manager.remove_session_policy("session-1");
380
381 // After removal - falls back to global
382 let decision = manager.check("session-1", "Bash", &json!({"command": "anything"}));
383 assert_eq!(decision, PermissionDecision::Ask);
384}
385
386#[test]
387fn test_manager_global_deny_overrides_session_allow() {

Callers

nothing calls this directly

Calls 3

set_session_policyMethod · 0.80
remove_session_policyMethod · 0.80
checkMethod · 0.45

Tested by

no test coverage detected