summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-06-24 14:36:58 -0600
committermo khan <mo@mokhan.ca>2025-06-24 14:36:58 -0600
commit85490a4cfa7f3836d3d2f1e7cbfe48b668aa484b (patch)
tree3fb62e5566ef838187b8568f9e71d0495f24d812 /tests
parenta0537b163037a92652ec92c1f47945e0572bb76e (diff)
feat: connect check service to a minimal cedar policy
Diffstat (limited to 'tests')
-rw-r--r--tests/integration_tests.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs
index a3603c11..9bbeaea5 100644
--- a/tests/integration_tests.rs
+++ b/tests/integration_tests.rs
@@ -1,11 +1,13 @@
-use authzd::CheckService;
+use authzd::{CedarAuthorizer, CheckService};
use envoy_types::ext_authz::v3::pb::Authorization;
+use std::sync::Arc;
mod common;
#[tokio::test]
async fn test_success_response() {
- let server = CheckService::default();
+ let authorizer = Arc::new(CedarAuthorizer::new());
+ let server = CheckService::new(authorizer);
let headers = common::create_headers_with_auth("Bearer valid-token");
let request = common::create_test_request_with_headers(headers);
@@ -17,12 +19,13 @@ async fn test_success_response() {
assert!(check_response.status.is_some());
let status = check_response.status.unwrap();
- assert_eq!(status.code, tonic::Code::Ok.into());
+ assert_eq!(status.code, tonic::Code::Ok as i32);
}
#[tokio::test]
async fn test_multiple() {
- let server = CheckService::default();
+ let authorizer = Arc::new(CedarAuthorizer::new());
+ let server = CheckService::new(authorizer);
let test_cases = vec![
("Bearer valid-token", true),
@@ -42,9 +45,9 @@ async fn test_multiple() {
let status = check_response.status.unwrap();
if should_succeed {
- assert_eq!(status.code, tonic::Code::Ok.into());
+ assert_eq!(status.code, tonic::Code::Ok as i32);
} else {
- assert_eq!(status.code, tonic::Code::Unauthenticated.into());
+ assert_eq!(status.code, tonic::Code::Unauthenticated as i32);
}
}
}