summaryrefslogtreecommitdiff
path: root/nitrokey/tests/otp.rs
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2019-01-05 16:04:49 -0800
committerDaniel Mueller <deso@posteo.net>2019-01-05 16:04:49 -0800
commitd9adac05dfa5de83465fde3479df4fd898ebd8bd (patch)
tree3bcb5585b4f821250276d6bf1eadd05f1748d016 /nitrokey/tests/otp.rs
parentbbb54f26c6101225a4f79f2f7f89cf5d71a62dd1 (diff)
downloadnitrocli-d9adac05dfa5de83465fde3479df4fd898ebd8bd.tar.gz
nitrocli-d9adac05dfa5de83465fde3479df4fd898ebd8bd.tar.bz2
Update nitrokey crate to 0.3.0
This change updates the nitrokey crate to version 0.3.0. Import subrepo nitrokey/:nitrokey at 3593df8844b80741e2d33c8e5af80e65760dc058
Diffstat (limited to 'nitrokey/tests/otp.rs')
-rw-r--r--nitrokey/tests/otp.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/nitrokey/tests/otp.rs b/nitrokey/tests/otp.rs
index 8e7ae08..c7d6e68 100644
--- a/nitrokey/tests/otp.rs
+++ b/nitrokey/tests/otp.rs
@@ -55,6 +55,16 @@ fn check_hotp_codes(device: &GenerateOtp, offset: u8) {
#[test]
#[cfg_attr(not(any(feature = "test-pro", feature = "test-storage")), ignore)]
+fn set_time() {
+ let device = Target::connect().expect("Could not connect to the Nitrokey.");
+ assert_eq!(Ok(()), device.set_time(1546385382, true));
+ assert_eq!(Ok(()), device.set_time(1546385392, false));
+ assert_eq!(Err(CommandError::Timestamp), device.set_time(1546385292, false));
+ assert_eq!(Ok(()), device.set_time(1546385382, true));
+}
+
+#[test]
+#[cfg_attr(not(any(feature = "test-pro", feature = "test-storage")), ignore)]
fn hotp_no_pin() {
let admin = get_admin_test_device();
let config = Config::new(None, None, None, false);
@@ -152,7 +162,7 @@ fn check_totp_codes(device: &GenerateOtp, factor: u64, timestamp_size: TotpTimes
continue;
}
- assert!(device.set_time(time).is_ok());
+ assert!(device.set_time(time, true).is_ok());
let result = device.get_totp_code(1);
assert!(result.is_ok());
let result_code = result.unwrap();