aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2019-01-12 17:37:21 +0000
committerRobin Krahl <robin.krahl@ireas.org>2019-01-12 18:39:10 +0100
commit78f926456a07047c34dc20b97fe04e55ba443528 (patch)
tree53ed0f2fac5bccc007df78aa441a16c69a537211 /tests
parent879ee92e81b3acee88e3ecbc35f7d4cfbacd708a (diff)
downloadnitrokey-rs-78f926456a07047c34dc20b97fe04e55ba443528.tar.gz
nitrokey-rs-78f926456a07047c34dc20b97fe04e55ba443528.tar.bz2
Add export_firmware method to Storage
The export_firmware method writes the firmware of the Nitrokey Storage to the unencrypted storage. We only test that the command succeeds as mounting the unencrypted storage and accessing the file is out of scope for the tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/device.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/device.rs b/tests/device.rs
index 9985e7a..e40ae12 100644
--- a/tests/device.rs
+++ b/tests/device.rs
@@ -437,3 +437,21 @@ fn get_storage_status(device: Storage) {
assert!(status.serial_number_sd_card > 0);
assert!(status.serial_number_smart_card > 0);
}
+
+#[test_device]
+fn export_firmware(device: Storage) {
+ assert_eq!(
+ Err(CommandError::WrongPassword),
+ device.export_firmware("someadminpn")
+ );
+ assert_eq!(Ok(()), device.export_firmware(ADMIN_PASSWORD));
+ assert_eq!(
+ Ok(()),
+ device.set_unencrypted_volume_mode(ADMIN_PASSWORD, VolumeMode::ReadWrite)
+ );
+ assert_eq!(Ok(()), device.export_firmware(ADMIN_PASSWORD));
+ assert_eq!(
+ Ok(()),
+ device.set_unencrypted_volume_mode(ADMIN_PASSWORD, VolumeMode::ReadOnly)
+ );
+}