From 25412b5ad670d5b8809d399aae4ab63bd5e1de40 Mon Sep 17 00:00:00 2001 From: mo khan Date: Wed, 25 Jun 2025 14:58:12 -0600 Subject: test: improve readability of some of the test code --- tests/authorization/cedar_authorizer_test.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'tests') 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| { + item.insert( + String::from("authorization"), + String::from("Bearer valid-token"), + ); + }); }); - let result = authorizer.authorize(request); - assert!(result); + assert!(authorizer.authorize(request)); } #[test] -- cgit v1.2.3