aboutsummaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/pro.rs44
1 files changed, 35 insertions, 9 deletions
diff --git a/src/tests/pro.rs b/src/tests/pro.rs
index 9cdc586..e39c95a 100644
--- a/src/tests/pro.rs
+++ b/src/tests/pro.rs
@@ -32,7 +32,9 @@ fn get_test_device() -> UnauthenticatedDevice {
}
fn get_admin_test_device() -> AdminAuthenticatedDevice {
- get_test_device().authenticate_admin(ADMIN_PASSWORD).expect("Could not login as admin.")
+ get_test_device()
+ .authenticate_admin(ADMIN_PASSWORD)
+ .expect("Could not login as admin.")
}
#[test]
@@ -59,9 +61,15 @@ fn disconnect() {
set_debug(false);
::connect().unwrap();
assert_empty_serial_number();
- ::connect().unwrap().authenticate_admin(ADMIN_PASSWORD).unwrap();
+ ::connect()
+ .unwrap()
+ .authenticate_admin(ADMIN_PASSWORD)
+ .unwrap();
assert_empty_serial_number();
- ::connect().unwrap().authenticate_user(USER_PASSWORD).unwrap();
+ ::connect()
+ .unwrap()
+ .authenticate_user(USER_PASSWORD)
+ .unwrap();
assert_empty_serial_number();
}
@@ -138,9 +146,15 @@ fn hotp_slot_name() {
fn hotp_error() {
let admin = get_admin_test_device();
let slot_data = OtpSlotData::new(1, "", HOTP_SECRET, OtpMode::SixDigits);
- assert_eq!(CommandStatus::Error(CommandError::NoName), admin.write_hotp_slot(slot_data, 0));
+ assert_eq!(
+ CommandStatus::Error(CommandError::NoName),
+ admin.write_hotp_slot(slot_data, 0)
+ );
let slot_data = OtpSlotData::new(4, "test", HOTP_SECRET, OtpMode::SixDigits);
- assert_eq!(CommandStatus::Error(CommandError::InvalidSlot), admin.write_hotp_slot(slot_data, 0));
+ assert_eq!(
+ CommandStatus::Error(CommandError::InvalidSlot),
+ admin.write_hotp_slot(slot_data, 0)
+ );
let code = admin.get_hotp_code(4);
assert_eq!(CommandError::InvalidSlot, code.unwrap_err());
}
@@ -239,9 +253,15 @@ fn totp_slot_name() {
fn totp_error() {
let admin = get_admin_test_device();
let slot_data = OtpSlotData::new(1, "", HOTP_SECRET, OtpMode::SixDigits);
- assert_eq!(CommandStatus::Error(CommandError::NoName), admin.write_hotp_slot(slot_data, 0));
+ assert_eq!(
+ CommandStatus::Error(CommandError::NoName),
+ admin.write_hotp_slot(slot_data, 0)
+ );
let slot_data = OtpSlotData::new(4, "test", HOTP_SECRET, OtpMode::SixDigits);
- assert_eq!(CommandStatus::Error(CommandError::InvalidSlot), admin.write_hotp_slot(slot_data, 0));
+ assert_eq!(
+ CommandStatus::Error(CommandError::InvalidSlot),
+ admin.write_hotp_slot(slot_data, 0)
+ );
let code = admin.get_hotp_code(4);
assert_eq!(CommandError::InvalidSlot, code.unwrap_err());
}
@@ -350,7 +370,10 @@ fn change_user_pin() {
assert_eq!(CommandStatus::Success, result);
let device = device.authenticate_user(USER_PASSWORD).unwrap_err().0;
- let device = device.authenticate_user(USER_NEW_PASSWORD).unwrap().device();
+ let device = device
+ .authenticate_user(USER_NEW_PASSWORD)
+ .unwrap()
+ .device();
let result = device.change_user_pin(USER_PASSWORD, USER_PASSWORD);
assert_eq!(CommandStatus::Error(CommandError::WrongPassword), result);
@@ -373,7 +396,10 @@ fn change_admin_pin() {
assert_eq!(CommandStatus::Success, result);
let device = device.authenticate_admin(ADMIN_PASSWORD).unwrap_err().0;
- let device = device.authenticate_admin(ADMIN_NEW_PASSWORD).unwrap().device();
+ let device = device
+ .authenticate_admin(ADMIN_NEW_PASSWORD)
+ .unwrap()
+ .device();
let result = device.change_admin_pin(ADMIN_PASSWORD, ADMIN_PASSWORD);
assert_eq!(CommandStatus::Error(CommandError::WrongPassword), result);