diff options
Diffstat (limited to 'tests/authorization')
| -rw-r--r-- | tests/authorization/cedar_authorizer_test.rs | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/tests/authorization/cedar_authorizer_test.rs b/tests/authorization/cedar_authorizer_test.rs index 88357058..8add9868 100644 --- a/tests/authorization/cedar_authorizer_test.rs +++ b/tests/authorization/cedar_authorizer_test.rs @@ -5,7 +5,6 @@ mod tests { use authzd::Authorizer; use envoy_types::pb::envoy::service::auth::v3::attribute_context::HttpRequest; use std::collections::HashMap; - use std::str::FromStr; fn subject() -> authzd::CedarAuthorizer { common::setup(); @@ -73,7 +72,7 @@ mod tests { // * delete sparkles: `:delete, gid://sparkle/Sparkle/*` // * delete single sparkle: `:delete, gid://sparkle/Sparkle/:id` #[test] - fn test_authenticated_sparkle_endpoints() { + fn test_authenticated_create_sparkle() { let request = build_request(|item: &mut HttpRequest| { item.method = "GET".to_string(); item.path = "/sparkles".to_string(); @@ -86,16 +85,8 @@ mod tests { ]); }); - let user = cedar_policy::Entity::new( - cedar_policy::EntityUid::from_type_name_and_id( - cedar_policy::EntityTypeName::from_str("User").unwrap(), - cedar_policy::EntityId::from_str("1675940").unwrap(), - ), - std::collections::HashMap::new(), - std::collections::HashSet::new(), - ); - - let entities = cedar_policy::Entities::from_entities([user.unwrap()], None).unwrap(); + let user = build_user("1675940"); + let entities = cedar_policy::Entities::from_entities([user], None).unwrap(); let authorizer = subject_with(entities); assert!(authorizer.authorize(request)); } |
