From d35cdf7f0a9822f73f4e1d18494350840de2a421 Mon Sep 17 00:00:00 2001 From: Daniel Mueller Date: Mon, 27 May 2019 08:09:48 -0700 Subject: Move storage status subcommand into status command In an attempt to rework the structure of the storage command to better accommodate future requirements for allowing to change the read-write state of the unencrypted volume (as well as potentially the encrypted one), this change removes the storage status subcommand and merges its output into the storage command. --- nitrocli/src/tests/status.rs | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'nitrocli/src/tests/status.rs') diff --git a/nitrocli/src/tests/status.rs b/nitrocli/src/tests/status.rs index 83ce61f..7aac5ad 100644 --- a/nitrocli/src/tests/status.rs +++ b/nitrocli/src/tests/status.rs @@ -37,10 +37,10 @@ fn not_found() { } #[test_device] -fn output(device: nitrokey::DeviceWrapper) -> crate::Result<()> { +fn output_pro(device: nitrokey::Pro) -> crate::Result<()> { let re = regex::Regex::new( r#"^Status: - model: (Pro|Storage) + model: Pro serial number: 0x[[:xdigit:]]{8} firmware version: \d+\.\d+ user retry count: [0-3] @@ -53,3 +53,29 @@ $"#, assert!(re.is_match(&out), out); Ok(()) } + +#[test_device] +fn output_storage(device: nitrokey::Storage) -> crate::Result<()> { + let re = regex::Regex::new( + r#"^Status: + model: Storage + serial number: 0x[[:xdigit:]]{8} + firmware version: \d+\.\d+ + user retry count: [0-3] + admin retry count: [0-3] + Storage: + SD card ID: 0x[[:xdigit:]]{8} + firmware: (un)?locked + storage keys: (not )?created + volumes: + unencrypted: (read-only|active|inactive) + encrypted: (read-only|active|inactive) + hidden: (read-only|active|inactive) +$"#, + ) + .unwrap(); + + let out = Nitrocli::with_dev(device).handle(&["status"])?; + assert!(re.is_match(&out), out); + Ok(()) +} -- cgit v1.2.1