diff options
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/config.rs | 4 | ||||
-rw-r--r-- | src/tests/encrypted.rs | 4 | ||||
-rw-r--r-- | src/tests/hidden.rs | 4 | ||||
-rw-r--r-- | src/tests/list.rs | 4 | ||||
-rw-r--r-- | src/tests/lock.rs | 6 | ||||
-rw-r--r-- | src/tests/mod.rs | 2 | ||||
-rw-r--r-- | src/tests/otp.rs | 10 | ||||
-rw-r--r-- | src/tests/pin.rs | 6 | ||||
-rw-r--r-- | src/tests/pws.rs | 8 | ||||
-rw-r--r-- | src/tests/reset.rs | 4 | ||||
-rw-r--r-- | src/tests/status.rs | 4 | ||||
-rw-r--r-- | src/tests/unencrypted.rs | 4 |
12 files changed, 30 insertions, 30 deletions
diff --git a/src/tests/config.rs b/src/tests/config.rs index 3542ecf..ad1fb12 100644 --- a/src/tests/config.rs +++ b/src/tests/config.rs @@ -37,7 +37,7 @@ fn mutually_exclusive_set_options() { } #[test_device] -fn get(model: nitrokey::Model) -> crate::Result<()> { +fn get(model: nitrokey::Model) -> anyhow::Result<()> { let re = regex::Regex::new( r#"^Config: numlock binding: (not set|\d+) @@ -66,7 +66,7 @@ fn set_wrong_usage(model: nitrokey::Model) { } #[test_device] -fn set_get(model: nitrokey::Model) -> crate::Result<()> { +fn set_get(model: nitrokey::Model) -> anyhow::Result<()> { let mut ncli = Nitrocli::with_model(model); let _ = ncli.handle(&["config", "set", "-s", "1", "-c", "0", "-N"])?; diff --git a/src/tests/encrypted.rs b/src/tests/encrypted.rs index a47c3c9..fb00ea2 100644 --- a/src/tests/encrypted.rs +++ b/src/tests/encrypted.rs @@ -20,7 +20,7 @@ use super::*; #[test_device(storage)] -fn status_open_close(model: nitrokey::Model) -> crate::Result<()> { +fn status_open_close(model: nitrokey::Model) -> anyhow::Result<()> { fn make_re(open: Option<bool>) -> regex::Regex { let encrypted = match open { Some(open) => { @@ -72,7 +72,7 @@ fn encrypted_open_on_pro(model: nitrokey::Model) { } #[test_device(storage)] -fn encrypted_open_close(model: nitrokey::Model) -> crate::Result<()> { +fn encrypted_open_close(model: nitrokey::Model) -> anyhow::Result<()> { let mut ncli = Nitrocli::with_model(model); let out = ncli.handle(&["encrypted", "open"])?; assert!(out.is_empty()); diff --git a/src/tests/hidden.rs b/src/tests/hidden.rs index eabcfd4..6e08c1b 100644 --- a/src/tests/hidden.rs +++ b/src/tests/hidden.rs @@ -1,7 +1,7 @@ // hidden.rs // ************************************************************************* -// * Copyright (C) 2019 Daniel Mueller (deso@posteo.net) * +// * Copyright (C) 2019-2020 Daniel Mueller (deso@posteo.net) * // * * // * 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 * @@ -20,7 +20,7 @@ use super::*; #[test_device(storage)] -fn hidden_create_open_close(model: nitrokey::Model) -> crate::Result<()> { +fn hidden_create_open_close(model: nitrokey::Model) -> anyhow::Result<()> { let mut ncli = Nitrocli::with_model(model); let out = ncli.handle(&["hidden", "create", "0", "50", "100"])?; assert!(out.is_empty()); diff --git a/src/tests/list.rs b/src/tests/list.rs index 4f80afe..e8bd819 100644 --- a/src/tests/list.rs +++ b/src/tests/list.rs @@ -20,7 +20,7 @@ use super::*; #[test_device] -fn not_connected() -> crate::Result<()> { +fn not_connected() -> anyhow::Result<()> { let res = Nitrocli::new().handle(&["list"])?; assert_eq!(res, "No Nitrokey device connected\n"); @@ -28,7 +28,7 @@ fn not_connected() -> crate::Result<()> { } #[test_device] -fn connected(model: nitrokey::Model) -> crate::Result<()> { +fn connected(model: nitrokey::Model) -> anyhow::Result<()> { let re = regex::Regex::new( r#"^device path\tmodel\tserial number ([[:^space:]]+\t(Pro|Storage|unknown)\t0x[[:xdigit:]]+ diff --git a/src/tests/lock.rs b/src/tests/lock.rs index b29f394..cb4962c 100644 --- a/src/tests/lock.rs +++ b/src/tests/lock.rs @@ -1,7 +1,7 @@ // lock.rs // ************************************************************************* -// * Copyright (C) 2019 Daniel Mueller (deso@posteo.net) * +// * Copyright (C) 2019-2020 Daniel Mueller (deso@posteo.net) * // * * // * 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 * @@ -20,7 +20,7 @@ use super::*; #[test_device(pro)] -fn lock_pro(model: nitrokey::Model) -> crate::Result<()> { +fn lock_pro(model: nitrokey::Model) -> anyhow::Result<()> { // We can't really test much more here than just success of the command. let out = Nitrocli::with_model(model).handle(&["lock"])?; assert!(out.is_empty()); @@ -29,7 +29,7 @@ fn lock_pro(model: nitrokey::Model) -> crate::Result<()> { } #[test_device(storage)] -fn lock_storage(model: nitrokey::Model) -> crate::Result<()> { +fn lock_storage(model: nitrokey::Model) -> anyhow::Result<()> { let mut ncli = Nitrocli::with_model(model); let _ = ncli.handle(&["encrypted", "open"])?; diff --git a/src/tests/mod.rs b/src/tests/mod.rs index 878a26f..f26ab80 100644 --- a/src/tests/mod.rs +++ b/src/tests/mod.rs @@ -127,7 +127,7 @@ impl Nitrocli { } /// Run `nitrocli`'s `handle_arguments` function. - pub fn handle(&mut self, args: &[&str]) -> crate::Result<String> { + pub fn handle(&mut self, args: &[&str]) -> anyhow::Result<String> { let (res, out, _) = self.do_run(args, |c, a| crate::handle_arguments(c, a)); res.map(|_| String::from_utf8_lossy(&out).into_owned()) } diff --git a/src/tests/otp.rs b/src/tests/otp.rs index 65c1cb5..f94df2d 100644 --- a/src/tests/otp.rs +++ b/src/tests/otp.rs @@ -42,7 +42,7 @@ fn set_invalid_slot(model: nitrokey::Model) { } #[test_device] -fn status(model: nitrokey::Model) -> crate::Result<()> { +fn status(model: nitrokey::Model) -> anyhow::Result<()> { let re = regex::Regex::new( r#"^alg\tslot\tname ((totp|hotp)\t\d+\t.+\n)+$"#, @@ -60,7 +60,7 @@ fn status(model: nitrokey::Model) -> crate::Result<()> { } #[test_device] -fn set_get_hotp(model: nitrokey::Model) -> crate::Result<()> { +fn set_get_hotp(model: nitrokey::Model) -> anyhow::Result<()> { // Secret and expected HOTP values as per RFC 4226: Appendix D -- HOTP // Algorithm: Test Values. const SECRET: &str = "12345678901234567890"; @@ -81,7 +81,7 @@ fn set_get_hotp(model: nitrokey::Model) -> crate::Result<()> { } #[test_device] -fn set_get_totp(model: nitrokey::Model) -> crate::Result<()> { +fn set_get_totp(model: nitrokey::Model) -> anyhow::Result<()> { // Secret and expected TOTP values as per RFC 6238: Appendix B -- // Test Vectors. const SECRET: &str = "12345678901234567890"; @@ -97,7 +97,7 @@ fn set_get_totp(model: nitrokey::Model) -> crate::Result<()> { } #[test_device] -fn set_totp_uneven_chars(model: nitrokey::Model) -> crate::Result<()> { +fn set_totp_uneven_chars(model: nitrokey::Model) -> anyhow::Result<()> { let secrets = [ (args::OtpSecretFormat::Hex, "123"), (args::OtpSecretFormat::Base32, "FBILDWWGA2"), @@ -111,7 +111,7 @@ fn set_totp_uneven_chars(model: nitrokey::Model) -> crate::Result<()> { } #[test_device] -fn clear(model: nitrokey::Model) -> crate::Result<()> { +fn clear(model: nitrokey::Model) -> anyhow::Result<()> { let mut ncli = Nitrocli::with_model(model); let _ = ncli.handle(&["otp", "set", "3", "hotp-test", "abcdef"])?; let _ = ncli.handle(&["otp", "clear", "3"])?; diff --git a/src/tests/pin.rs b/src/tests/pin.rs index 958a36d..cfcd0f6 100644 --- a/src/tests/pin.rs +++ b/src/tests/pin.rs @@ -1,7 +1,7 @@ // pin.rs // ************************************************************************* -// * Copyright (C) 2019 Daniel Mueller (deso@posteo.net) * +// * Copyright (C) 2019-2020 Daniel Mueller (deso@posteo.net) * // * * // * 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 * @@ -23,7 +23,7 @@ use nitrokey::Device; use super::*; #[test_device] -fn unblock(model: nitrokey::Model) -> crate::Result<()> { +fn unblock(model: nitrokey::Model) -> anyhow::Result<()> { { let mut manager = nitrokey::force_take()?; let device = manager.connect_model(model)?; @@ -46,7 +46,7 @@ fn unblock(model: nitrokey::Model) -> crate::Result<()> { } #[test_device] -fn set_user(model: nitrokey::Model) -> crate::Result<()> { +fn set_user(model: nitrokey::Model) -> anyhow::Result<()> { let mut ncli = Nitrocli::with_model(model); // Set a new user PIN. ncli.new_user_pin("new-pin"); diff --git a/src/tests/pws.rs b/src/tests/pws.rs index 910ef92..238ce28 100644 --- a/src/tests/pws.rs +++ b/src/tests/pws.rs @@ -30,7 +30,7 @@ fn set_invalid_slot(model: nitrokey::Model) { } #[test_device] -fn status(model: nitrokey::Model) -> crate::Result<()> { +fn status(model: nitrokey::Model) -> anyhow::Result<()> { let re = regex::Regex::new( r#"^slot\tname (\d+\t.+\n)+$"#, @@ -48,7 +48,7 @@ fn status(model: nitrokey::Model) -> crate::Result<()> { } #[test_device] -fn set_get(model: nitrokey::Model) -> crate::Result<()> { +fn set_get(model: nitrokey::Model) -> anyhow::Result<()> { const NAME: &str = "dropbox"; const LOGIN: &str = "d-e-s-o"; const PASSWORD: &str = "my-secret-password"; @@ -80,7 +80,7 @@ fn set_get(model: nitrokey::Model) -> crate::Result<()> { } #[test_device] -fn set_reset_get(model: nitrokey::Model) -> crate::Result<()> { +fn set_reset_get(model: nitrokey::Model) -> anyhow::Result<()> { const NAME: &str = "some/svc"; const LOGIN: &str = "a\\user"; const PASSWORD: &str = "!@&-)*(&+%^@"; @@ -98,7 +98,7 @@ fn set_reset_get(model: nitrokey::Model) -> crate::Result<()> { } #[test_device] -fn clear(model: nitrokey::Model) -> crate::Result<()> { +fn clear(model: nitrokey::Model) -> anyhow::Result<()> { let mut ncli = Nitrocli::with_model(model); let _ = ncli.handle(&["pws", "set", "10", "clear-test", "some-login", "abcdef"])?; let _ = ncli.handle(&["pws", "clear", "10"])?; diff --git a/src/tests/reset.rs b/src/tests/reset.rs index e197970..c7492da 100644 --- a/src/tests/reset.rs +++ b/src/tests/reset.rs @@ -1,7 +1,7 @@ // reset.rs // ************************************************************************* -// * Copyright (C) 2019 Robin Krahl (robin.krahl@ireas.org) * +// * Copyright (C) 2019-2020 Robin Krahl (robin.krahl@ireas.org) * // * * // * 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 * @@ -23,7 +23,7 @@ use nitrokey::GetPasswordSafe; use super::*; #[test_device] -fn reset(model: nitrokey::Model) -> crate::Result<()> { +fn reset(model: nitrokey::Model) -> anyhow::Result<()> { let new_admin_pin = "87654321"; let mut ncli = Nitrocli::with_model(model); diff --git a/src/tests/status.rs b/src/tests/status.rs index c617a9e..c944cbb 100644 --- a/src/tests/status.rs +++ b/src/tests/status.rs @@ -41,7 +41,7 @@ fn not_found() { } #[test_device(pro)] -fn output_pro(model: nitrokey::Model) -> crate::Result<()> { +fn output_pro(model: nitrokey::Model) -> anyhow::Result<()> { let re = regex::Regex::new( r#"^Status: model: Pro @@ -59,7 +59,7 @@ $"#, } #[test_device(storage)] -fn output_storage(model: nitrokey::Model) -> crate::Result<()> { +fn output_storage(model: nitrokey::Model) -> anyhow::Result<()> { let re = regex::Regex::new( r#"^Status: model: Storage diff --git a/src/tests/unencrypted.rs b/src/tests/unencrypted.rs index ceeb17c..2fd92a0 100644 --- a/src/tests/unencrypted.rs +++ b/src/tests/unencrypted.rs @@ -1,7 +1,7 @@ // unencrypted.rs // ************************************************************************* -// * Copyright (C) 2019 Daniel Mueller (deso@posteo.net) * +// * Copyright (C) 2019-2020 Daniel Mueller (deso@posteo.net) * // * * // * 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 * @@ -20,7 +20,7 @@ use super::*; #[test_device(storage)] -fn unencrypted_set_read_write(model: nitrokey::Model) -> crate::Result<()> { +fn unencrypted_set_read_write(model: nitrokey::Model) -> anyhow::Result<()> { let mut ncli = Nitrocli::with_model(model); let out = ncli.handle(&["unencrypted", "set", "read-write"])?; assert!(out.is_empty()); |