summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/authorization/cedar_authorizer_test.rs13
-rw-r--r--tests/authorization/check_service_test.rs4
-rw-r--r--tests/support/factory_bot.rs4
3 files changed, 16 insertions, 5 deletions
diff --git a/tests/authorization/cedar_authorizer_test.rs b/tests/authorization/cedar_authorizer_test.rs
index 50fdd7a5..47dde0c8 100644
--- a/tests/authorization/cedar_authorizer_test.rs
+++ b/tests/authorization/cedar_authorizer_test.rs
@@ -6,7 +6,7 @@ mod tests {
use std::collections::HashMap;
fn subject() -> authzd::CedarAuthorizer {
- build_cedar_authorizer()
+ build_cedar_authorizer(cedar_policy::Entities::empty())
}
#[test]
@@ -105,7 +105,6 @@ mod tests {
];
let authorizer = subject();
-
for host in hosts {
for (method, path, expected) in &routes {
let request = build_request(|item: &mut HttpRequest| {
@@ -123,4 +122,14 @@ mod tests {
}
}
}
+
+ #[test]
+ fn test_allow_access_to_developer_in_sparkle_project() {
+ let request = build_request(|item: &mut HttpRequest| {
+ item.method = "GET".to_string();
+ item.path = "/dashboard".to_string();
+ item.host = "sparkle.staging.runway.gitlab.net".to_string();
+ });
+ assert!(subject().authorize(request));
+ }
}
diff --git a/tests/authorization/check_service_test.rs b/tests/authorization/check_service_test.rs
index 60cbc11c..ae8c1de5 100644
--- a/tests/authorization/check_service_test.rs
+++ b/tests/authorization/check_service_test.rs
@@ -8,7 +8,9 @@ mod tests {
use std::sync::Arc;
fn subject() -> CheckService {
- CheckService::new(Arc::new(build_cedar_authorizer()))
+ CheckService::new(Arc::new(build_cedar_authorizer(
+ cedar_policy::Entities::empty(),
+ )))
}
#[tokio::test]
diff --git a/tests/support/factory_bot.rs b/tests/support/factory_bot.rs
index 007f0cb7..14969f87 100644
--- a/tests/support/factory_bot.rs
+++ b/tests/support/factory_bot.rs
@@ -36,10 +36,10 @@ pub fn build_headers(headers: Vec<(String, String)>) -> HashMap<String, String>
})
}
-pub fn build_cedar_authorizer() -> authzd::CedarAuthorizer {
+pub fn build_cedar_authorizer(entities: cedar_policy::Entities) -> authzd::CedarAuthorizer {
let realpath = std::fs::canonicalize("./etc/authzd").unwrap();
let path = realpath.as_path();
- authzd::CedarAuthorizer::new_from(path, cedar_policy::Entities::empty())
+ authzd::CedarAuthorizer::new_from(path, entities)
}
pub async fn build_channel(addr: SocketAddr) -> Channel {