aboutsummaryrefslogtreecommitdiff
path: root/tests/pws.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2019-02-04 00:29:11 +0000
committerRobin Krahl <robin.krahl@ireas.org>2019-02-04 01:30:25 +0100
commit606177a61de39ba5e96390d63cff536f895d8c39 (patch)
treecc5d968af46ff3fd10035d41053c22c8250c7f1b /tests/pws.rs
parent2fe3d9ee071647b6cb48cc6186235144a9575bed (diff)
downloadnitrokey-rs-606177a61de39ba5e96390d63cff536f895d8c39.tar.gz
nitrokey-rs-606177a61de39ba5e96390d63cff536f895d8c39.tar.bz2
Remove PIN constants from tests
In a previous commit, we introduced the DEFAULT_{ADMIN,USER}_PIN constants. Therefore we no longer need in the {ADMIN,USER}_PASSWORD constants in the util module for the tests.
Diffstat (limited to 'tests/pws.rs')
-rw-r--r--tests/pws.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/tests/pws.rs b/tests/pws.rs
index 7805803..b0e5abe 100644
--- a/tests/pws.rs
+++ b/tests/pws.rs
@@ -7,13 +7,12 @@ use std::ffi::CStr;
use libc::{c_int, c_void, free};
use nitrokey::{
- CommandError, Device, Error, GetPasswordSafe, LibraryError, PasswordSafe, SLOT_COUNT,
+ CommandError, Device, Error, GetPasswordSafe, LibraryError, PasswordSafe, DEFAULT_ADMIN_PIN,
+ DEFAULT_USER_PIN, SLOT_COUNT,
};
use nitrokey_sys;
use nitrokey_test::test as test_device;
-use crate::util::{ADMIN_PASSWORD, USER_PASSWORD};
-
fn get_slot_name_direct(slot: u8) -> Result<String, Error> {
let ptr = unsafe { nitrokey_sys::NK_get_password_safe_slot_name(slot) };
if ptr.is_null() {
@@ -37,7 +36,7 @@ fn get_pws<T>(device: &mut T) -> PasswordSafe
where
T: Device,
{
- unwrap_ok!(device.get_password_safe(USER_PASSWORD))
+ unwrap_ok!(device.get_password_safe(DEFAULT_USER_PIN))
}
#[test_device]
@@ -45,14 +44,14 @@ fn enable(device: DeviceWrapper) {
let mut device = device;
assert_cmd_err!(
CommandError::WrongPassword,
- device.get_password_safe(&(USER_PASSWORD.to_owned() + "123"))
+ device.get_password_safe(&(DEFAULT_USER_PIN.to_owned() + "123"))
);
- assert_any_ok!(device.get_password_safe(USER_PASSWORD));
+ assert_any_ok!(device.get_password_safe(DEFAULT_USER_PIN));
assert_cmd_err!(
CommandError::WrongPassword,
- device.get_password_safe(ADMIN_PASSWORD)
+ device.get_password_safe(DEFAULT_ADMIN_PIN)
);
- assert_any_ok!(device.get_password_safe(USER_PASSWORD));
+ assert_any_ok!(device.get_password_safe(DEFAULT_USER_PIN));
}
#[test_device]