@@ -485,6 +485,7 @@ mod test {
485485 expected_result : Result < UsedPinUvAuthToken , Error > ,
486486 ) {
487487 let mut channel = MockChannel :: new ( ) ;
488+ let status_recv = channel. get_ux_update_receiver ( ) ;
488489 let info = create_info ( info_options, info_extensions) ;
489490 let info_req = CborRequest :: new ( Ctap2CommandCode :: AuthenticatorGetInfo ) ;
490491 let info_resp = CborResponse :: new_success_from_slice ( to_vec ( & info) . unwrap ( ) . as_slice ( ) ) ;
@@ -500,6 +501,8 @@ mod test {
500501 assert_eq ! ( resp, expected_result) ;
501502 // Nothing ended up in the auth store
502503 assert ! ( channel. get_auth_data( ) . is_none( ) ) ;
504+ // No updates should be sent, since we are exiting early
505+ assert ! ( status_recv. is_empty( ) ) ;
503506 }
504507
505508 #[ tokio:: test]
@@ -712,6 +715,7 @@ mod test {
712715 } ) ;
713716
714717 let mut channel = MockChannel :: new ( ) ;
718+ let status_recv = channel. get_ux_update_receiver ( ) ;
715719 let mut info = create_info ( & info_options, Some ( & [ "hmac-secret" ] ) ) ;
716720 info. pin_auth_protos = Some ( vec ! [ 1 ] ) ;
717721 let info_req = CborRequest :: new ( Ctap2CommandCode :: AuthenticatorGetInfo ) ;
@@ -746,6 +750,8 @@ mod test {
746750 assert ! ( channel. get_auth_data( ) . is_some( ) ) ;
747751 assert ! ( channel. get_auth_data( ) . unwrap( ) . pin_uv_auth_token. is_none( ) ) ;
748752 assert ! ( !channel. get_auth_data( ) . unwrap( ) . shared_secret. is_empty( ) ) ;
753+ // No updates should be sent, since we are only doing shared_secret
754+ assert ! ( status_recv. is_empty( ) ) ;
749755 }
750756 }
751757
@@ -777,6 +783,8 @@ mod test {
777783
778784 let mut channel = MockChannel :: new ( ) ;
779785
786+ let mut status_recv = channel. get_ux_update_receiver ( ) ;
787+
780788 // Queueing GetInfo request and response
781789 let mut info = create_info ( & info_options, Some ( & [ "hmac-secret" ] ) ) ;
782790 info. pin_auth_protos = Some ( vec ! [ 1 ] ) ;
@@ -856,6 +864,8 @@ mod test {
856864 channel. get_auth_data( ) . unwrap( ) . shared_secret,
857865 shared_secret
858866 ) ;
867+ // No updates should be sent, since we are exiting early
868+ assert_eq ! ( status_recv. recv( ) . await , Ok ( UvUpdate :: PresenceRequired ) ) ;
859869 }
860870 }
861871
@@ -962,13 +972,14 @@ mod test {
962972 channel. push_command_pair ( pin_req, pin_resp) ;
963973
964974 let mut recv = channel. get_ux_update_receiver ( ) ;
965- tokio:: task:: spawn ( async move {
975+ let recv_handle = tokio:: task:: spawn ( async move {
966976 let req = recv. recv ( ) . await . unwrap ( ) ;
967977 if let UvUpdate :: PinRequired ( update) = req {
968978 update. send_pin ( "1234" ) . unwrap ( ) ;
969979 } else {
970980 panic ! ( "Wrong UxUpdate received! Expected PinRequired" ) ;
971981 }
982+ recv
972983 } ) ;
973984
974985 let resp =
@@ -991,6 +1002,9 @@ mod test {
9911002 channel. get_auth_data( ) . unwrap( ) . shared_secret,
9921003 shared_secret
9931004 ) ;
1005+ let recv = recv_handle. await . expect ( "Failed to join update thread" ) ;
1006+ // No more updates should be sent
1007+ assert ! ( recv. is_empty( ) ) ;
9941008 }
9951009 }
9961010}
0 commit comments