summaryrefslogtreecommitdiff
path: root/tests/authorization
diff options
context:
space:
mode:
Diffstat (limited to 'tests/authorization')
-rw-r--r--tests/authorization/cedar_authorizer_test.rs18
-rw-r--r--tests/authorization/server_test.rs18
2 files changed, 26 insertions, 10 deletions
diff --git a/tests/authorization/cedar_authorizer_test.rs b/tests/authorization/cedar_authorizer_test.rs
index 7a99a7d9..58563832 100644
--- a/tests/authorization/cedar_authorizer_test.rs
+++ b/tests/authorization/cedar_authorizer_test.rs
@@ -128,4 +128,22 @@ mod tests {
let authorizer = subject();
assert_eq!(authorizer.authorize(request), true);
}
+
+ #[test]
+ fn test_sparkle_dashboard() {
+ let request = build_request(|item: &mut HttpRequest| {
+ item.method = "GET".to_string();
+ item.path = "/dashboard".to_string();
+ item.host = "localhost:10000".to_string();
+ item.headers = build_headers(vec![
+ (String::from("x-jwt-claim-sub"), "1".to_string()),
+ (String::from(":path"), item.path.to_string()),
+ (String::from(":method"), item.method.to_string()),
+ (String::from(":authority"), item.host.to_string()),
+ ]);
+ });
+
+ let authorizer = subject();
+ assert_eq!(authorizer.authorize(request), true);
+ }
}
diff --git a/tests/authorization/server_test.rs b/tests/authorization/server_test.rs
index fe8c8a73..5a92dcff 100644
--- a/tests/authorization/server_test.rs
+++ b/tests/authorization/server_test.rs
@@ -27,21 +27,19 @@ mod tests {
}
#[tokio::test]
- async fn test_health_check_service() {
+ async fn test_health_ext_authz_service() {
let (addr, server) = start_server().await;
- let mut client =
- build_rpc_client(addr, tonic_health::pb::health_client::HealthClient::new).await;
- let request = tonic::Request::new(tonic_health::pb::HealthCheckRequest {
- service: String::new(),
- });
+ let mut client = build_rpc_client(
+ addr,
+ envoy_types::pb::envoy::service::auth::v3::authorization_client::AuthorizationClient::new,
+ )
+ .await;
+
+ let request = tonic::Request::new(envoy_types::ext_authz::v3::pb::CheckRequest::default());
let response = client.check(request).await;
assert!(response.is_ok());
- assert_eq!(
- response.unwrap().into_inner().status(),
- tonic_health::pb::health_check_response::ServingStatus::Serving
- );
server.abort();
}