diff options
| author | mo khan <mo@mokhan.ca> | 2025-07-04 16:39:37 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-07-04 16:39:37 -0600 |
| commit | 784e0740a6ca7684feba3fb4f26d68e098b5c826 (patch) | |
| tree | 9cd61a8792e10a2b3a829cb74dd34e1bb4519545 /tests/authorization/cedar_authorizer_test.rs | |
| parent | 2185b6d8a80d78e3b1b1421f99cab884705d3cbf (diff) | |
refactor: map from http request to cedar request
Diffstat (limited to 'tests/authorization/cedar_authorizer_test.rs')
| -rw-r--r-- | tests/authorization/cedar_authorizer_test.rs | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/tests/authorization/cedar_authorizer_test.rs b/tests/authorization/cedar_authorizer_test.rs index 79f83c00..317ef67f 100644 --- a/tests/authorization/cedar_authorizer_test.rs +++ b/tests/authorization/cedar_authorizer_test.rs @@ -8,12 +8,10 @@ mod tests { #[test] fn test_cedar_authorizer_allows_valid_token() { let request = build_request(|item: &mut HttpRequest| { - item.headers = build_with(|item: &mut HashMap<String, String>| { - item.insert( - String::from("authorization"), - String::from("Bearer valid-token"), - ); - }); + item.headers = build_headers(vec![( + "authorization".to_string(), + "Bearer valid-token".to_string(), + )]); }); assert!(build_cedar_authorizer().authorize(request)); @@ -22,12 +20,10 @@ mod tests { #[test] fn test_cedar_authorizer_denies_invalid_token() { let request = build_request(|item: &mut HttpRequest| { - item.headers = build_with(|item: &mut HashMap<String, String>| { - item.insert( - String::from("authorization"), - String::from("Bearer invalid-token"), - ); - }); + item.headers = build_headers(vec![( + "authorization".to_string(), + "Bearer invalid-token".to_string(), + )]); }); assert!(!build_cedar_authorizer().authorize(request)); |
