aboutsummaryrefslogtreecommitdiff
path: root/nitrocli/src/tests/pws.rs
diff options
context:
space:
mode:
Diffstat (limited to 'nitrocli/src/tests/pws.rs')
-rw-r--r--nitrocli/src/tests/pws.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/nitrocli/src/tests/pws.rs b/nitrocli/src/tests/pws.rs
index 2a9a8ef..5d0f245 100644
--- a/nitrocli/src/tests/pws.rs
+++ b/nitrocli/src/tests/pws.rs
@@ -83,6 +83,29 @@ fn set_get(device: nitrokey::DeviceWrapper) -> crate::Result<()> {
}
#[test_device]
+fn set_reset_get(device: nitrokey::DeviceWrapper) -> crate::Result<()> {
+ const NAME: &str = "some/svc";
+ const LOGIN: &str = "a\\user";
+ const PASSWORD: &str = "!@&-)*(&+%^@";
+
+ let mut ncli = Nitrocli::with_dev(device);
+ let _ = ncli.handle(&["pws", "set", "2", &NAME, &LOGIN, &PASSWORD])?;
+
+ let out = ncli.handle(&["reset"])?;
+ assert_eq!(out, "");
+
+ let res = ncli.handle(&["pws", "get", "2"]);
+ assert_eq!(
+ res.unwrap_cmd_err(),
+ (
+ Some("Could not access PWS slot"),
+ nitrokey::CommandError::SlotNotProgrammed
+ )
+ );
+ Ok(())
+}
+
+#[test_device]
fn clear(device: nitrokey::DeviceWrapper) -> crate::Result<()> {
let mut ncli = Nitrocli::with_dev(device);
let _ = ncli.handle(&["pws", "set", "10", "clear-test", "some-login", "abcdef"])?;