From bd75314ba92bead84df2b65e7e3fa1ffe4bd654a Mon Sep 17 00:00:00 2001 From: yuxin Date: Tue, 26 Nov 2024 11:13:47 +0000 Subject: [PATCH] ALl test cases apply new AbstractTest to extract configuration initialisation outside --- .../tests/network/nativeauth/GetTokenTests.kt | 11 +- ...AuthPublicClientApplicationAbstractTest.kt | 24 ++- ...licClientApplicationAnotherAbstractTest.kt | 156 ------------------ .../e2e/tests/network/nativeauth/SSPRTest.kt | 14 +- .../network/nativeauth/SignInEmailOTPTest.kt | 14 +- .../nativeauth/SignInEmailPasswordTest.kt | 14 +- .../tests/network/nativeauth/SignInMFATest.kt | 14 +- .../SignUpEmailOTPAttributesTest.kt | 14 +- .../network/nativeauth/SignUpEmailOTPTest.kt | 2 +- .../SignUpEmailPasswordAttributesTest.kt | 14 +- .../nativeauth/SignUpEmailPasswordTest.kt | 4 +- 11 files changed, 95 insertions(+), 186 deletions(-) delete mode 100644 msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/NativeAuthPublicClientApplicationAnotherAbstractTest.kt diff --git a/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/GetTokenTests.kt b/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/GetTokenTests.kt index f933a2362..a73348796 100644 --- a/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/GetTokenTests.kt +++ b/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/GetTokenTests.kt @@ -27,6 +27,7 @@ import com.microsoft.identity.client.e2e.shadows.ShadowBaseController import com.microsoft.identity.client.e2e.utils.assertResult import com.microsoft.identity.internal.testutils.nativeauth.ConfigType import com.microsoft.identity.internal.testutils.nativeauth.api.models.NativeAuthTestConfig +import com.microsoft.identity.nativeauth.INativeAuthPublicClientApplication import com.microsoft.identity.nativeauth.statemachine.errors.GetAccessTokenError import com.microsoft.identity.nativeauth.statemachine.errors.SignInError import com.microsoft.identity.nativeauth.statemachine.results.GetAccessTokenResult @@ -41,13 +42,19 @@ class GetTokenTests : NativeAuthPublicClientApplicationAbstractTest() { private lateinit var resources: List + lateinit var application: INativeAuthPublicClientApplication + lateinit var config: NativeAuthTestConfig.Config + + private val defaultConfigType = ConfigType.SIGN_IN_PASSWORD + private val defaultChallengeTypes = listOf("password", "oob") + override fun setup() { super.setup() + config = getConfig(defaultConfigType) + application = setupPCA(config, defaultChallengeTypes) resources = config.resources } - override val defaultConfigType = ConfigType.SIGN_IN_PASSWORD - /** * Signing in with an invalid scope should make the API and the SDK return an error. */ diff --git a/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/NativeAuthPublicClientApplicationAbstractTest.kt b/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/NativeAuthPublicClientApplicationAbstractTest.kt index 3cd0b0411..0723c9d94 100644 --- a/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/NativeAuthPublicClientApplicationAbstractTest.kt +++ b/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/NativeAuthPublicClientApplicationAbstractTest.kt @@ -27,7 +27,6 @@ import android.content.Context import androidx.test.core.app.ApplicationProvider import com.google.gson.Gson import com.google.gson.reflect.TypeToken -import com.microsoft.identity.client.Logger import com.microsoft.identity.client.PublicClientApplication import com.microsoft.identity.client.e2e.shadows.ShadowAndroidSdkStorageEncryptionManager import com.microsoft.identity.client.e2e.tests.IPublicClientApplicationTest @@ -60,12 +59,12 @@ import org.robolectric.annotation.LooperMode abstract class NativeAuthPublicClientApplicationAbstractTest : IPublicClientApplicationTest { companion object{ const val SHARED_PREFERENCES_NAME = "com.microsoft.identity.client.account_credential_cache" + const val INVALID_EMAIL = "invalid_email" + const val INVALID_PASSWORD = "invalid_password" } private lateinit var context: Context private lateinit var activity: Activity - lateinit var application: INativeAuthPublicClientApplication - lateinit var config: NativeAuthTestConfig.Config // Remove default Coroutine test timeout of 10 seconds. private val testDispatcher = StandardTestDispatcher() @@ -74,19 +73,13 @@ abstract class NativeAuthPublicClientApplicationAbstractTest : IPublicClientAppl return "" // Not needed for native auth flows } - abstract val defaultConfigType: ConfigType - @Before open fun setup() { context = ApplicationProvider.getApplicationContext() activity = Mockito.mock(Activity::class.java) Mockito.`when`(activity.applicationContext).thenReturn(context) - Logger.getInstance().setEnableLogcatLog(true) - Logger.getInstance().setEnablePII(true) - Logger.getInstance().setLogLevel(Logger.LogLevel.VERBOSE) CommandDispatcherHelper.clear() Dispatchers.setMain(testDispatcher) - setupPCA(defaultConfigType) } @After @@ -114,13 +107,15 @@ abstract class NativeAuthPublicClientApplicationAbstractTest : IPublicClientAppl return Gson().fromJson(secretValue, type) } - fun setupPCA(configType: ConfigType) { + fun getConfig(configType: ConfigType): NativeAuthTestConfig.Config { val secretValue = getConfigsThroughSecretValue() - config = secretValue?.get(configType.stringValue) ?: throw IllegalStateException("Config not $secretValue") - val challengeTypes = listOf("password", "oob") + return secretValue?.get(configType.stringValue) + ?: throw IllegalStateException("Config not $secretValue") + } - try { - application = PublicClientApplication.createNativeAuthPublicClientApplication( + fun setupPCA(config: NativeAuthTestConfig.Config, challengeTypes: List): INativeAuthPublicClientApplication { + return try { + PublicClientApplication.createNativeAuthPublicClientApplication( context, config.clientId, config.authorityUrl, @@ -129,6 +124,7 @@ abstract class NativeAuthPublicClientApplicationAbstractTest : IPublicClientAppl ) } catch (e: MsalException) { Assert.fail(e.message) + throw e } } diff --git a/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/NativeAuthPublicClientApplicationAnotherAbstractTest.kt b/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/NativeAuthPublicClientApplicationAnotherAbstractTest.kt deleted file mode 100644 index c9c74280a..000000000 --- a/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/NativeAuthPublicClientApplicationAnotherAbstractTest.kt +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// All rights reserved. -// -// This code is licensed under the MIT License. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files(the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions : -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -package com.microsoft.identity.client.e2e.tests.network.nativeauth - -import android.app.Activity -import android.content.Context -import androidx.test.core.app.ApplicationProvider -import com.google.gson.Gson -import com.google.gson.reflect.TypeToken -import com.microsoft.identity.client.ILoggerCallback -import com.microsoft.identity.client.Logger -import com.microsoft.identity.client.PublicClientApplication -import com.microsoft.identity.client.e2e.shadows.ShadowAndroidSdkStorageEncryptionManager -import com.microsoft.identity.client.e2e.tests.IPublicClientApplicationTest -import com.microsoft.identity.client.exception.MsalException -import com.microsoft.identity.common.internal.controllers.CommandDispatcherHelper -import com.microsoft.identity.internal.testutils.TestUtils -import com.microsoft.identity.internal.testutils.labutils.KeyVaultFetchHelper -import com.microsoft.identity.internal.testutils.labutils.LabConstants -import com.microsoft.identity.internal.testutils.labutils.LabUserHelper -import com.microsoft.identity.internal.testutils.labutils.LabUserQuery -import com.microsoft.identity.internal.testutils.nativeauth.ConfigType -import com.microsoft.identity.internal.testutils.nativeauth.api.models.NativeAuthTestConfig -import com.microsoft.identity.nativeauth.INativeAuthPublicClientApplication -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.test.StandardTestDispatcher -import kotlinx.coroutines.test.setMain -import org.junit.After -import org.junit.Assert -import org.junit.Before -import org.junit.runner.RunWith -import org.mockito.Mockito -import org.robolectric.RobolectricTestRunner -import org.robolectric.annotation.Config -import org.robolectric.annotation.LooperMode - -// TODO: move to "PAUSED". A work in RoboTestUtils will be needed though. -@LooperMode(LooperMode.Mode.LEGACY) -@RunWith(RobolectricTestRunner::class) -@Config(shadows = [ShadowAndroidSdkStorageEncryptionManager::class]) -abstract class NativeAuthPublicClientApplicationAnotherAbstractTest : IPublicClientApplicationTest { - companion object{ - const val SHARED_PREFERENCES_NAME = "com.microsoft.identity.client.account_credential_cache" - const val INVALID_EMAIL = "invalid_email" - const val INVALID_PASSWORD = "invalid_password" - } - - private lateinit var context: Context - private lateinit var activity: Activity - - // Remove default Coroutine test timeout of 10 seconds. - private val testDispatcher = StandardTestDispatcher() - - override fun getConfigFilePath(): String { - return "" // Not needed for native auth flows - } - - @Before - open fun setup() { - context = ApplicationProvider.getApplicationContext() - activity = Mockito.mock(Activity::class.java) - Mockito.`when`(activity.applicationContext).thenReturn(context) - CommandDispatcherHelper.clear() - Dispatchers.setMain(testDispatcher) - } - - @After - open fun cleanup() { - // remove everything from cache after test ends - TestUtils.clearCache(SHARED_PREFERENCES_NAME) - } - - fun getSafePassword(): String { - val query = LabUserQuery() - query.federationProvider = LabConstants.FederationProvider.CIAM_CUD - query.signInAudience = LabConstants.SignInAudience.AZURE_AD_MY_ORG - val credential = LabUserHelper.getCredentials(query) - return credential.password - } - - private fun getConfigsThroughSecretValue(): Map? { - val secretValue = KeyVaultFetchHelper.getSecretForBuildAutomation("msalandroidnativeauthautomationconfjsonfile") - val type = TypeToken.getParameterized( - Map::class.java, - String::class.java, - NativeAuthTestConfig.Config::class.java - ).type - - return Gson().fromJson(secretValue, type) - } - - fun getConfig(configType: ConfigType): NativeAuthTestConfig.Config { - val secretValue = getConfigsThroughSecretValue() - return secretValue?.get(configType.stringValue) - ?: throw IllegalStateException("Config not $secretValue") - } - - fun setupPCA(config: NativeAuthTestConfig.Config, challengeTypes: List): INativeAuthPublicClientApplication { - return try { - PublicClientApplication.createNativeAuthPublicClientApplication( - context, - config.clientId, - config.authorityUrl, - null, - challengeTypes - ) - } catch (e: MsalException) { - Assert.fail(e.message) - throw e - } - } - - fun retryOperation( - maxRetries: Int = 5, - authFlow: () -> T - ) { - var retryCount = 0 - var shouldRetry = true - - while (shouldRetry) { - try { - authFlow() - shouldRetry = false // authFlow() has succeeded, so we don't need to retry. - } catch (e: Exception) { - //1secmail occasionally has a delay for emails to arrive / return from the API, or throws an internal server error, which causes tests to fail - //In this case, retry the test - if (retryCount >= maxRetries) { - Assert.fail(e.message) - shouldRetry = false - } else { - retryCount++ - } - } - } - } -} \ No newline at end of file diff --git a/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SSPRTest.kt b/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SSPRTest.kt index 1961f6ac3..1be679c86 100644 --- a/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SSPRTest.kt +++ b/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SSPRTest.kt @@ -26,6 +26,8 @@ package com.microsoft.identity.client.e2e.tests.network.nativeauth import com.microsoft.identity.client.e2e.utils.assertResult import com.microsoft.identity.internal.testutils.nativeauth.ConfigType import com.microsoft.identity.internal.testutils.nativeauth.api.TemporaryEmailService +import com.microsoft.identity.internal.testutils.nativeauth.api.models.NativeAuthTestConfig +import com.microsoft.identity.nativeauth.INativeAuthPublicClientApplication import com.microsoft.identity.nativeauth.statemachine.errors.ResetPasswordError import com.microsoft.identity.nativeauth.statemachine.results.ResetPasswordResult import com.microsoft.identity.nativeauth.statemachine.results.ResetPasswordStartResult @@ -39,7 +41,17 @@ class SSPRTest : NativeAuthPublicClientApplicationAbstractTest() { private val tempEmailApi = TemporaryEmailService() - override val defaultConfigType = ConfigType.SSPR + lateinit var application: INativeAuthPublicClientApplication + lateinit var config: NativeAuthTestConfig.Config + + private val defaultConfigType = ConfigType.SSPR + private val defaultChallengeTypes = listOf("password", "oob") + + override fun setup() { + super.setup() + config = getConfig(defaultConfigType) + application = setupPCA(config, defaultChallengeTypes) + } @Test fun testSSPRErrorSimple() = runTest { diff --git a/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignInEmailOTPTest.kt b/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignInEmailOTPTest.kt index 3b931150e..ee8d77663 100644 --- a/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignInEmailOTPTest.kt +++ b/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignInEmailOTPTest.kt @@ -26,6 +26,8 @@ package com.microsoft.identity.client.e2e.tests.network.nativeauth import com.microsoft.identity.client.e2e.utils.assertResult import com.microsoft.identity.internal.testutils.nativeauth.ConfigType import com.microsoft.identity.internal.testutils.nativeauth.api.TemporaryEmailService +import com.microsoft.identity.internal.testutils.nativeauth.api.models.NativeAuthTestConfig +import com.microsoft.identity.nativeauth.INativeAuthPublicClientApplication import com.microsoft.identity.nativeauth.statemachine.errors.SignInError import com.microsoft.identity.nativeauth.statemachine.errors.SubmitCodeError import com.microsoft.identity.nativeauth.statemachine.results.SignInResult @@ -38,7 +40,17 @@ class SignInEmailOTPTest : NativeAuthPublicClientApplicationAbstractTest() { private val tempEmailApi = TemporaryEmailService() - override val defaultConfigType = ConfigType.SIGN_IN_OTP + lateinit var application: INativeAuthPublicClientApplication + lateinit var config: NativeAuthTestConfig.Config + + private val defaultConfigType = ConfigType.SIGN_IN_OTP + private val defaultChallengeTypes = listOf("password", "oob") + + override fun setup() { + super.setup() + config = getConfig(defaultConfigType) + application = setupPCA(config, defaultChallengeTypes) + } /** * Use valid email and OTP to get token and sign in. diff --git a/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignInEmailPasswordTest.kt b/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignInEmailPasswordTest.kt index e1bb3ec31..45d9122e0 100644 --- a/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignInEmailPasswordTest.kt +++ b/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignInEmailPasswordTest.kt @@ -25,6 +25,8 @@ package com.microsoft.identity.client.e2e.tests.network.nativeauth import com.microsoft.identity.client.e2e.utils.assertResult import com.microsoft.identity.internal.testutils.nativeauth.ConfigType +import com.microsoft.identity.internal.testutils.nativeauth.api.models.NativeAuthTestConfig +import com.microsoft.identity.nativeauth.INativeAuthPublicClientApplication import com.microsoft.identity.nativeauth.NativeAuthPublicClientApplicationConfiguration import com.microsoft.identity.nativeauth.statemachine.errors.SignInError import com.microsoft.identity.nativeauth.statemachine.results.MFARequiredResult @@ -41,7 +43,17 @@ import org.mockito.kotlin.spy class SignInEmailPasswordTest : NativeAuthPublicClientApplicationAbstractTest() { - override val defaultConfigType = ConfigType.SIGN_IN_PASSWORD + lateinit var application: INativeAuthPublicClientApplication + lateinit var config: NativeAuthTestConfig.Config + + private val defaultConfigType = ConfigType.SIGN_IN_PASSWORD + private val defaultChallengeTypes = listOf("password", "oob") + + override fun setup() { + super.setup() + config = getConfig(defaultConfigType) + application = setupPCA(config, defaultChallengeTypes) + } /** * Use valid email and password to get token. diff --git a/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignInMFATest.kt b/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignInMFATest.kt index 2f75b4c3e..e4d6a107f 100644 --- a/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignInMFATest.kt +++ b/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignInMFATest.kt @@ -27,6 +27,7 @@ import com.microsoft.identity.client.e2e.utils.assertResult import com.microsoft.identity.internal.testutils.nativeauth.ConfigType import com.microsoft.identity.internal.testutils.nativeauth.api.TemporaryEmailService import com.microsoft.identity.internal.testutils.nativeauth.api.models.NativeAuthTestConfig +import com.microsoft.identity.nativeauth.INativeAuthPublicClientApplication import com.microsoft.identity.nativeauth.statemachine.errors.MFASubmitChallengeError import com.microsoft.identity.nativeauth.statemachine.results.GetAccessTokenResult import com.microsoft.identity.nativeauth.statemachine.results.MFARequiredResult @@ -42,12 +43,18 @@ class SignInMFATest : NativeAuthPublicClientApplicationAbstractTest() { private val tempEmailApi = TemporaryEmailService() - override var defaultConfigType = ConfigType.SIGN_IN_MFA_SINGLE_AUTH - private lateinit var resources: List + lateinit var application: INativeAuthPublicClientApplication + lateinit var config: NativeAuthTestConfig.Config + + private val defaultConfigType = ConfigType.SIGN_IN_MFA_SINGLE_AUTH + private val defaultChallengeTypes = listOf("password", "oob") + override fun setup() { super.setup() + config = getConfig(defaultConfigType) + application = setupPCA(config, defaultChallengeTypes) resources = config.resources } @@ -203,9 +210,6 @@ class SignInMFATest : NativeAuthPublicClientApplicationAbstractTest() { fun `test selection required, request challenge on specific auth method and complete MFA flow`() { retryOperation { runBlocking { - val configType = ConfigType.SIGN_IN_MFA_MULTI_AUTH - setupPCA(configType) - val scopeA = resources[0].scopes[0] val scopeB = resources[0].scopes[1] diff --git a/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignUpEmailOTPAttributesTest.kt b/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignUpEmailOTPAttributesTest.kt index d18486ce6..9bb3bb62d 100644 --- a/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignUpEmailOTPAttributesTest.kt +++ b/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignUpEmailOTPAttributesTest.kt @@ -26,6 +26,8 @@ package com.microsoft.identity.client.e2e.tests.network.nativeauth import com.microsoft.identity.client.e2e.utils.assertResult import com.microsoft.identity.internal.testutils.nativeauth.ConfigType import com.microsoft.identity.internal.testutils.nativeauth.api.TemporaryEmailService +import com.microsoft.identity.internal.testutils.nativeauth.api.models.NativeAuthTestConfig +import com.microsoft.identity.nativeauth.INativeAuthPublicClientApplication import com.microsoft.identity.nativeauth.UserAttributes import com.microsoft.identity.nativeauth.statemachine.results.SignUpResult import kotlinx.coroutines.runBlocking @@ -36,7 +38,17 @@ class SignUpEmailOTPAttributesTest : NativeAuthPublicClientApplicationAbstractTe private val tempEmailApi = TemporaryEmailService() - override val defaultConfigType = ConfigType.SIGN_UP_OTP_ATTRIBUTES + lateinit var application: INativeAuthPublicClientApplication + lateinit var config: NativeAuthTestConfig.Config + + private val defaultConfigType = ConfigType.SIGN_UP_OTP_ATTRIBUTES + private val defaultChallengeTypes = listOf("password", "oob") + + override fun setup() { + super.setup() + config = getConfig(defaultConfigType) + application = setupPCA(config, defaultChallengeTypes) + } /** * Signup user with custom attributes with verify OTP as last step. diff --git a/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignUpEmailOTPTest.kt b/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignUpEmailOTPTest.kt index aee0b161a..8823586f5 100644 --- a/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignUpEmailOTPTest.kt +++ b/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignUpEmailOTPTest.kt @@ -37,7 +37,7 @@ import org.junit.Assert import org.junit.Ignore import org.junit.Test -class SignUpEmailOTPTest : NativeAuthPublicClientApplicationAnotherAbstractTest() { +class SignUpEmailOTPTest : NativeAuthPublicClientApplicationAbstractTest() { private val tempEmailApi = TemporaryEmailService() diff --git a/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignUpEmailPasswordAttributesTest.kt b/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignUpEmailPasswordAttributesTest.kt index 2a524f3b5..2afbc9756 100644 --- a/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignUpEmailPasswordAttributesTest.kt +++ b/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignUpEmailPasswordAttributesTest.kt @@ -26,6 +26,8 @@ package com.microsoft.identity.client.e2e.tests.network.nativeauth import com.microsoft.identity.client.e2e.utils.assertResult import com.microsoft.identity.internal.testutils.nativeauth.ConfigType import com.microsoft.identity.internal.testutils.nativeauth.api.TemporaryEmailService +import com.microsoft.identity.internal.testutils.nativeauth.api.models.NativeAuthTestConfig +import com.microsoft.identity.nativeauth.INativeAuthPublicClientApplication import com.microsoft.identity.nativeauth.UserAttributes import com.microsoft.identity.nativeauth.statemachine.results.SignUpResult import kotlinx.coroutines.runBlocking @@ -36,7 +38,17 @@ class SignUpEmailPasswordAttributesTest : NativeAuthPublicClientApplicationAbstr private val tempEmailApi = TemporaryEmailService() - override val defaultConfigType = ConfigType.SIGN_UP_PASSWORD_ATTRIBUTES + lateinit var application: INativeAuthPublicClientApplication + lateinit var config: NativeAuthTestConfig.Config + + private val defaultConfigType = ConfigType.SIGN_UP_PASSWORD_ATTRIBUTES + private val defaultChallengeTypes = listOf("password", "oob") + + override fun setup() { + super.setup() + config = getConfig(defaultConfigType) + application = setupPCA(config, defaultChallengeTypes) + } /** * Sign up with password and attributes on start, then verify OTP as last step. diff --git a/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignUpEmailPasswordTest.kt b/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignUpEmailPasswordTest.kt index d3b614550..858462582 100644 --- a/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignUpEmailPasswordTest.kt +++ b/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignUpEmailPasswordTest.kt @@ -29,9 +29,7 @@ import com.microsoft.identity.internal.testutils.nativeauth.api.TemporaryEmailSe import com.microsoft.identity.internal.testutils.nativeauth.api.models.NativeAuthTestConfig import com.microsoft.identity.nativeauth.INativeAuthPublicClientApplication import com.microsoft.identity.nativeauth.statemachine.errors.SignUpError -import com.microsoft.identity.nativeauth.statemachine.results.GetAccountResult import com.microsoft.identity.nativeauth.statemachine.results.SignInResult -import com.microsoft.identity.nativeauth.statemachine.results.SignOutResult import com.microsoft.identity.nativeauth.statemachine.results.SignUpResendCodeResult import com.microsoft.identity.nativeauth.statemachine.results.SignUpResult import kotlinx.coroutines.runBlocking @@ -39,7 +37,7 @@ import org.junit.Assert import org.junit.Ignore import org.junit.Test -class SignUpEmailPasswordTest : NativeAuthPublicClientApplicationAnotherAbstractTest() { +class SignUpEmailPasswordTest : NativeAuthPublicClientApplicationAbstractTest() { private val tempEmailApi = TemporaryEmailService()