()
| 254 | |
| 255 | #[test] |
| 256 | fn test_delegation() { |
| 257 | let user = Identity::generate("alice"); |
| 258 | let agent = Identity::builder("bot") |
| 259 | .identity_type(IdentityType::Agent) |
| 260 | .delegated_by(user.id) |
| 261 | .build() |
| 262 | .unwrap(); |
| 263 | |
| 264 | let scope = DelegationScope::builder() |
| 265 | .permission(DelegationPermission::Read) |
| 266 | .permission(DelegationPermission::Record) |
| 267 | .build(); |
| 268 | |
| 269 | let delegation = Delegation::new(&user, &agent, scope).unwrap(); |
| 270 | |
| 271 | assert!(delegation.allows(DelegationPermission::Read, None, None)); |
| 272 | assert!(delegation.allows(DelegationPermission::Record, None, None)); |
| 273 | assert!(!delegation.allows(DelegationPermission::Push, None, None)); |
| 274 | } |
| 275 | } |
nothing calls this directly
no test coverage detected