aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2019-02-05 14:47:14 +0000
committerRobin Krahl <robin.krahl@ireas.org>2019-07-20 10:24:51 +0200
commit3a0ed1b3b81b29530c0dd5d65a5409c349f85aae (patch)
treea8ce3dfa3a7e906b405ce0dcf6e62d8368070e2d /tests
parente31f1bca97fd8ee36bd933fa54c53980fc5084a7 (diff)
downloadnitrokey-rs-3a0ed1b3b81b29530c0dd5d65a5409c349f85aae.tar.gz
nitrokey-rs-3a0ed1b3b81b29530c0dd5d65a5409c349f85aae.tar.bz2
Return AuthenticationError from authenticate_*authentication-error
Diffstat (limited to 'tests')
-rw-r--r--tests/device.rs28
1 files changed, 20 insertions, 8 deletions
diff --git a/tests/device.rs b/tests/device.rs
index e367558..630dd93 100644
--- a/tests/device.rs
+++ b/tests/device.rs
@@ -103,7 +103,7 @@ where
let result = device.authenticate_admin(&(DEFAULT_ADMIN_PIN.to_owned() + suffix));
let device = match result {
Ok(admin) => admin.device(),
- Err((device, _)) => device,
+ Err(err) => err.into_device(),
};
assert_ok!(count, device.get_admin_retry_count());
return device;
@@ -116,7 +116,7 @@ where
let result = device.authenticate_user(&(DEFAULT_USER_PIN.to_owned() + suffix));
let device = match result {
Ok(admin) => admin.device(),
- Err((device, _)) => device,
+ Err(err) => err.into_device(),
};
assert_ok!(count, device.get_user_retry_count());
return device;
@@ -158,7 +158,10 @@ fn config(device: DeviceWrapper) {
#[test_device]
fn change_user_pin(device: DeviceWrapper) {
let device = device.authenticate_user(DEFAULT_USER_PIN).unwrap().device();
- let device = device.authenticate_user(USER_NEW_PASSWORD).unwrap_err().0;
+ let device = device
+ .authenticate_user(USER_NEW_PASSWORD)
+ .unwrap_err()
+ .into_device();
let mut device = device;
assert_ok!(
@@ -166,7 +169,10 @@ fn change_user_pin(device: DeviceWrapper) {
device.change_user_pin(DEFAULT_USER_PIN, USER_NEW_PASSWORD)
);
- let device = device.authenticate_user(DEFAULT_USER_PIN).unwrap_err().0;
+ let device = device
+ .authenticate_user(DEFAULT_USER_PIN)
+ .unwrap_err()
+ .into_device();
let device = device
.authenticate_user(USER_NEW_PASSWORD)
.unwrap()
@@ -191,14 +197,20 @@ fn change_admin_pin(device: DeviceWrapper) {
.authenticate_admin(DEFAULT_ADMIN_PIN)
.unwrap()
.device();
- let mut device = device.authenticate_admin(ADMIN_NEW_PASSWORD).unwrap_err().0;
+ let mut device = device
+ .authenticate_admin(ADMIN_NEW_PASSWORD)
+ .unwrap_err()
+ .into_device();
assert_ok!(
(),
device.change_admin_pin(DEFAULT_ADMIN_PIN, ADMIN_NEW_PASSWORD)
);
- let device = device.authenticate_admin(DEFAULT_ADMIN_PIN).unwrap_err().0;
+ let device = device
+ .authenticate_admin(DEFAULT_ADMIN_PIN)
+ .unwrap_err()
+ .into_device();
let mut device = device
.authenticate_admin(ADMIN_NEW_PASSWORD)
.unwrap()
@@ -229,11 +241,11 @@ where
let result = device.authenticate_user(password);
assert!(result.is_err());
let err = result.unwrap_err();
- match err.1 {
+ match *err.as_error() {
Error::CommandError(err) => assert_eq!(error, err),
_ => assert!(false),
};
- err.0
+ err.into_device()
}
#[test_device]