aboutsummaryrefslogtreecommitdiff
path: root/src/test.rs
diff options
context:
space:
mode:
authorKunoiSayami <[email protected]>2021-11-11 00:27:25 +0800
committerKunoiSayami <[email protected]>2021-11-11 00:28:01 +0800
commitff968cf5c39652d9153aa3dcf5563e6d83ea0e6c (patch)
tree4bf3b31affa531886aed2f73a2950b9e76dc00db /src/test.rs
parentc64151e929cea76be5553cdeeeaf90de2ca75d89 (diff)
fmt(core): Address cargo fmtv4.0.0-alpha.1
* feat(core): Address cargo clippy * feat(test): Support change PAM provide from environments Signed-off-by: KunoiSayami <[email protected]>
Diffstat (limited to 'src/test.rs')
-rw-r--r--src/test.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/test.rs b/src/test.rs
index ee9bc03..bdc66dc 100644
--- a/src/test.rs
+++ b/src/test.rs
@@ -20,7 +20,6 @@
#[cfg(test)]
mod core {
- use std::borrow::BorrowMut;
use crate::datastructures::{rand_str, Config, TestSuite};
use crate::{cmd_add_user, cmd_authenticate_cookie, cmd_init, cmd_repo_user_control};
use crate::{get_arg_matches, IOModule};
@@ -29,6 +28,7 @@ mod core {
Argon2,
};
use redis::AsyncCommands;
+ use std::borrow::BorrowMut;
use std::io::{Read, Write};
use std::path::Path;
use std::path::PathBuf;
@@ -370,12 +370,14 @@ mod core {
#[test]
fn test_pam() {
- let service = "system-login";
+ let service = option_env!("pam_service").unwrap_or("system-auth");
let user = option_env!("pam_user").unwrap_or("user");
let password = option_env!("pam_password").unwrap_or("password");
let mut auth = pam::Authenticator::with_password(service).unwrap();
- auth.get_handler().borrow_mut().set_credentials(user, password);
+ auth.get_handler()
+ .borrow_mut()
+ .set_credentials(user, password);
assert!(auth.authenticate().is_ok() && auth.open_session().is_ok())
}
}