()
| 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() { |
nothing calls this directly
no test coverage detected