Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ abstract class NativeAuthPublicClientApplicationAbstractTest : IPublicClientAppl
const val SHARED_PREFERENCES_NAME = "com.microsoft.identity.client.account_credential_cache"
const val INVALID_EMAIL = "email"
const val INVALID_PASSWORD = "password"
const val INCORRECT_CODE = "00000000"
}

private lateinit var context: Context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import com.microsoft.identity.nativeauth.statemachine.results.ResetPasswordSubmi
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.test.runTest
import org.junit.Assert
import org.junit.Ignore
import org.junit.Test

class SSPRTest : NativeAuthPublicClientApplicationAbstractTest() {
Expand Down Expand Up @@ -67,6 +68,7 @@ class SSPRTest : NativeAuthPublicClientApplicationAbstractTest() {
* Verify email with email OTP first and then reset password.
* (hero scenario 8 & 17, use case 3.1.1)
*/
@Ignore("Retrieving OTP code failure")
@Test
fun testSSPRSuccess() = runBlocking {
var result: ResetPasswordStartResult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import com.microsoft.identity.nativeauth.statemachine.results.SignInResult
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.test.runTest
import org.junit.Assert
import org.junit.Ignore
import org.junit.Test

class SignInEmailOTPTest : NativeAuthPublicClientApplicationAbstractTest() {
Expand All @@ -56,6 +57,7 @@ class SignInEmailOTPTest : NativeAuthPublicClientApplicationAbstractTest() {
* Use valid email and OTP to get token and sign in.
* (hero scenario 6, use case 2.2.1)
*/
@Ignore("Retrieving OTP code failure.")
@Test
fun testSuccess() {
retryOperation {
Expand All @@ -76,10 +78,7 @@ class SignInEmailOTPTest : NativeAuthPublicClientApplicationAbstractTest() {
*/
@Test
fun testErrorIsUserNotFound() = runTest {
val user = config.email
// Turn correct username into an incorrect one
val invalidUser = user + "x"
val signInResult = application.signIn(invalidUser)
val signInResult = application.signIn(INVALID_EMAIL)
Assert.assertTrue(signInResult is SignInError)
Assert.assertTrue((signInResult as SignInError).isUserNotFound())
}
Expand All @@ -88,19 +87,15 @@ class SignInEmailOTPTest : NativeAuthPublicClientApplicationAbstractTest() {
* Use valid email address, but invalid OTP to receive "invalid code" error.
* (use case 2.2.7)
*/
@Ignore("Username used for this test is currently blocked in lab tenant.")
@Test
fun testErrorIsInvalidCode() {
retryOperation {
runBlocking {// Running with runBlocking to avoid default 10 second execution timeout.
val user = config.email
val signInResult = application.signIn(user)
assertResult<SignInResult.CodeRequired>(signInResult)
fun testErrorIsInvalidCode() = runTest {
val user = config.email
val signInResult = application.signIn(user)
assertResult<SignInResult.CodeRequired>(signInResult)

val incorrectOtp = "1234"
val submitCodeResult = (signInResult as SignInResult.CodeRequired).nextState.submitCode(incorrectOtp)
Assert.assertTrue(submitCodeResult is SubmitCodeError)
Assert.assertTrue((submitCodeResult as SubmitCodeError).isInvalidCode())
}
}
val submitCodeResult = (signInResult as SignInResult.CodeRequired).nextState.submitCode(INCORRECT_CODE)
Assert.assertTrue(submitCodeResult is SubmitCodeError)
Assert.assertTrue((submitCodeResult as SubmitCodeError).isInvalidCode())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class SignInMFATest : NativeAuthPublicClientApplicationAbstractTest() {
*
* Note: this test also asserts whether the scopes requested at sign in are present in the token that's received at the end of the flow
*/
@Ignore("Retrieving OTP code failure.")
@Test
fun `test submit invalid challenge, request new challenge, submit correct challenge and complete MFA flow`() {
config = getConfig(defaultConfigType)
Expand Down Expand Up @@ -133,6 +134,7 @@ class SignInMFATest : NativeAuthPublicClientApplicationAbstractTest() {
*
* Note: this test also asserts whether the scopes requested at sign in are present in the token that's received at the end of the flow
*/
@Ignore("Retrieving OTP code failure.")
@Test
fun `test get other auth methods, request challenge on specific auth method and complete MFA flow`() {
config = getConfig(defaultConfigType)
Expand Down Expand Up @@ -204,6 +206,7 @@ class SignInMFATest : NativeAuthPublicClientApplicationAbstractTest() {
*
* Note: this test also asserts whether the scopes requested at sign in are present in the token that's received at the end of the flow
*/
@Ignore("Retrieving OTP code failure.")
@Test
fun `test selection required, request challenge on specific auth method and complete MFA flow`() {
config = getConfig(ConfigType.SIGN_IN_MFA_MULTI_AUTH)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import com.microsoft.identity.nativeauth.UserAttributes
import com.microsoft.identity.nativeauth.statemachine.results.SignUpResult
import kotlinx.coroutines.runBlocking
import org.junit.Assert
import org.junit.Ignore
import org.junit.Test

class SignUpEmailOTPAttributesTest : NativeAuthPublicClientApplicationAbstractTest() {
Expand All @@ -54,6 +55,7 @@ class SignUpEmailOTPAttributesTest : NativeAuthPublicClientApplicationAbstractTe
* Signup user with custom attributes with verify OTP as last step.
* (hero scenario 2, use case 2.1.2)
*/
@Ignore("Retrieving OTP code failure.")
@Test
fun testSuccessAttributesFirst() {
retryOperation {
Expand All @@ -75,6 +77,7 @@ class SignUpEmailOTPAttributesTest : NativeAuthPublicClientApplicationAbstractTe
* Verify email OTP first and then collect custom attributes.
* (hero scenario 3, use case 2.1.3)
*/
@Ignore("Retrieving OTP code failure.")
@Test
fun testSuccessAttributesLastSameScreen() {
retryOperation {
Expand Down Expand Up @@ -103,6 +106,7 @@ class SignUpEmailOTPAttributesTest : NativeAuthPublicClientApplicationAbstractTe
* Verify email OTP first and then collect custom attributes in multiple steps (mimicking a multi-screen UX).
* (hero scenario 4, use case 2.1.4)
*/
@Ignore("Retrieving OTP code failure.")
@Test
fun testSuccessAttributesLastMultipleScreens() {
retryOperation {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class SignUpEmailOTPTest : NativeAuthPublicClientApplicationAbstractTest() {
* Sign up with email + OTP. Verify email address using email OTP and sign up.
* (hero scenario 1, use case 2.1.1)
*/
@Ignore("Retrieving OTP code failure.")
@Test
fun testSuccess() {
config = getConfig(defaultConfigType)
Expand All @@ -73,6 +74,7 @@ class SignUpEmailOTPTest : NativeAuthPublicClientApplicationAbstractTest() {
* Sign up with email + OTP. Resend email OTP.
* (hero scenario 1, use case 2.1.5)
*/
@Ignore("Retrieving OTP code failure.")
@Test
fun testResendCode() {
config = getConfig(defaultConfigType)
Expand Down Expand Up @@ -165,6 +167,7 @@ class SignUpEmailOTPTest : NativeAuthPublicClientApplicationAbstractTest() {
* Sign up with email + OTP. Developer can opt to get AT and/or ID token (aka sign in after signup).
* (use case 2.1.9)
*/
@Ignore("Retrieving OTP code failure.")
@Test
fun testSignInAfterSignUp() {
config = getConfig(defaultConfigType)
Expand All @@ -188,12 +191,13 @@ class SignUpEmailOTPTest : NativeAuthPublicClientApplicationAbstractTest() {
* Sign up with email + OTP. Server requires password authentication, which is not supported by the developer (aka redirect flow).
* (use case 2.1.10)
*/
@Ignore("Generate random email failure.")
@Test
fun testErrorRedirect() {
config = getConfig(ConfigType.SIGN_UP_PASSWORD)
application = setupPCA(config, listOf("oob"))

runBlocking { // Running with runBlocking to avoid default 10 second execution timeout.
runBlocking {
val user = tempEmailApi.generateRandomEmailAddress()
val signUpResult = application.signUp(user)
Assert.assertTrue(signUpResult is SignUpError)
Expand All @@ -205,6 +209,7 @@ class SignUpEmailOTPTest : NativeAuthPublicClientApplicationAbstractTest() {
* Sign up with email + OTP. Server requires password authentication, which is supported by the developer.
* (hero scenario 11, use case 2.1.11)
*/
@Ignore("Retrieving OTP code failure.")
@Test
fun testPasswordRequired() {
config = getConfig(ConfigType.SIGN_UP_PASSWORD)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import com.microsoft.identity.nativeauth.UserAttributes
import com.microsoft.identity.nativeauth.statemachine.results.SignUpResult
import kotlinx.coroutines.runBlocking
import org.junit.Assert
import org.junit.Ignore
import org.junit.Test

class SignUpEmailPasswordAttributesTest : NativeAuthPublicClientApplicationAbstractTest() {
Expand All @@ -57,6 +58,7 @@ class SignUpEmailPasswordAttributesTest : NativeAuthPublicClientApplicationAbstr
* 2. Validate OTP.
* (hero scenario 10, use case 1.1.3)
*/
@Ignore("Retrieving OTP code failure.")
@Test
fun testEmailPasswordAttributesOnSameScreen() {
retryOperation {
Expand Down Expand Up @@ -86,6 +88,7 @@ class SignUpEmailPasswordAttributesTest : NativeAuthPublicClientApplicationAbstr
* 3. Set custom attributes.
* (hero scenario 12, use case 1.1.6)
*/
@Ignore("Retrieving OTP code failure.")
@Test
fun testSeparateEmailPasswordAndAttributesOnSameScreen() {
retryOperation {
Expand Down Expand Up @@ -122,10 +125,11 @@ class SignUpEmailPasswordAttributesTest : NativeAuthPublicClientApplicationAbstr
* 5. etc.
* ((hero scenario 13)
*/
@Ignore("Retrieving OTP code failure.")
@Test
fun testSeparateEmailPasswordAndAttributesOnMultipleScreens() {
retryOperation {
runBlocking { // Running with runBlocking to avoid default 10 second execution timeout.
runBlocking {
val user = tempEmailApi.generateRandomEmailAddress()
val signUpResult = application.signUp(user)
assertResult<SignUpResult.CodeRequired>(signUpResult)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class SignUpEmailPasswordTest : NativeAuthPublicClientApplicationAbstractTest()
private val defaultChallengeTypes = listOf("password", "oob")


@Ignore("Retrieving OTP code failure.")
@Test
fun testSignUpErrorSimple() {
config = getConfig(defaultConfigType)
Expand All @@ -67,6 +68,7 @@ class SignUpEmailPasswordTest : NativeAuthPublicClientApplicationAbstractTest()
* Sign up with email + password. Set email and password (mimicking one combined screen for email & password collection), and then verify email OTP as last step
* (hero scenario 9, use case 1.1.1)
*/
@Ignore("Retrieving OTP code failure.")
@Test
fun testSuccessOTPLast() {
config = getConfig(defaultConfigType)
Expand All @@ -90,6 +92,7 @@ class SignUpEmailPasswordTest : NativeAuthPublicClientApplicationAbstractTest()
* Sign up with email + password. Resend email OOB.
* (use case 1.1.2)
*/
@Ignore("Retrieving OTP code failure.")
@Test
fun testResendEmailOOB() {
config = getConfig(defaultConfigType)
Expand All @@ -115,6 +118,7 @@ class SignUpEmailPasswordTest : NativeAuthPublicClientApplicationAbstractTest()
* Sign up with email + password. Verify email address using email OTP and then set password (mimicking email and password collection on separate screens).
* (use case 1.1.4)
*/
@Ignore("Retrieving OTP code failure.")
@Test
fun testSuccessOTPFirst() {
config = getConfig(defaultConfigType)
Expand All @@ -140,13 +144,14 @@ class SignUpEmailPasswordTest : NativeAuthPublicClientApplicationAbstractTest()
* Sign up with email + password. Verify email address using email OTP, resend OTP and then set password.
* (use case 1.1.5)
*/
@Ignore("Retrieving OTP code failure.")
@Test
fun testSuccessOTPResend() {
config = getConfig(defaultConfigType)
application = setupPCA(config, defaultChallengeTypes)

retryOperation {
runBlocking { // Running with runBlocking to avoid default 10 second execution timeout.
runBlocking {
val user = tempEmailApi.generateRandomEmailAddress()
val signUpResult = application.signUp(user)
assertResult<SignUpResult.CodeRequired>(signUpResult)
Expand Down Expand Up @@ -223,6 +228,7 @@ class SignUpEmailPasswordTest : NativeAuthPublicClientApplicationAbstractTest()
* Sign up with email + password. Developer makes a request with password that does not match password complexity requirements set on portal.
* (use case 1.1.13)
*/
@Ignore("Retrieving OTP code failure.")
@Test
fun testErrorInvalidPasswordFormat() {
config = getConfig(defaultConfigType)
Expand All @@ -241,6 +247,7 @@ class SignUpEmailPasswordTest : NativeAuthPublicClientApplicationAbstractTest()
* Sign up with email + password. Developer can opt to get AT and/or ID token (aka sign in after signup).
* (use case 1.1.14)
*/
@Ignore("Retrieving OTP code failure.")
@Test
fun testSignInAfterSignUp() {
config = getConfig(defaultConfigType)
Expand Down
Loading