aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2019-01-09 15:14:11 +0000
committerRobin Krahl <robin.krahl@ireas.org>2019-01-09 16:16:58 +0100
commit77ab66e0c0aca2ee77b64297eeaf609922f2007b (patch)
tree33d3f94e4b4c4a2b65bf34bb2d05bec0c93db2cf /tests
parenteb1960b1dbaa4432eb65c7f00689146c815db823 (diff)
downloadnitrokey-rs-77ab66e0c0aca2ee77b64297eeaf609922f2007b.tar.gz
nitrokey-rs-77ab66e0c0aca2ee77b64297eeaf609922f2007b.tar.bz2
Check InvalidHexString error in otp test suite
Diffstat (limited to 'tests')
-rw-r--r--tests/otp.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/otp.rs b/tests/otp.rs
index fcf0020..712f7a2 100644
--- a/tests/otp.rs
+++ b/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());
}
@@ -266,6 +271,11 @@ fn totp_error(device: DeviceWrapper) {
Err(CommandError::InvalidSlot),
admin.write_totp_slot(slot_data, 0)
);
+ 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());
}