summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2018-12-30 00:04:23 +0100
committerRobin Krahl <robin.krahl@ireas.org>2018-12-30 00:04:23 +0100
commit3d951ab54daea9c362bdae2e0945701955c412e5 (patch)
treefeeee31249946184590ada8ec378aef2eb8a4382 /tests
parente2d333574f54bf57a1bba970dbbfe5844ef8bf0d (diff)
downloadnitrokey-rs-3d951ab54daea9c362bdae2e0945701955c412e5.tar.gz
nitrokey-rs-3d951ab54daea9c362bdae2e0945701955c412e5.tar.bz2
Add function Device::get_model
This patch adds the function Device::get_model that returns the model of the connected Nitrokey stick.
Diffstat (limited to 'tests')
-rw-r--r--tests/device.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/device.rs b/tests/device.rs
index 2c8cfa6..a6098b7 100644
--- a/tests/device.rs
+++ b/tests/device.rs
@@ -81,6 +81,23 @@ fn disconnect() {
assert_empty_serial_number();
}
+fn require_model(model: nitrokey::Model) {
+ assert_eq!(model, nitrokey::connect().unwrap().get_model());
+ assert_eq!(model, Target::connect().unwrap().get_model());
+}
+
+#[test]
+#[cfg_attr(not(feature = "test-pro"), ignore)]
+fn get_model_pro() {
+ require_model(nitrokey::Model::Pro);
+}
+
+#[test]
+#[cfg_attr(not(feature = "test-storage"), ignore)]
+fn get_model_storage() {
+ require_model(nitrokey::Model::Storage);
+}
+
#[test]
#[cfg_attr(not(any(feature = "test-pro", feature = "test-storage")), ignore)]
fn get_serial_number() {