summaryrefslogtreecommitdiff
path: root/src/tests/device.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2018-12-10 14:44:39 +0000
committerRobin Krahl <robin.krahl@ireas.org>2018-12-10 15:48:34 +0100
commit39ad1f54bb2c1e828e19193fd8772f17731973f9 (patch)
tree4036fe8092eb023e8b6e74202d8b691fb43cad13 /src/tests/device.rs
parent1e9556903dffaf77006ba10bba806114428cd53f (diff)
downloadnitrokey-rs-39ad1f54bb2c1e828e19193fd8772f17731973f9.tar.gz
nitrokey-rs-39ad1f54bb2c1e828e19193fd8772f17731973f9.tar.bz2
Provide access to the status of a Nitrokey Storage
This patch adds a `get_status` method to the `Storage` structure. The returned structure `StorageStatus` is based on the structure provided by libnitrokey.
Diffstat (limited to 'src/tests/device.rs')
-rw-r--r--src/tests/device.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/tests/device.rs b/src/tests/device.rs
index c2c5336..fed465d 100644
--- a/src/tests/device.rs
+++ b/src/tests/device.rs
@@ -292,3 +292,13 @@ fn lock() {
assert!(device.lock().is_ok());
assert_eq!(1, count_nitrokey_block_devices());
}
+
+#[test]
+#[cfg_attr(not(feature = "test-storage"), ignore)]
+fn get_storage_status() {
+ let device = Storage::connect().unwrap();
+ let status = device.get_status().unwrap();
+
+ assert!(status.serial_number_sd_card > 0);
+ assert!(status.serial_number_smart_card > 0);
+}