adds a unit test for unknown commands

This commit is contained in:
Fabian Kaczmarczyck
2020-06-15 23:03:26 +02:00
parent c3f57f0121
commit e12cf542e9

View File

@@ -1714,6 +1714,18 @@ mod test {
);
}
#[test]
fn test_process_unknown_command() {
let mut rng = ThreadRng256 {};
let user_immediately_present = |_| Ok(());
let mut ctap_state = CtapState::new(&mut rng, user_immediately_present);
// This command does not exist.
let reset_reponse = ctap_state.process_command(&[0xDF], DUMMY_CHANNEL_ID);
let expected_response = vec![Ctap2StatusCode::CTAP1_ERR_INVALID_COMMAND as u8];
assert_eq!(reset_reponse, expected_response);
}
#[test]
fn test_encrypt_decrypt_credential() {
let mut rng = ThreadRng256 {};