summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2025-01-07 21:48:22 +0100
committerJoel Klinghed <the_jk@spawned.biz>2025-01-07 21:48:22 +0100
commit13056242ab976b766bbff345d9b22e3aa9ad4a94 (patch)
treeed82dc4e09855df6e806b5f8b7fd75ba63f62bf7 /server
parente0540e4e2fce2686c2c4389fe586f1198392fe19 (diff)
Silence dead/unused code warnings in tests
auth module switching implementation based on cfg(test)
Diffstat (limited to 'server')
-rw-r--r--server/src/auth.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/server/src/auth.rs b/server/src/auth.rs
index c76bd82..4889f78 100644
--- a/server/src/auth.rs
+++ b/server/src/auth.rs
@@ -50,7 +50,7 @@ struct Login<'r> {
}
#[derive(Debug, Deserialize)]
-#[allow(dead_code)]
+#[cfg_attr(test, allow(dead_code))]
struct AuthConfig<'a> {
session_max_age_days: u32,
ldap_url: Cow<'a, str>,
@@ -67,6 +67,7 @@ struct Sessions {
data: Mutex<SessionsData>,
}
+#[cfg_attr(test, allow(dead_code))]
struct LdapState {
ldap: OnceLock<ldap3::Ldap>,
}
@@ -283,6 +284,7 @@ fn unauthorized() -> Json<api_model::StatusResponse> {
Json(STATUS_UNAUTHORIZED)
}
+#[cfg_attr(test, allow(dead_code))]
async fn setup_ldap(
ldap_state: &LdapState,
config: &AuthConfig<'_>,
@@ -304,6 +306,7 @@ enum LdapOrSqlError {
SqlError(sqlx::Error),
}
+#[cfg_attr(test, allow(dead_code))]
async fn sync_ldap(
ldap_state: &LdapState,
config: &AuthConfig<'_>,