diff options
| author | mo khan <mo@mokhan.ca> | 2025-06-27 12:45:13 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-06-27 12:45:13 -0600 |
| commit | f59c24589af439e0e22f43a2e42595cf88973ccf (patch) | |
| tree | 463c52337d726056571d9dd6c085d6bc84075e22 /tests/authorization/cedar_authorizer_test.rs | |
| parent | afd9729146a7e90bd97bf36f9d2081e29de9da35 (diff) | |
test: extract factory_bot factory for cedar authorizer
Diffstat (limited to 'tests/authorization/cedar_authorizer_test.rs')
| -rw-r--r-- | tests/authorization/cedar_authorizer_test.rs | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/tests/authorization/cedar_authorizer_test.rs b/tests/authorization/cedar_authorizer_test.rs index 3073417d..656e0060 100644 --- a/tests/authorization/cedar_authorizer_test.rs +++ b/tests/authorization/cedar_authorizer_test.rs @@ -2,16 +2,9 @@ mod tests { use crate::common::factory_bot::*; use authzd::Authorizer; - use authzd::CedarAuthorizer; use envoy_types::pb::envoy::service::auth::v3::attribute_context::HttpRequest; use std::collections::HashMap; - fn authorizer() -> CedarAuthorizer { - CedarAuthorizer::new_from( - "/home/mokhax/src/gitlab.com/gitlab-org/software-supply-chain-security/authorization/authzd/etc/authzd", - ) - } - #[test] fn test_cedar_authorizer_allows_valid_token() { let request = create_request(|item: &mut HttpRequest| { @@ -23,7 +16,7 @@ mod tests { }); }); - assert!(authorizer().authorize(request)); + assert!(build_cedar_authorizer().authorize(request)); } #[test] @@ -37,7 +30,7 @@ mod tests { }); }); - assert!(!authorizer().authorize(request)); + assert!(!build_cedar_authorizer().authorize(request)); } #[test] @@ -46,7 +39,7 @@ mod tests { item.headers = HashMap::new(); }); - assert!(!authorizer().authorize(request)); + assert!(!build_cedar_authorizer().authorize(request)); } #[test] @@ -57,7 +50,7 @@ mod tests { }); }); - assert!(authorizer().authorize(request)); + assert!(build_cedar_authorizer().authorize(request)); } #[test] @@ -68,6 +61,6 @@ mod tests { item.headers = headers; }); - assert!(authorizer().authorize(request)); + assert!(build_cedar_authorizer().authorize(request)); } } |
