()
| 264 | |
| 265 | #[test] |
| 266 | fn test_delegation() { |
| 267 | let user = Identity::generate("alice"); |
| 268 | let agent = Identity::builder("bot") |
| 269 | .identity_type(IdentityType::Agent) |
| 270 | .delegated_by(user.id) |
| 271 | .build() |
| 272 | .unwrap(); |
| 273 | |
| 274 | let scope = DelegationScope::builder() |
| 275 | .permission(DelegationPermission::Read) |
| 276 | .permission(DelegationPermission::Record) |
| 277 | .build(); |
| 278 | |
| 279 | let delegation = Delegation::new(&user, &agent, scope); |
| 280 | let anywhere = ResourceRef::new(); |
| 281 | |
| 282 | assert!(delegation.allows(DelegationPermission::Read, &anywhere)); |
| 283 | assert!(delegation.allows(DelegationPermission::Record, &anywhere)); |
| 284 | assert!(!delegation.allows(DelegationPermission::Push, &anywhere)); |
| 285 | } |
| 286 | } |
nothing calls this directly
no test coverage detected