summaryrefslogtreecommitdiff
path: root/src/tests/pro.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2018-05-21 23:27:55 +0000
committerRobin Krahl <robin.krahl@ireas.org>2018-05-22 01:28:03 +0200
commit2a736067581dd44288b43a01bf47e0d28801e0a8 (patch)
tree817f158d05bdfb2d05a74ee157709d7740c33fc2 /src/tests/pro.rs
parente55f358ea5ae1ea3df3cb66fd9ae3e3597abfc73 (diff)
downloadnitrokey-rs-2a736067581dd44288b43a01bf47e0d28801e0a8.tar.gz
nitrokey-rs-2a736067581dd44288b43a01bf47e0d28801e0a8.tar.bz2
Correct formatting
Diffstat (limited to 'src/tests/pro.rs')
-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);