Mercurial > crates > nonstick
diff testharness/src/bin/testharness.rs @ 172:6727cbe56f4a
Test environment variable setting; minor cleanup.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Fri, 25 Jul 2025 21:02:53 -0400 |
parents | e27c5c667a5a |
children | 46e8ce5cd5d1 |
line wrap: on
line diff
--- a/testharness/src/bin/testharness.rs Fri Jul 25 20:52:14 2025 -0400 +++ b/testharness/src/bin/testharness.rs Fri Jul 25 21:02:53 2025 -0400 @@ -3,10 +3,12 @@ use nonstick::conv::Exchange; use nonstick::items::Items; use nonstick::libpam::TransactionBuilder; +use nonstick::EnvironMap; use nonstick::{ AuthnFlags, AuthtokFlags, Conversation, ErrorCode, LibPamTransaction, PamShared, Transaction, }; use std::cell::Cell; +use std::collections::HashMap; use std::ffi::OsString; use std::os::unix::ffi::OsStrExt; @@ -43,8 +45,6 @@ Exchange::MaskedPrompt(p) => { let answer = if self.changing_password.get() { let prompt_count = self.change_prompt_count.get(); - eprintln!("CHANGING PASSWORD PROMPT {prompt_count}"); - eprintln!("-> {p:?}"); self.change_prompt_count.set(prompt_count + 1); // When changing passwords after logging in, Sun PAM // uses the existing authtok that was just entered as @@ -133,4 +133,9 @@ assert_eq!(change, Err(ErrorCode::TryAgain)); tx.change_authtok(AuthtokFlags::CHANGE_EXPIRED_AUTHTOK) .unwrap(); + let environ: HashMap<_, _> = tx.environ().iter().collect(); + assert_eq!( + environ, + HashMap::from([("nin".into(), "nine inch nails".into())]) + ); }