summaryrefslogtreecommitdiff
path: root/src/tests
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
commit24250081fe899b2f4ddfcf1fffc812e8c5e7b83e (patch)
tree698fa640cbb96ccba96f7b7b2d8de9fb5a52aa34 /src/tests
parent0b49693bb87248c1c7d61f5d48cdb3d6253b8ae3 (diff)
downloadnitrocli-24250081fe899b2f4ddfcf1fffc812e8c5e7b83e.tar.gz
nitrocli-24250081fe899b2f4ddfcf1fffc812e8c5e7b83e.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.
Diffstat (limited to 'src/tests')
-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();