aboutsummaryrefslogtreecommitdiff
path: root/tests/otp.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/otp.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/otp.rs')
-rw-r--r--tests/otp.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/otp.rs b/tests/otp.rs
index 8ca8311..d55d54a 100644
--- a/tests/otp.rs
+++ b/tests/otp.rs
@@ -7,12 +7,10 @@ use std::ops::DerefMut;
use nitrokey::{
Admin, Authenticate, CommandError, Config, ConfigureOtp, Device, GenerateOtp, LibraryError,
- OtpMode, OtpSlotData,
+ OtpMode, OtpSlotData, DEFAULT_ADMIN_PIN, DEFAULT_USER_PIN,
};
use nitrokey_test::test as test_device;
-use crate::util::{ADMIN_PASSWORD, USER_PASSWORD};
-
// test suite according to RFC 4226, Appendix D
static HOTP_SECRET: &str = "3132333435363738393031323334353637383930";
static HOTP_CODES: &[&str] = &[
@@ -41,7 +39,7 @@ fn make_admin_test_device<'a, T>(device: &'a mut T) -> Admin<'a, T>
where
T: Device,
{
- unwrap_ok!(device.authenticate_admin(ADMIN_PASSWORD))
+ unwrap_ok!(device.authenticate_admin(DEFAULT_ADMIN_PIN))
}
fn configure_hotp(admin: &mut ConfigureOtp, counter: u8) {
@@ -91,7 +89,7 @@ fn hotp_pin(device: DeviceWrapper) {
assert_ok!((), admin.write_config(config));
configure_hotp(&mut admin, 0);
- let mut user = unwrap_ok!(device.authenticate_user(USER_PASSWORD));
+ let mut user = unwrap_ok!(device.authenticate_user(DEFAULT_USER_PIN));
check_hotp_codes(&mut user, 0);
assert_cmd_err!(CommandError::NotAuthorized, user.get_hotp_code(1));
@@ -219,7 +217,7 @@ fn totp_pin(device: DeviceWrapper) {
assert_ok!((), admin.write_config(config));
configure_totp(&mut admin, 1);
- let mut user = unwrap_ok!(device.authenticate_user(USER_PASSWORD));
+ let mut user = unwrap_ok!(device.authenticate_user(DEFAULT_USER_PIN));
check_totp_codes(&mut user, 1, TotpTimestampSize::U32);
assert_cmd_err!(CommandError::NotAuthorized, user.get_totp_code(1));
@@ -234,7 +232,7 @@ fn totp_pin_64(device: Pro) {
assert_ok!((), admin.write_config(config));
configure_totp(&mut admin, 1);
- let mut user = unwrap_ok!(admin.authenticate_user(USER_PASSWORD));
+ let mut user = unwrap_ok!(admin.authenticate_user(DEFAULT_USER_PIN));
check_totp_codes(&mut user, 1, TotpTimestampSize::U64);
assert_cmd_err!(CommandError::NotAuthorized, device.get_totp_code(1));