@@ -572,7 +572,7 @@ class NativeAuthControllerTest {
572572 }
573573
574574 @Test
575- fun testSubmitPasswordReturnMFARequiredIntrospectSuccess_checkAuthMethods () {
575+ fun testSubmitPasswordReturnMFARequiredIntrospectSuccess_checkEmailAuthMethod () {
576576 val correlationId = UUID .randomUUID().toString()
577577 MockApiUtils .configureMockApi(
578578 endpointType = MockApiEndpoint .SignInToken ,
@@ -588,8 +588,66 @@ class NativeAuthControllerTest {
588588
589589 val signInParameters = createSignInSubmitPasswordCommandParameters(correlationId)
590590 val signInResult = controller.signInSubmitPassword(signInParameters) as SignInCommandResult .MFARequired
591- assert (signInResult.authMethods.count() == 2 )
592591 assert (signInResult.authMethods.filter { it.challengeChannel == " email" }.count() == 1 )
592+ }
593+
594+ @Test
595+ fun testSubmitCodeReturnMFARequiredIntrospectSuccess_checkEmailAuthMethod () {
596+ val correlationId = UUID .randomUUID().toString()
597+ MockApiUtils .configureMockApi(
598+ endpointType = MockApiEndpoint .SignInToken ,
599+ correlationId = correlationId,
600+ responseType = MockApiResponseType .MFA_REQUIRED
601+ )
602+
603+ MockApiUtils .configureMockApi(
604+ endpointType = MockApiEndpoint .Introspect ,
605+ correlationId = correlationId,
606+ responseType = MockApiResponseType .INTROSPECT_SUCCESS
607+ )
608+
609+ val signInCodeParameters = createSignInSubmitCodeCommandParameters(correlationId)
610+ val signInResult = controller.signInSubmitCode(signInCodeParameters) as SignInCommandResult .MFARequired
611+ assert (signInResult.authMethods.filter { it.challengeChannel == " email" }.count() == 1 )
612+ }
613+
614+ @Test
615+ fun testSubmitCodeReturnMFARequiredIntrospectSuccess_checkSMSAuthMethod () {
616+ val correlationId = UUID .randomUUID().toString()
617+ MockApiUtils .configureMockApi(
618+ endpointType = MockApiEndpoint .SignInToken ,
619+ correlationId = correlationId,
620+ responseType = MockApiResponseType .MFA_REQUIRED
621+ )
622+
623+ MockApiUtils .configureMockApi(
624+ endpointType = MockApiEndpoint .Introspect ,
625+ correlationId = correlationId,
626+ responseType = MockApiResponseType .INTROSPECT_SMS_SUCCESS
627+ )
628+
629+ val signInCodeParameters = createSignInSubmitCodeCommandParameters(correlationId)
630+ val signInResult = controller.signInSubmitCode(signInCodeParameters) as SignInCommandResult .MFARequired
631+ assert (signInResult.authMethods.filter { it.challengeChannel == " sms" }.count() == 1 )
632+ }
633+
634+ @Test
635+ fun testSubmitPasswordReturnMFARequiredIntrospectSuccess_checkSMSAuthMethod () {
636+ val correlationId = UUID .randomUUID().toString()
637+ MockApiUtils .configureMockApi(
638+ endpointType = MockApiEndpoint .SignInToken ,
639+ correlationId = correlationId,
640+ responseType = MockApiResponseType .MFA_REQUIRED
641+ )
642+
643+ MockApiUtils .configureMockApi(
644+ endpointType = MockApiEndpoint .Introspect ,
645+ correlationId = correlationId,
646+ responseType = MockApiResponseType .INTROSPECT_SMS_SUCCESS
647+ )
648+
649+ val signInParameters = createSignInSubmitPasswordCommandParameters(correlationId)
650+ val signInResult = controller.signInSubmitPassword(signInParameters) as SignInCommandResult .MFARequired
593651 assert (signInResult.authMethods.filter { it.challengeChannel == " sms" }.count() == 1 )
594652 }
595653
0 commit comments