From 85490a4cfa7f3836d3d2f1e7cbfe48b668aa484b Mon Sep 17 00:00:00 2001 From: mo khan Date: Tue, 24 Jun 2025 14:36:58 -0600 Subject: feat: connect check service to a minimal cedar policy --- tests/integration_tests.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'tests/integration_tests.rs') 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); } } } -- cgit v1.2.3