MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_delegation

Function test_delegation

atomic-identity/src/lib.rs:266–285  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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}

Callers

nothing calls this directly

Calls 5

delegated_byMethod · 0.80
permissionMethod · 0.80
unwrapMethod · 0.45
buildMethod · 0.45
identity_typeMethod · 0.45

Tested by

no test coverage detected