aboutsummaryrefslogtreecommitdiff
path: root/src/tests/pws.rs
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2020-07-09 19:01:52 -0700
committerDaniel Mueller <deso@posteo.net>2020-07-09 19:01:52 -0700
commit0328fc29bc56498e2312b68e04db828dd1186d23 (patch)
treeb1d9c02a9065236502b639e241733d91b2fe9a94 /src/tests/pws.rs
parent76dfd27ef163f44ef45688bf9d23332c822221dc (diff)
downloadnitrocli-0328fc29bc56498e2312b68e04db828dd1186d23.tar.gz
nitrocli-0328fc29bc56498e2312b68e04db828dd1186d23.tar.bz2
Remove UnwrapError test trait
This change wraps up the removal of the UnwrapError test trait. This step prepares us for the subsequent removal of the application's global Error enum type, in favor of the usage of anyhow's Error type.
Diffstat (limited to 'src/tests/pws.rs')
-rw-r--r--src/tests/pws.rs22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/tests/pws.rs b/src/tests/pws.rs
index 42cb847..7f8107e 100644
--- a/src/tests/pws.rs
+++ b/src/tests/pws.rs
@@ -96,13 +96,12 @@ fn set_reset_get(model: nitrokey::Model) -> crate::Result<()> {
assert_eq!(out, "");
let res = ncli.handle(&["pws", "get", "2"]);
- assert_eq!(
- res.unwrap_cmd_err(),
- (
- Some("Could not access PWS slot"),
- nitrokey::CommandError::SlotNotProgrammed
- )
+ let err = res.unwrap_err().to_string();
+ let expected = format!(
+ "Could not access PWS slot: {}",
+ nitrokey::Error::CommandError(nitrokey::CommandError::SlotNotProgrammed)
);
+ assert_eq!(err, expected);
Ok(())
}
@@ -113,12 +112,11 @@ fn clear(model: nitrokey::Model) -> crate::Result<()> {
let _ = ncli.handle(&["pws", "clear", "10"])?;
let res = ncli.handle(&["pws", "get", "10"]);
- assert_eq!(
- res.unwrap_cmd_err(),
- (
- Some("Could not access PWS slot"),
- nitrokey::CommandError::SlotNotProgrammed
- )
+ let err = res.unwrap_err().to_string();
+ let expected = format!(
+ "Could not access PWS slot: {}",
+ nitrokey::Error::CommandError(nitrokey::CommandError::SlotNotProgrammed)
);
+ assert_eq!(err, expected);
Ok(())
}