diff options
author | Daniel Mueller <deso@posteo.net> | 2019-01-12 13:24:21 -0800 |
---|---|---|
committer | Daniel Mueller <deso@posteo.net> | 2019-01-12 13:24:21 -0800 |
commit | 541819637e0bec0b58b32ed0721d51610a8a7d3b (patch) | |
tree | f0d7d270a4eaca1025709d02a508ef638fb076cf /nitrokey/tests/otp.rs | |
parent | 16ed68c0f5e3ccb330c7a5f7c11781bc7a129b03 (diff) | |
download | nitrocli-541819637e0bec0b58b32ed0721d51610a8a7d3b.tar.gz nitrocli-541819637e0bec0b58b32ed0721d51610a8a7d3b.tar.bz2 |
Update nitrokey crate to 0.3.2
This change updates the nitrokey crate to version 0.3.2.
Import subrepo nitrokey/:nitrokey at 6ea73f29daa5db0215663a0a38334b764863671d
Diffstat (limited to 'nitrokey/tests/otp.rs')
-rw-r--r-- | nitrokey/tests/otp.rs | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/nitrokey/tests/otp.rs b/nitrokey/tests/otp.rs index 2b46088..712f7a2 100644 --- a/nitrokey/tests/otp.rs +++ b/nitrokey/tests/otp.rs @@ -125,6 +125,11 @@ fn hotp_error(device: DeviceWrapper) { Err(CommandError::InvalidSlot), admin.write_hotp_slot(slot_data, 0) ); + let slot_data = OtpSlotData::new(1, "test", "foobar", OtpMode::SixDigits); + assert_eq!( + Err(CommandError::InvalidHexString), + admin.write_hotp_slot(slot_data, 0) + ); let code = admin.get_hotp_code(4); assert_eq!(CommandError::InvalidSlot, code.unwrap_err()); } @@ -256,17 +261,22 @@ fn totp_slot_name(device: DeviceWrapper) { #[test_device] fn totp_error(device: DeviceWrapper) { let admin = make_admin_test_device(device); - let slot_data = OtpSlotData::new(1, "", HOTP_SECRET, OtpMode::SixDigits); + let slot_data = OtpSlotData::new(1, "", TOTP_SECRET, OtpMode::SixDigits); assert_eq!( Err(CommandError::NoName), - admin.write_hotp_slot(slot_data, 0) + admin.write_totp_slot(slot_data, 0) ); - let slot_data = OtpSlotData::new(4, "test", HOTP_SECRET, OtpMode::SixDigits); + let slot_data = OtpSlotData::new(20, "test", TOTP_SECRET, OtpMode::SixDigits); assert_eq!( Err(CommandError::InvalidSlot), - admin.write_hotp_slot(slot_data, 0) + admin.write_totp_slot(slot_data, 0) ); - let code = admin.get_hotp_code(4); + let slot_data = OtpSlotData::new(4, "test", "foobar", OtpMode::SixDigits); + assert_eq!( + Err(CommandError::InvalidHexString), + admin.write_totp_slot(slot_data, 0) + ); + let code = admin.get_totp_code(20); assert_eq!(CommandError::InvalidSlot, code.unwrap_err()); } |