diff options
| author | mo khan <mo@mokhan.ca> | 2025-06-25 14:58:12 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-06-25 14:58:12 -0600 |
| commit | 25412b5ad670d5b8809d399aae4ab63bd5e1de40 (patch) | |
| tree | 023c5cb6042c87fc54a81e8366cc70dcdfaddbf1 /tests/authorization | |
| parent | ab2a06d2a1e63cdedfd06717114f128e1e9dc1a8 (diff) | |
test: improve readability of some of the test code
Diffstat (limited to 'tests/authorization')
| -rw-r--r-- | tests/authorization/cedar_authorizer_test.rs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/tests/authorization/cedar_authorizer_test.rs b/tests/authorization/cedar_authorizer_test.rs index 4531da67..1012d917 100644 --- a/tests/authorization/cedar_authorizer_test.rs +++ b/tests/authorization/cedar_authorizer_test.rs @@ -1,6 +1,6 @@ #[cfg(test)] mod tests { - use crate::common::create_request; + use crate::common::*; use authzd::Authorizer; use authzd::CedarAuthorizer; use envoy_types::pb::envoy::service::auth::v3::attribute_context::HttpRequest; @@ -10,16 +10,15 @@ mod tests { fn test_cedar_authorizer_allows_valid_token() { let authorizer = CedarAuthorizer::new(); let request = create_request(|item: &mut HttpRequest| { - let mut headers = HashMap::new(); - headers.insert( - "authorization".to_string(), - "Bearer valid-token".to_string(), - ); - item.headers = headers; + item.headers = build_with(|item: &mut HashMap<String, String>| { + item.insert( + String::from("authorization"), + String::from("Bearer valid-token"), + ); + }); }); - let result = authorizer.authorize(request); - assert!(result); + assert!(authorizer.authorize(request)); } #[test] |
