()
| 1213 | |
| 1214 | #[test] |
| 1215 | fn test_parse_agent_yaml_with_permissions() { |
| 1216 | let yaml = r#" |
| 1217 | name: restricted-agent |
| 1218 | description: Agent with permissions |
| 1219 | permissions: |
| 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() { |
nothing calls this directly
no test coverage detected