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

Function test_delegation

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

Source from the content-addressed store, hash-verified

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}

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