diff options
author | Daniel Mueller <deso@posteo.net> | 2020-08-24 18:04:20 -0700 |
---|---|---|
committer | Daniel Mueller <deso@posteo.net> | 2020-08-24 18:04:20 -0700 |
commit | b114125dfbb4c97580ae076c07c6816ccdca51b8 (patch) | |
tree | a6663810c402dbd4f99f07e485872dd5f80702bf /src/tests/pin.rs | |
parent | 147d01663f9b95c6819d3c6afe8694cd291dbc3d (diff) | |
download | nitrocli-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/pin.rs')
-rw-r--r-- | src/tests/pin.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/tests/pin.rs b/src/tests/pin.rs index 958a36d..87c9064 100644 --- a/src/tests/pin.rs +++ b/src/tests/pin.rs @@ -35,7 +35,10 @@ fn unblock(model: nitrokey::Model) -> crate::Result<()> { assert!(device.get_user_retry_count()? < 3); } - let _ = Nitrocli::with_model(model).handle(&["pin", "unblock"])?; + let _ = Nitrocli::make() + .model(model) + .build() + .handle(&["pin", "unblock"])?; { let mut manager = nitrokey::force_take()?; @@ -47,7 +50,7 @@ fn unblock(model: nitrokey::Model) -> crate::Result<()> { #[test_device] fn set_user(model: nitrokey::Model) -> crate::Result<()> { - let mut ncli = Nitrocli::with_model(model); + let mut ncli = Nitrocli::make().model(model).build(); // Set a new user PIN. ncli.new_user_pin("new-pin"); let out = ncli.handle(&["pin", "set", "user"])?; |