Skip to content

Commit f569613

Browse files
spetrescu84Copilot
andauthored
[iOS SDK] E2E tests for JIT (#2621)
* E2E tests for JIT * Update MSAL/MSAL.xcodeproj/project.pbxproj Co-authored-by: Copilot <[email protected]> * PR comment --------- Co-authored-by: Copilot <[email protected]>
1 parent 58f7006 commit f569613

File tree

5 files changed

+446
-0
lines changed

5 files changed

+446
-0
lines changed

MSAL/MSAL.xcodeproj/project.pbxproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,7 @@
10361036
DE1BD10A2C3C285F00B0888E /* MSALNativeAuthEndToEndBaseTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B235D9E2A3CFB4300657331 /* MSALNativeAuthEndToEndBaseTestCase.swift */; };
10371037
DE1BD10B2C3C286100B0888E /* ClientIdType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 280095EA2C32CAFC00F1653E /* ClientIdType.swift */; };
10381038
DE1D8AA829E6B7D900E11D48 /* MSALNativeAuthRequestConfigurator.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE1D8AA729E6B7D900E11D48 /* MSALNativeAuthRequestConfigurator.swift */; };
1039+
DE20A8492DDE2CD200BC286C /* JITDelegateSpies.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED1F09C2DD644F9009CB97A /* JITDelegateSpies.swift */; };
10391040
DE38F0802DB2508400BE3101 /* MSALNativeAuthJITControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE38F07F2DB2507D00BE3101 /* MSALNativeAuthJITControllerTests.swift */; };
10401041
DE38F0812DB2508400BE3101 /* MSALNativeAuthJITControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE38F07F2DB2507D00BE3101 /* MSALNativeAuthJITControllerTests.swift */; };
10411042
DE38F0862DB2510A00BE3101 /* JITDelegatesSpies.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE38F0852DB2510600BE3101 /* JITDelegatesSpies.swift */; };
@@ -1435,6 +1436,9 @@
14351436
DECE10202BE3F07F0036738C /* MSALNativeAuthSignUpContinueOauth2ErrorCodeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2F4DB2C2A1F5714009FBCD0 /* MSALNativeAuthSignUpContinueOauth2ErrorCodeTests.swift */; };
14361437
DECE10252BE3F0830036738C /* MSALNativeAuthESTSApiErrorDescriptionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEF1DD3B2AA9D07000D22194 /* MSALNativeAuthESTSApiErrorDescriptionsTests.swift */; };
14371438
DECE10282BE3F0830036738C /* MSALNativeAuthResetPasswordPollCompletionOauth2ErrorCodeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B2BBA362A3298080075F702 /* MSALNativeAuthResetPasswordPollCompletionOauth2ErrorCodeTests.swift */; };
1439+
DED1F09D2DD644FC009CB97A /* JITDelegateSpies.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED1F09C2DD644F9009CB97A /* JITDelegateSpies.swift */; };
1440+
DED1F0A02DD64544009CB97A /* MSALNativeAuthSignInJITEndToEndTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED1F09F2DD64536009CB97A /* MSALNativeAuthSignInJITEndToEndTests.swift */; };
1441+
DED1F0A12DD64544009CB97A /* MSALNativeAuthSignInJITEndToEndTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED1F09F2DD64536009CB97A /* MSALNativeAuthSignInJITEndToEndTests.swift */; };
14381442
DEDB298B29D72D62008DA85B /* MSALNativeAuthInnerError.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEDB298A29D72D62008DA85B /* MSALNativeAuthInnerError.swift */; };
14391443
DEDB29A529DDA9DC008DA85B /* MSALNativeAuthSignInInitiateResponseError.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEDB29A429DDA9DC008DA85B /* MSALNativeAuthSignInInitiateResponseError.swift */; };
14401444
DEDB29A829DDAEB3008DA85B /* MSALNativeAuthSignInChallengeOauth2ErrorCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEDB29A629DDAEB3008DA85B /* MSALNativeAuthSignInChallengeOauth2ErrorCode.swift */; };
@@ -2609,6 +2613,8 @@
26092613
DECC1F9329521E34006D9FB1 /* MSALLogMask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MSALLogMask.h; sourceTree = "<group>"; };
26102614
DECC1FB229531032006D9FB1 /* MSALLogMaskTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSALLogMaskTests.m; sourceTree = "<group>"; };
26112615
DECC1FB4295322A8006D9FB1 /* MSALNativeLoggingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MSALNativeLoggingTests.swift; sourceTree = "<group>"; };
2616+
DED1F09C2DD644F9009CB97A /* JITDelegateSpies.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JITDelegateSpies.swift; sourceTree = "<group>"; };
2617+
DED1F09F2DD64536009CB97A /* MSALNativeAuthSignInJITEndToEndTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MSALNativeAuthSignInJITEndToEndTests.swift; sourceTree = "<group>"; };
26122618
DEDB298A29D72D62008DA85B /* MSALNativeAuthInnerError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MSALNativeAuthInnerError.swift; sourceTree = "<group>"; };
26132619
DEDB29A429DDA9DC008DA85B /* MSALNativeAuthSignInInitiateResponseError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MSALNativeAuthSignInInitiateResponseError.swift; sourceTree = "<group>"; };
26142620
DEDB29A629DDAEB3008DA85B /* MSALNativeAuthSignInChallengeOauth2ErrorCode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MSALNativeAuthSignInChallengeOauth2ErrorCode.swift; sourceTree = "<group>"; };
@@ -3008,8 +3014,10 @@
30083014
28188F572C8F480300CFDD05 /* mfa */ = {
30093015
isa = PBXGroup;
30103016
children = (
3017+
DED1F09F2DD64536009CB97A /* MSALNativeAuthSignInJITEndToEndTests.swift */,
30113018
28188F5F2C8F482D00CFDD05 /* MSALNativeAuthSignInWithMFAEndToEndTests.swift */,
30123019
28188F642C8F4C1100CFDD05 /* MFADelegateSpies.swift */,
3020+
DED1F09C2DD644F9009CB97A /* JITDelegateSpies.swift */,
30133021
);
30143022
path = mfa;
30153023
sourceTree = "<group>";
@@ -6599,6 +6607,7 @@
65996607
281A0E0C2C21E1F000CB30CB /* MSALNativeAuthSignUpUsernameEndToEndTests.swift in Sources */,
66006608
281A0E152C21E1F500CB30CB /* SignUpDelegateSpies.swift in Sources */,
66016609
28188F622C8F48BD00CFDD05 /* MSALNativeAuthSignInWithMFAEndToEndTests.swift in Sources */,
6610+
DE20A8492DDE2CD200BC286C /* JITDelegateSpies.swift in Sources */,
66026611
281A0E172C21E1FB00CB30CB /* MSALNativeAuthSignInUsernameEndToEndTests.swift in Sources */,
66036612
281A0E1C2C21E3A400CB30CB /* MSALNativeAuthSignOutEndToEndTests.swift in Sources */,
66046613
DEFE87732CA6BC91009D11DC /* CredentialsDelegateSpies.swift in Sources */,
@@ -6608,6 +6617,7 @@
66086617
281A0E1A2C21E20300CB30CB /* ResetPasswordDelegateSpies.swift in Sources */,
66096618
2809E8352C3C37B7009F14D7 /* MSALNativeAuthEndToEndPasswordTestCase.swift in Sources */,
66106619
280095EB2C32CAFC00F1653E /* ClientIdType.swift in Sources */,
6620+
DED1F0A12DD64544009CB97A /* MSALNativeAuthSignInJITEndToEndTests.swift in Sources */,
66116621
);
66126622
runOnlyForDeploymentPostprocessing = 0;
66136623
};
@@ -7722,6 +7732,7 @@
77227732
DE1BD1012C3C283C00B0888E /* MSALNativeAuthSignUpUsernameEndToEndTests.swift in Sources */,
77237733
28188F662C8F4C1100CFDD05 /* MFADelegateSpies.swift in Sources */,
77247734
DE1BD1032C3C284100B0888E /* SignUpDelegateSpies.swift in Sources */,
7735+
DED1F09D2DD644FC009CB97A /* JITDelegateSpies.swift in Sources */,
77257736
DE1BD1092C3C285D00B0888E /* MSALNativeAuthSignOutEndToEndTests.swift in Sources */,
77267737
DE1BD1052C3C284700B0888E /* MSALNativeAuthSignInUsernameEndToEndTests.swift in Sources */,
77277738
28188F632C8F48BD00CFDD05 /* MSALNativeAuthSignInWithMFAEndToEndTests.swift in Sources */,
@@ -7734,6 +7745,7 @@
77347745
DE1BD1082C3C284D00B0888E /* ResetPasswordDelegateSpies.swift in Sources */,
77357746
DE6BF3242C418C8A000BB2D9 /* MSALNativeAuthEndToEndPasswordTestCase.swift in Sources */,
77367747
DE1BD10B2C3C286100B0888E /* ClientIdType.swift in Sources */,
7748+
DED1F0A02DD64544009CB97A /* MSALNativeAuthSignInJITEndToEndTests.swift in Sources */,
77377749
);
77387750
runOnlyForDeploymentPostprocessing = 0;
77397751
};
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
//
2+
// Copyright (c) Microsoft Corporation.
3+
// All rights reserved.
4+
//
5+
// This code is licensed under the MIT License.
6+
//
7+
// Permission is hereby granted, free of charge, to any person obtaining a copy
8+
// of this software and associated documentation files(the "Software"), to deal
9+
// in the Software without restriction, including without limitation the rights
10+
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
11+
// copies of the Software, and to permit persons to whom the Software is
12+
// furnished to do so, subject to the following conditions :
13+
//
14+
// The above copyright notice and this permission notice shall be included in
15+
// all copies or substantial portions of the Software.
16+
//
17+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
// THE SOFTWARE.
24+
25+
import Foundation
26+
import XCTest
27+
import MSAL
28+
29+
class RegisterStrongAuthChallengeDelegateSpy: RegisterStrongAuthChallengeDelegate {
30+
private let expectation: XCTestExpectation
31+
private(set) var onRegisterStrongAuthVerificationRequiredCalled = false
32+
private(set) var onRegisterStrongAuthChallengeErrorCalled = false
33+
private(set) var onSignInCompletedCalled = false
34+
private(set) var newStateVerificationRequired: RegisterStrongAuthVerificationRequiredState?
35+
private(set) var error: RegisterStrongAuthChallengeError?
36+
private(set) var result: MSALNativeAuthUserAccountResult?
37+
38+
init(expectation: XCTestExpectation) {
39+
self.expectation = expectation
40+
}
41+
42+
func onRegisterStrongAuthVerificationRequired(result: MSALNativeAuthRegisterStrongAuthVerificationRequiredResult) {
43+
onRegisterStrongAuthVerificationRequiredCalled = true
44+
newStateVerificationRequired = result.newState
45+
expectation.fulfill()
46+
}
47+
48+
func onRegisterStrongAuthChallengeError(error: MSAL.RegisterStrongAuthChallengeError, newState: MSAL.RegisterStrongAuthState?) {
49+
onRegisterStrongAuthChallengeErrorCalled = true
50+
self.error = error
51+
expectation.fulfill()
52+
}
53+
54+
func onSignInCompleted(result: MSALNativeAuthUserAccountResult) {
55+
onSignInCompletedCalled = true
56+
self.result = result
57+
expectation.fulfill()
58+
}
59+
}
60+
61+
class RegisterStrongAuthSubmitChallengeDelegateSpy: RegisterStrongAuthSubmitChallengeDelegate {
62+
private let expectation: XCTestExpectation
63+
private(set) var onSignInCompletedCalled = false
64+
private(set) var onRegisterStrongAuthSubmitChallengeErrorCalled = false
65+
private(set) var result: MSALNativeAuthUserAccountResult?
66+
private(set) var error: RegisterStrongAuthSubmitChallengeError?
67+
68+
init(expectation: XCTestExpectation) {
69+
self.expectation = expectation
70+
}
71+
72+
func onSignInCompleted(result: MSALNativeAuthUserAccountResult) {
73+
onSignInCompletedCalled = true
74+
self.result = result
75+
expectation.fulfill()
76+
}
77+
78+
func onRegisterStrongAuthSubmitChallengeError(error: RegisterStrongAuthSubmitChallengeError, newState: RegisterStrongAuthVerificationRequiredState?) {
79+
onRegisterStrongAuthSubmitChallengeErrorCalled = true
80+
self.error = error
81+
expectation.fulfill()
82+
}
83+
}

0 commit comments

Comments
 (0)