summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2019-01-27 18:07:59 +0000
committerRobin Krahl <robin.krahl@ireas.org>2019-07-08 21:31:40 +0000
commitbd7c7a5fdf0ae66a1ff2f00beb5ed4c2e6994ca1 (patch)
tree7e9a249db27c80a0e40fe16bcda2c1ca0cd386f3 /tests
parent54d23475aa3b712a539bad129fe37223173268f2 (diff)
downloadnitrokey-rs-bd7c7a5fdf0ae66a1ff2f00beb5ed4c2e6994ca1.tar.gz
nitrokey-rs-bd7c7a5fdf0ae66a1ff2f00beb5ed4c2e6994ca1.tar.bz2
Move the connect_model function into Manager
As part of the connection refactoring, this patch moves the connect_model function to the Manager struct. As the connect_model function is not used by nitrokey-test, it is removed.
Diffstat (limited to 'tests')
-rw-r--r--tests/device.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/device.rs b/tests/device.rs
index 5c52024..527d6f2 100644
--- a/tests/device.rs
+++ b/tests/device.rs
@@ -36,11 +36,15 @@ fn connect_no_device() {
assert_cmu_err!(CommunicationError::NotConnected, nitrokey::connect());
assert_cmu_err!(
CommunicationError::NotConnected,
- nitrokey::connect_model(nitrokey::Model::Pro)
+ nitrokey::take()
+ .unwrap()
+ .connect_model(nitrokey::Model::Pro)
);
assert_cmu_err!(
CommunicationError::NotConnected,
- nitrokey::connect_model(nitrokey::Model::Storage)
+ nitrokey::take()
+ .unwrap()
+ .connect_model(nitrokey::Model::Storage)
);
assert_cmu_err!(CommunicationError::NotConnected, nitrokey::Pro::connect());
assert_cmu_err!(
@@ -55,7 +59,7 @@ fn connect_pro(device: Pro) {
drop(device);
assert_any_ok!(nitrokey::connect());
- assert_any_ok!(nitrokey::connect_model(nitrokey::Model::Pro));
+ assert_any_ok!(nitrokey::take().unwrap().connect_model(nitrokey::Model::Pro));
assert_any_ok!(nitrokey::Pro::connect());
}
@@ -65,7 +69,7 @@ fn connect_storage(device: Storage) {
drop(device);
assert_any_ok!(nitrokey::connect());
- assert_any_ok!(nitrokey::connect_model(nitrokey::Model::Storage));
+ assert_any_ok!(nitrokey::take().unwrap().connect_model(nitrokey::Model::Storage));
assert_any_ok!(nitrokey::Storage::connect());
}