summaryrefslogtreecommitdiff
path: root/nitrocli/src/tests/status.rs
diff options
context:
space:
mode:
Diffstat (limited to 'nitrocli/src/tests/status.rs')
-rw-r--r--nitrocli/src/tests/status.rs30
1 files changed, 28 insertions, 2 deletions
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(())
+}