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

Function test_manager_session_policy

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

Source from the content-addressed store, hash-verified

348
349#[test]
350fn test_manager_session_policy() {
351 let mut manager = PermissionManager::new();
352
353 let session_policy = PermissionPolicy::new().allow("Bash(cargo:*)");
354 manager.set_session_policy("session-1", session_policy);
355
356 // Session 1 has custom policy
357 let decision = manager.check("session-1", "Bash", &json!({"command": "cargo build"}));
358 assert_eq!(decision, PermissionDecision::Allow);
359
360 // Session 2 uses global policy
361 let decision = manager.check("session-2", "Bash", &json!({"command": "cargo build"}));
362 assert_eq!(decision, PermissionDecision::Ask);
363}
364
365#[test]
366fn test_manager_remove_session_policy() {

Callers

nothing calls this directly

Calls 3

allowMethod · 0.80
set_session_policyMethod · 0.80
checkMethod · 0.45

Tested by

no test coverage detected