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

Function test_policy_matching_rules

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

Source from the content-addressed store, hash-verified

250
251#[test]
252fn test_policy_matching_rules() {
253 let policy = PermissionPolicy::new()
254 .allow("Bash(cargo:*)")
255 .deny("Bash(cargo fmt:*)")
256 .ask("Bash(*)");
257
258 let matching = policy.get_matching_rules("Bash", &json!({"command": "cargo fmt"}));
259 assert_eq!(matching.deny.len(), 1);
260 assert_eq!(matching.allow.len(), 1);
261 assert_eq!(matching.ask.len(), 1);
262}
263
264#[test]
265fn test_policy_allow_all() {

Callers

nothing calls this directly

Calls 4

askMethod · 0.80
denyMethod · 0.80
allowMethod · 0.80
get_matching_rulesMethod · 0.80

Tested by

no test coverage detected