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

Function test_delegation_allows

atomic-identity/src/delegation.rs:702–721  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

700
701 #[test]
702 fn test_delegation_allows() {
703 let (user, agent) = create_test_identities();
704 let scope = DelegationScope::builder()
705 .permission(DelegationPermission::Read)
706 .permission(DelegationPermission::Record)
707 .repository_pattern("alice/*")
708 .build();
709
710 let delegation = Delegation::new(&user, &agent, scope).unwrap();
711
712 // Allowed operations
713 assert!(delegation.allows(DelegationPermission::Read, Some("alice/project"), None));
714 assert!(delegation.allows(DelegationPermission::Record, Some("alice/project"), None));
715
716 // Not allowed (wrong permission)
717 assert!(!delegation.allows(DelegationPermission::Push, Some("alice/project"), None));
718
719 // Not allowed (wrong repository)
720 assert!(!delegation.allows(DelegationPermission::Read, Some("bob/project"), None));
721 }
722
723 #[test]
724 fn test_delegation_id_deterministic() {

Callers

nothing calls this directly

Calls 5

create_test_identitiesFunction · 0.85
repository_patternMethod · 0.80
permissionMethod · 0.80
buildMethod · 0.45
unwrapMethod · 0.45

Tested by

no test coverage detected