-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove unwrap_str_err method from UnwrapError test trait
With upcoming changes we intend to move towards a model where we do not distinguish the individual error variants the program deals with in a global enum. In preparation of such a change, this patch marks a first step in removing the UnwrapError test trait, which relies on the existence of exactly such typed errors. In particular, we remove the unwrap_str_err method from it, basically falling back to just working with strings.
- Loading branch information
Showing
4 changed files
with
13 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// encrypted.rs | ||
|
||
// ************************************************************************* | ||
// * Copyright (C) 2019 Daniel Mueller ([email protected]) * | ||
// * Copyright (C) 2019-2020 Daniel Mueller ([email protected]) * | ||
// * * | ||
// * This program is free software: you can redistribute it and/or modify * | ||
// * it under the terms of the GNU General Public License as published by * | ||
|
@@ -61,9 +61,12 @@ $"#, | |
|
||
#[test_device(pro)] | ||
fn encrypted_open_on_pro(model: nitrokey::Model) { | ||
let res = Nitrocli::with_model(model).handle(&["encrypted", "open"]); | ||
let err = Nitrocli::with_model(model) | ||
.handle(&["encrypted", "open"]) | ||
.unwrap_err() | ||
.to_string(); | ||
assert_eq!( | ||
res.unwrap_str_err(), | ||
err, | ||
"This command is only available on the Nitrokey Storage", | ||
); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// status.rs | ||
|
||
// ************************************************************************* | ||
// * Copyright (C) 2019 Daniel Mueller ([email protected]) * | ||
// * Copyright (C) 2019-2020 Daniel Mueller ([email protected]) * | ||
// * * | ||
// * This program is free software: you can redistribute it and/or modify * | ||
// * it under the terms of the GNU General Public License as published by * | ||
|
@@ -33,7 +33,8 @@ fn not_found_raw() { | |
#[test_device] | ||
fn not_found() { | ||
let res = Nitrocli::new().handle(&["status"]); | ||
assert_eq!(res.unwrap_str_err(), "Nitrokey device not found"); | ||
let err = res.unwrap_err().to_string(); | ||
assert_eq!(err, "Nitrokey device not found"); | ||
} | ||
|
||
#[test_device(pro)] | ||
|