aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/device.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/tests/device.rs b/tests/device.rs
index bb71eb4..a2bdfb5 100644
--- a/tests/device.rs
+++ b/tests/device.rs
@@ -33,7 +33,7 @@ fn count_nitrokey_block_devices() -> usize {
#[test_device]
fn connect_no_device() {
- let mut manager = nitrokey::take().unwrap();
+ let mut manager = unwrap_ok!(nitrokey::take());
assert_cmu_err!(CommunicationError::NotConnected, manager.connect());
assert_cmu_err!(
@@ -51,9 +51,8 @@ fn connect_no_device() {
#[test_device]
fn connect_pro(device: Pro) {
assert_eq!(device.get_model(), nitrokey::Model::Pro);
- drop(device);
- let mut manager = nitrokey::take().unwrap();
+ let manager = device.into_manager();
assert_any_ok!(manager.connect());
assert_any_ok!(manager.connect_model(nitrokey::Model::Pro));
assert_any_ok!(manager.connect_pro());
@@ -62,9 +61,8 @@ fn connect_pro(device: Pro) {
#[test_device]
fn connect_storage(device: Storage) {
assert_eq!(device.get_model(), nitrokey::Model::Storage);
- drop(device);
- let mut manager = nitrokey::take().unwrap();
+ let manager = device.into_manager();
assert_any_ok!(manager.connect());
assert_any_ok!(manager.connect_model(nitrokey::Model::Storage));
assert_any_ok!(manager.connect_storage());