From e12cf542e9d3d23c204b107985d4a6993e9f8cf4 Mon Sep 17 00:00:00 2001 From: Fabian Kaczmarczyck Date: Mon, 15 Jun 2020 23:03:26 +0200 Subject: [PATCH] adds a unit test for unknown commands --- src/ctap/mod.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ctap/mod.rs b/src/ctap/mod.rs index d554994..35bc487 100644 --- a/src/ctap/mod.rs +++ b/src/ctap/mod.rs @@ -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 {};