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

Function test_parse_agent_yaml_with_permissions

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

Source from the content-addressed store, hash-verified

1213
1214 #[test]
1215 fn test_parse_agent_yaml_with_permissions() {
1216 let yaml = r#"
1217name: restricted-agent
1218description: Agent with permissions
1219permissions:
1220 allow:
1221 - rule: read
1222 - rule: grep
1223 deny:
1224 - rule: write
1225"#;
1226 let agent = parse_agent_yaml(yaml).unwrap();
1227 assert_eq!(agent.name, "restricted-agent");
1228 assert_eq!(agent.permissions.allow.len(), 2);
1229 assert_eq!(agent.permissions.deny.len(), 1);
1230 // Verify that deserialized rules actually match (tool_name populated)
1231 assert!(agent.permissions.allow[0].matches("read", &serde_json::json!({})));
1232 assert!(agent.permissions.allow[1].matches("grep", &serde_json::json!({})));
1233 assert!(agent.permissions.deny[0].matches("write", &serde_json::json!({})));
1234 }
1235
1236 #[test]
1237 fn test_parse_agent_yaml_with_plain_string_permissions() {

Callers

nothing calls this directly

Calls 1

parse_agent_yamlFunction · 0.85

Tested by

no test coverage detected