aboutsummaryrefslogtreecommitdiff
path: root/src/tests/encrypted.rs
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2020-08-24 18:04:20 -0700
committerDaniel Mueller <deso@posteo.net>2020-08-24 18:04:20 -0700
commitb114125dfbb4c97580ae076c07c6816ccdca51b8 (patch)
treea6663810c402dbd4f99f07e485872dd5f80702bf /src/tests/encrypted.rs
parent147d01663f9b95c6819d3c6afe8694cd291dbc3d (diff)
downloadnitrocli-b114125dfbb4c97580ae076c07c6816ccdca51b8.tar.gz
nitrocli-b114125dfbb4c97580ae076c07c6816ccdca51b8.tar.bz2
Introduce builder infrastructure for assembling Nitrocli instance
In the future we would like to provide more ways for tests to create a Nitrocli instance. In order to prevent explosion of with_XXX methods for each possible combination of arguments, this change introduces a Builder struct that can be used to create such an instance in an idiomatic way.
Diffstat (limited to 'src/tests/encrypted.rs')
-rw-r--r--src/tests/encrypted.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/tests/encrypted.rs b/src/tests/encrypted.rs
index aed2662..4705df6 100644
--- a/src/tests/encrypted.rs
+++ b/src/tests/encrypted.rs
@@ -44,7 +44,7 @@ $"#,
regex::Regex::new(&re).unwrap()
}
- let mut ncli = Nitrocli::with_model(model);
+ let mut ncli = Nitrocli::make().model(model).build();
let out = ncli.handle(&["status"])?;
assert!(make_re(None).is_match(&out), out);
@@ -61,7 +61,11 @@ $"#,
#[test_device(pro)]
fn encrypted_open_on_pro(model: nitrokey::Model) {
- let res = Nitrocli::with_model(model).handle(&["encrypted", "open"]);
+ let res = Nitrocli::make()
+ .model(model)
+ .build()
+ .handle(&["encrypted", "open"]);
+
assert_eq!(
res.unwrap_str_err(),
"This command is only available on the Nitrokey Storage",
@@ -70,7 +74,7 @@ fn encrypted_open_on_pro(model: nitrokey::Model) {
#[test_device(storage)]
fn encrypted_open_close(model: nitrokey::Model) -> crate::Result<()> {
- let mut ncli = Nitrocli::with_model(model);
+ let mut ncli = Nitrocli::make().model(model).build();
let out = ncli.handle(&["encrypted", "open"])?;
assert!(out.is_empty());