aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2020-09-05 06:14:38 -0700
committerDaniel Mueller <deso@posteo.net>2020-09-05 06:14:38 -0700
commit2dbc3748f9eec4a4fc9163e979b1d9d8efb3e2a0 (patch)
treec5153a014308a5fe45410ea913ee25eac7c4cbc7
parent057fb89b3e99f2b9bef5d3055d362c80352a2661 (diff)
downloadnitrocli-2dbc3748f9eec4a4fc9163e979b1d9d8efb3e2a0.tar.gz
nitrocli-2dbc3748f9eec4a4fc9163e979b1d9d8efb3e2a0.tar.bz2
Remove Nitrocli::model method
While the Nitrocli::model() method was well intentioned, we do not actually need it because we create a Nitrocli instance from the model passed to the individual test. We can just reuse this model instead. With this patch we do exactly that, allowing us to get rid of Nitrocli::model() all together.
-rw-r--r--src/tests/mod.rs4
-rw-r--r--src/tests/pin.rs2
-rw-r--r--src/tests/reset.rs4
3 files changed, 3 insertions, 7 deletions
diff --git a/src/tests/mod.rs b/src/tests/mod.rs
index e1f93a9..d31348b 100644
--- a/src/tests/mod.rs
+++ b/src/tests/mod.rs
@@ -120,8 +120,4 @@ impl Nitrocli {
let (res, out, _) = self.do_run(args, |c, a| crate::handle_arguments(c, a));
res.map(|_| String::from_utf8_lossy(&out).into_owned())
}
-
- pub fn model(&self) -> Option<nitrokey::Model> {
- self.model
- }
}
diff --git a/src/tests/pin.rs b/src/tests/pin.rs
index 551454c..7770fba 100644
--- a/src/tests/pin.rs
+++ b/src/tests/pin.rs
@@ -61,7 +61,7 @@ fn set_user(model: nitrokey::Model) -> anyhow::Result<()> {
{
let mut manager = nitrokey::force_take()?;
- let device = manager.connect_model(ncli.model().unwrap())?;
+ let device = manager.connect_model(model)?;
let _ = device
.authenticate_user(nitrokey::DEFAULT_USER_PIN)
.unwrap();
diff --git a/src/tests/reset.rs b/src/tests/reset.rs
index a7b2097..bf1e75b 100644
--- a/src/tests/reset.rs
+++ b/src/tests/reset.rs
@@ -20,7 +20,7 @@ fn reset(model: nitrokey::Model) -> anyhow::Result<()> {
{
let mut manager = nitrokey::force_take()?;
// Check that the admin PIN has been changed.
- let device = manager.connect_model(ncli.model().unwrap())?;
+ let device = manager.connect_model(model)?;
let _ = device.authenticate_admin(new_admin_pin).unwrap();
}
@@ -32,7 +32,7 @@ fn reset(model: nitrokey::Model) -> anyhow::Result<()> {
{
let mut manager = nitrokey::force_take()?;
// Check that the admin PIN has been reset.
- let device = manager.connect_model(ncli.model().unwrap())?;
+ let device = manager.connect_model(model)?;
let mut device = device
.authenticate_admin(nitrokey::DEFAULT_ADMIN_PIN)
.unwrap();