diff options
| author | mo khan <mo@mokhan.ca> | 2025-07-16 10:45:04 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-07-16 10:45:04 -0600 |
| commit | 81c6991616ef0f9cd4134d398c5b7cee2c6665de (patch) | |
| tree | def5e984db9cb07dcf55d267d108bfb3228974ec | |
| parent | 0c75a5dc1f3b76c593035f29b422db8c25356325 (diff) | |
test: start to flush out test for spice authorizer
| -rw-r--r-- | src/authorization/spice/authorizer.rs | 6 | ||||
| -rw-r--r-- | tests/authorization/mod.rs | 1 | ||||
| -rw-r--r-- | tests/authorization/spice/authorizer_test.rs | 18 | ||||
| -rw-r--r-- | tests/authorization/spice/mod.rs | 1 |
4 files changed, 26 insertions, 0 deletions
diff --git a/src/authorization/spice/authorizer.rs b/src/authorization/spice/authorizer.rs index da2805b9..d906752f 100644 --- a/src/authorization/spice/authorizer.rs +++ b/src/authorization/spice/authorizer.rs @@ -1,6 +1,12 @@ #[derive(Debug)] pub struct Authorizer {} +impl Authorizer { + pub fn new() -> Authorizer { + Authorizer {} + } +} + impl crate::authorization::authorizer::Authorizer for Authorizer { fn authorize(&self, _request: envoy_types::ext_authz::v3::pb::CheckRequest) -> bool { false diff --git a/tests/authorization/mod.rs b/tests/authorization/mod.rs index 675247d4..7cad6c25 100644 --- a/tests/authorization/mod.rs +++ b/tests/authorization/mod.rs @@ -1,3 +1,4 @@ mod cedar_authorizer_test; mod check_service_test; mod server_test; +mod spice; diff --git a/tests/authorization/spice/authorizer_test.rs b/tests/authorization/spice/authorizer_test.rs new file mode 100644 index 00000000..b295b64b --- /dev/null +++ b/tests/authorization/spice/authorizer_test.rs @@ -0,0 +1,18 @@ +#[cfg(test)] +mod tests { + use crate::support::factory_bot::*; + use authzd::Authorizer; + + #[test] + fn test_example() { + let authorizer = authzd::authorization::spice::Authorizer::new(); + let request = build_request( + |item: &mut envoy_types::pb::envoy::service::auth::v3::attribute_context::HttpRequest| { + item.method = "GET".to_string(); + item.path = "/".to_string(); + }, + ); + + assert!(authorizer.authorize(request)) + } +} diff --git a/tests/authorization/spice/mod.rs b/tests/authorization/spice/mod.rs new file mode 100644 index 00000000..6aa0bfab --- /dev/null +++ b/tests/authorization/spice/mod.rs @@ -0,0 +1 @@ +mod authorizer_test; |
