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

Function test_apply_to_sets_permissions

core/src/subagent.rs:1713–1735  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1711
1712 #[test]
1713 fn test_apply_to_sets_permissions() {
1714 use crate::agent::AgentConfig;
1715 use crate::permissions::PermissionDecision;
1716
1717 let def = AgentDefinition::new("writer", "Write files")
1718 .with_permissions(PermissionPolicy::new().allow("write(*)"));
1719
1720 let mut config = AgentConfig::default();
1721 assert!(config.permission_checker.is_none());
1722
1723 def.apply_to(&mut config);
1724
1725 assert!(config.permission_checker.is_some());
1726 assert!(config.permission_policy.is_some());
1727 let checker = config.permission_checker.unwrap();
1728 assert_eq!(
1729 checker.check(
1730 "write",
1731 &serde_json::json!({"file_path": "x.txt", "content": "hi"})
1732 ),
1733 PermissionDecision::Allow
1734 );
1735 }
1736
1737 #[test]
1738 fn test_apply_to_sets_prompt() {

Callers

nothing calls this directly

Calls 3

with_permissionsMethod · 0.80
allowMethod · 0.80
apply_toMethod · 0.45

Tested by

no test coverage detected