diff options
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] |
