summaryrefslogtreecommitdiff
path: root/tests/otp.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/otp.rs')
-rw-r--r--tests/otp.rs28
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/otp.rs b/tests/otp.rs
index d328351..51a6539 100644
--- a/tests/otp.rs
+++ b/tests/otp.rs
@@ -4,8 +4,8 @@ use std::fmt::Debug;
use std::ops::Deref;
use nitrokey::{
- Admin, Authenticate, CommandError, Config, ConfigureOtp, Device, GenerateOtp, OtpMode,
- OtpSlotData,
+ Admin, Authenticate, CommandError, Config, ConfigureOtp, Device, GenerateOtp, LibraryError,
+ OtpMode, OtpSlotData,
};
use nitrokey_test::test as test_device;
@@ -106,7 +106,7 @@ fn hotp_slot_name(device: DeviceWrapper) {
let result = device.get_hotp_slot_name(1);
assert_eq!("test-hotp", result.unwrap());
let result = device.get_hotp_slot_name(4);
- assert_cmd_err!(CommandError::InvalidSlot, result);
+ assert_lib_err!(LibraryError::InvalidSlot, result);
}
#[test_device]
@@ -115,17 +115,17 @@ fn hotp_error(device: DeviceWrapper) {
let slot_data = OtpSlotData::new(1, "", HOTP_SECRET, OtpMode::SixDigits);
assert_cmd_err!(CommandError::NoName, admin.write_hotp_slot(slot_data, 0));
let slot_data = OtpSlotData::new(4, "test", HOTP_SECRET, OtpMode::SixDigits);
- assert_cmd_err!(
- CommandError::InvalidSlot,
+ assert_lib_err!(
+ LibraryError::InvalidSlot,
admin.write_hotp_slot(slot_data, 0)
);
let slot_data = OtpSlotData::new(1, "test", "foobar", OtpMode::SixDigits);
- assert_cmd_err!(
- CommandError::InvalidHexString,
+ assert_lib_err!(
+ LibraryError::InvalidHexString,
admin.write_hotp_slot(slot_data, 0)
);
let code = admin.get_hotp_code(4);
- assert_cmd_err!(CommandError::InvalidSlot, code);
+ assert_lib_err!(LibraryError::InvalidSlot, code);
}
#[test_device]
@@ -249,7 +249,7 @@ fn totp_slot_name(device: DeviceWrapper) {
assert!(result.is_ok());
assert_eq!("test-totp", result.unwrap());
let result = device.get_totp_slot_name(16);
- assert_cmd_err!(CommandError::InvalidSlot, result);
+ assert_lib_err!(LibraryError::InvalidSlot, result);
}
#[test_device]
@@ -258,17 +258,17 @@ fn totp_error(device: DeviceWrapper) {
let slot_data = OtpSlotData::new(1, "", TOTP_SECRET, OtpMode::SixDigits);
assert_cmd_err!(CommandError::NoName, admin.write_totp_slot(slot_data, 0));
let slot_data = OtpSlotData::new(20, "test", TOTP_SECRET, OtpMode::SixDigits);
- assert_cmd_err!(
- CommandError::InvalidSlot,
+ assert_lib_err!(
+ LibraryError::InvalidSlot,
admin.write_totp_slot(slot_data, 0)
);
let slot_data = OtpSlotData::new(4, "test", "foobar", OtpMode::SixDigits);
- assert_cmd_err!(
- CommandError::InvalidHexString,
+ assert_lib_err!(
+ LibraryError::InvalidHexString,
admin.write_totp_slot(slot_data, 0)
);
let code = admin.get_totp_code(20);
- assert_cmd_err!(CommandError::InvalidSlot, code);
+ assert_lib_err!(LibraryError::InvalidSlot, code);
}
#[test_device]