aboutsummaryrefslogtreecommitdiff
path: root/nitrocli/src/tests/mod.rs
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2019-01-10 15:22:13 -0800
committerDaniel Mueller <deso@posteo.net>2019-01-10 15:22:13 -0800
commit6e0efd98e9ee07a01241e2187b4c820770c3c478 (patch)
treea0f87c0d26f6ee5052bc57d9c9ad46f9f416892a /nitrocli/src/tests/mod.rs
parenteea4f7357d7a3e3b365d887671ba78fd386a6d2d (diff)
downloadnitrocli-6e0efd98e9ee07a01241e2187b4c820770c3c478.tar.gz
nitrocli-6e0efd98e9ee07a01241e2187b4c820770c3c478.tar.bz2
Add tests for pin set and pin unblock commands
Now that we have the infrastructure for non-interactive PIN supply in place, we can add tests for commands that require the entry of a PIN. To that end, this change adds tests for the pin set as well as pin unblock commands.
Diffstat (limited to 'nitrocli/src/tests/mod.rs')
-rw-r--r--nitrocli/src/tests/mod.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/nitrocli/src/tests/mod.rs b/nitrocli/src/tests/mod.rs
index 4e25091..ef8d2bd 100644
--- a/nitrocli/src/tests/mod.rs
+++ b/nitrocli/src/tests/mod.rs
@@ -36,6 +36,7 @@ const NITROKEY_DEFAULT_USER_PIN: &str = "123456";
#[test_device]
fn dummy() {}
+mod pin;
mod run;
mod status;
@@ -92,6 +93,14 @@ impl Nitrocli {
result
}
+ pub fn user_pin(&mut self, pin: impl Into<ffi::OsString>) {
+ self.user_pin = Some(pin.into())
+ }
+
+ pub fn new_user_pin(&mut self, pin: impl Into<ffi::OsString>) {
+ self.new_user_pin = Some(pin.into())
+ }
+
fn model_to_arg(model: nitrokey::Model) -> &'static str {
match model {
nitrokey::Model::Pro => "--model=pro",
@@ -136,4 +145,8 @@ impl Nitrocli {
let (res, out, _) = self.do_run(args, |c, a| crate::args::handle_arguments(c, a));
res.map(|_| String::from_utf8_lossy(&out).into_owned())
}
+
+ pub fn model(&self) -> Option<nitrokey::Model> {
+ self.model
+ }
}