summaryrefslogtreecommitdiff
path: root/tests/lib.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2019-07-09 10:49:16 +0200
committerRobin Krahl <robin.krahl@ireas.org>2019-07-09 10:49:16 +0200
commit7ce751225f12c295c6e33dd46cfb5dcb88f8fbb3 (patch)
tree910e7fcae5b2b502900c67782b4db22d9c242f21 /tests/lib.rs
parent445e920986db276d0c5c39709aa76dd290773e8f (diff)
parent62e8ee8f5d02511d6eb5dc179b087b04e88c1b94 (diff)
downloadnitrokey-rs-7ce751225f12c295c6e33dd46cfb5dcb88f8fbb3.tar.gz
nitrokey-rs-7ce751225f12c295c6e33dd46cfb5dcb88f8fbb3.tar.bz2
Merge branch 'connection-manager-mut' into next
Refactor the connection management to prevent multiple device connections at the same time. RFC: https://lists.sr.ht/~ireas/nitrokey-rs-dev/%3C20190126174327.tbuyk2s535kfiqm4%40localhost%3E
Diffstat (limited to 'tests/lib.rs')
-rw-r--r--tests/lib.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/lib.rs b/tests/lib.rs
index 8ab75f6..25aae0f 100644
--- a/tests/lib.rs
+++ b/tests/lib.rs
@@ -10,3 +10,19 @@ fn get_library_version() {
assert!(version.git.is_empty() || version.git.starts_with("v"));
assert!(version.major > 0);
}
+
+#[test]
+fn take_manager() {
+ assert!(nitrokey::take().is_ok());
+
+ let result = nitrokey::take();
+ assert!(result.is_ok());
+ let result2 = nitrokey::take();
+ match result2 {
+ Ok(_) => panic!("Expected error, got Ok(_)!"),
+ Err(nitrokey::Error::ConcurrentAccessError) => {}
+ Err(err) => panic!("Expected ConcurrentAccessError, got {}", err),
+ }
+ drop(result);
+ assert!(nitrokey::take().is_ok());
+}