diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/device.rs | 13 | ||||
-rw-r--r-- | tests/util/mod.rs | 1 |
2 files changed, 13 insertions, 1 deletions
diff --git a/tests/device.rs b/tests/device.rs index 4551534..a225d2d 100644 --- a/tests/device.rs +++ b/tests/device.rs @@ -6,9 +6,10 @@ use std::{thread, time}; use nitrokey::{Authenticate, CommandError, Config, Device, Storage}; -use crate::util::{Target, ADMIN_PASSWORD, USER_PASSWORD}; +use crate::util::{Target, ADMIN_PASSWORD, USER_PASSWORD, UPDATE_PIN}; static ADMIN_NEW_PASSWORD: &str = "1234567890"; +static UPDATE_NEW_PIN: &str = "87654321"; static USER_NEW_PASSWORD: &str = "abcdefghij"; fn count_nitrokey_block_devices() -> usize { @@ -296,6 +297,16 @@ fn unlock_user_pin() { #[test] #[cfg_attr(not(feature = "test-storage"), ignore)] +fn change_update_pin() { + let device = Storage::connect().unwrap(); + + assert_eq!(Err(CommandError::WrongPassword), device.change_update_pin(UPDATE_NEW_PIN, UPDATE_PIN)); + assert_eq!(Ok(()), device.change_update_pin(UPDATE_PIN, UPDATE_NEW_PIN)); + assert_eq!(Ok(()), device.change_update_pin(UPDATE_NEW_PIN, UPDATE_PIN)); +} + +#[test] +#[cfg_attr(not(feature = "test-storage"), ignore)] fn encrypted_volume() { let device = Storage::connect().unwrap(); assert!(device.lock().is_ok()); diff --git a/tests/util/mod.rs b/tests/util/mod.rs index c2c94e2..5e495d8 100644 --- a/tests/util/mod.rs +++ b/tests/util/mod.rs @@ -1,4 +1,5 @@ pub static ADMIN_PASSWORD: &str = "12345678"; +pub static UPDATE_PIN: &str = "12345678"; pub static USER_PASSWORD: &str = "123456"; #[cfg(not(feature = "test-storage"))] |