aboutsummaryrefslogtreecommitdiff
path: root/nitrocli/src/tests/storage.rs
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2019-05-27 08:09:48 -0700
committerDaniel Mueller <deso@posteo.net>2019-05-27 08:09:48 -0700
commitd35cdf7f0a9822f73f4e1d18494350840de2a421 (patch)
tree6d22dd85516c5363a81c9264bc30a53cf244d632 /nitrocli/src/tests/storage.rs
parenta7b63f8a0570f0c798af7eaadfaf6f4da14cd54c (diff)
downloadnitrocli-d35cdf7f0a9822f73f4e1d18494350840de2a421.tar.gz
nitrocli-d35cdf7f0a9822f73f4e1d18494350840de2a421.tar.bz2
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.
Diffstat (limited to 'nitrocli/src/tests/storage.rs')
-rw-r--r--nitrocli/src/tests/storage.rs37
1 files changed, 17 insertions, 20 deletions
diff --git a/nitrocli/src/tests/storage.rs b/nitrocli/src/tests/storage.rs
index be933ca..5b45bdc 100644
--- a/nitrocli/src/tests/storage.rs
+++ b/nitrocli/src/tests/storage.rs
@@ -20,15 +20,6 @@
use super::*;
#[test_device]
-fn status_on_pro(device: nitrokey::Pro) {
- let res = Nitrocli::with_dev(device).handle(&["storage", "status"]);
- assert_eq!(
- res.unwrap_str_err(),
- "This command is only available on the Nitrokey Storage",
- );
-}
-
-#[test_device]
fn status_open_close(device: nitrokey::Storage) -> crate::Result<()> {
fn make_re(open: Option<bool>) -> regex::Regex {
let encrypted = match open {
@@ -42,14 +33,11 @@ fn status_open_close(device: nitrokey::Storage) -> crate::Result<()> {
None => "(read-only|active|inactive)",
};
let re = format!(
- r#"^Status:
- SD card ID: 0x[[:xdigit:]]{{8}}
- firmware: (un)?locked
- storage keys: (not )?created
- volumes:
- unencrypted: (read-only|active|inactive)
- encrypted: {}
- hidden: (read-only|active|inactive)
+ r#"
+ volumes:
+ unencrypted: (read-only|active|inactive)
+ encrypted: {}
+ hidden: (read-only|active|inactive)
$"#,
encrypted
);
@@ -57,21 +45,30 @@ $"#,
}
let mut ncli = Nitrocli::with_dev(device);
- let out = ncli.handle(&["storage", "status"])?;
+ let out = ncli.handle(&["status"])?;
assert!(make_re(None).is_match(&out), out);
let _ = ncli.handle(&["storage", "open"])?;
- let out = ncli.handle(&["storage", "status"])?;
+ let out = ncli.handle(&["status"])?;
assert!(make_re(Some(true)).is_match(&out), out);
let _ = ncli.handle(&["storage", "close"])?;
- let out = ncli.handle(&["storage", "status"])?;
+ let out = ncli.handle(&["status"])?;
assert!(make_re(Some(false)).is_match(&out), out);
Ok(())
}
#[test_device]
+fn encrypted_open_on_pro(device: nitrokey::Pro) {
+ let res = Nitrocli::with_dev(device).handle(&["storage", "open"]);
+ assert_eq!(
+ res.unwrap_str_err(),
+ "This command is only available on the Nitrokey Storage",
+ );
+}
+
+#[test_device]
fn encrypted_open_close(device: nitrokey::Storage) -> crate::Result<()> {
let mut ncli = Nitrocli::with_dev(device);
let out = ncli.handle(&["storage", "open"])?;