Skip to content

Commit db176e2

Browse files
author
Swasti Gupta
committed
Fix Test
1 parent 19901ca commit db176e2

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

MSAL/test/unit/MSALPublicClientApplicationTests.m

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,14 +1109,11 @@ - (void)testAcquireTokenSilent_whenKnownB2CAuthority_shouldNotValidate
11091109
MSALAccountId *accountId = [[MSALAccountId alloc] initWithAccountIdentifier:@"uid.utid" objectId:@"uid" tenantId:@"utid"];
11101110
MSALAccount *account = [[MSALAccount alloc] initWithUsername:nil homeAccountId:accountId environment:@"myb2c.authority.com" tenantProfiles:nil];
11111111

1112-
MSALWebviewParameters *webParameters = [[MSALWebviewParameters alloc] initWithAuthPresentationViewController:[self.class sharedViewControllerStub]];
1113-
MSALInteractiveTokenParameters *parameters = [[MSALInteractiveTokenParameters alloc] initWithScopes:@[@"fakescope1", @"fakescope2"]
1114-
webviewParameters:webParameters];
1115-
parameters.account = account;
1112+
MSALSilentTokenParameters *parameters = [[MSALSilentTokenParameters alloc] initWithScopes:@[@"fakescope1", @"fakescope2"]
1113+
account:account];
11161114

1117-
[application acquireTokenWithParameters:parameters
1118-
completionBlock:^(MSALResult *result, NSError *error)
1119-
{
1115+
[application acquireTokenSilentWithParameters:parameters
1116+
completionBlock:^(MSALResult * _Nullable result, NSError * _Nullable error) {
11201117
XCTAssertNil(result);
11211118
XCTAssertNotNil(error);
11221119
}];
@@ -1157,14 +1154,11 @@ - (void)testAcquireTokenSilent_whenNoTfpAuthority_shouldNotValidate
11571154
MSALAccountId *accountId = [[MSALAccountId alloc] initWithAccountIdentifier:@"uid.utid" objectId:@"uid" tenantId:@"utid"];
11581155
MSALAccount *account = [[MSALAccount alloc] initWithUsername:nil homeAccountId:accountId environment:@"myb2c.authority.com" tenantProfiles:nil];
11591156

1160-
MSALWebviewParameters *webParameters = [[MSALWebviewParameters alloc] initWithAuthPresentationViewController:[self.class sharedViewControllerStub]];
1161-
MSALInteractiveTokenParameters *parameters = [[MSALInteractiveTokenParameters alloc] initWithScopes:@[@"fakescope1", @"fakescope2"]
1162-
webviewParameters:webParameters];
1163-
parameters.account = account;
1157+
MSALSilentTokenParameters *parameters = [[MSALSilentTokenParameters alloc] initWithScopes:@[@"fakescope1", @"fakescope2"]
1158+
account:account];
11641159

1165-
[application acquireTokenWithParameters:parameters
1166-
completionBlock:^(MSALResult *result, NSError *error)
1167-
{
1160+
[application acquireTokenSilentWithParameters:parameters
1161+
completionBlock:^(MSALResult * _Nullable result, NSError * _Nullable error) {
11681162
XCTAssertNil(result);
11691163
XCTAssertNotNil(error);
11701164
}];
@@ -1198,7 +1192,7 @@ - (void)testAcquireScopesLoginHint
11981192
MSIDInteractiveTokenRequestParameters *params = [obj interactiveRequestParamaters];
11991193
XCTAssertNotNil(params);
12001194

1201-
NSString *expectedApiId = [NSString stringWithFormat:@"%ld", (long)MSALTelemetryApiIdAcquireWithHint];
1195+
NSString *expectedApiId = [NSString stringWithFormat:@"%ld", (long)MSALTelemetryApiIdAcquireWithTokenParameters];
12021196
XCTAssertEqualObjects(params.telemetryApiId, expectedApiId);
12031197
XCTAssertEqualObjects(params.authority.url.absoluteString, @"https://login.microsoftonline.com/common");
12041198
XCTAssertEqualObjects(params.target, @"fakescope1 fakescope2");
@@ -1404,7 +1398,7 @@ - (void)testAcquireScopesWithAccount
14041398
MSIDInteractiveTokenRequestParameters *params = [obj interactiveRequestParamaters];
14051399
XCTAssertNotNil(params);
14061400

1407-
NSString *expectedApiId = [NSString stringWithFormat:@"%ld", (long)MSALTelemetryApiIdAcquireWithUserPromptTypeAndParameters];
1401+
NSString *expectedApiId = [NSString stringWithFormat:@"%ld", (long)MSALTelemetryApiIdAcquireWithTokenParameters];
14081402
XCTAssertEqualObjects(params.telemetryApiId, expectedApiId);
14091403
XCTAssertEqualObjects(params.authority.url.absoluteString, @"https://login.microsoftonline.com/common");
14101404
XCTAssertEqualObjects(params.providedAuthority.url.absoluteString, @"https://login.microsoftonline.com/common");
@@ -1622,7 +1616,7 @@ - (void)testAcquireSilentScopesUser
16221616
MSIDRequestParameters *params = [obj requestParameters];
16231617
XCTAssertNotNil(params);
16241618

1625-
NSString *expectedApiId = [NSString stringWithFormat:@"%ld", (long)MSALTelemetryApiIdAcquireSilentWithUser];
1619+
NSString *expectedApiId = [NSString stringWithFormat:@"%ld", (long)MSALTelemetryApiIdAcquireSilentWithTokenParameters];
16261620
XCTAssertEqualObjects(params.telemetryApiId, expectedApiId);
16271621
XCTAssertEqualObjects(params.accountIdentifier.displayableId, @"[email protected]");
16281622
XCTAssertEqualObjects(params.accountIdentifier.homeAccountId, @"1.1234-5678-90abcdefg");
@@ -1698,7 +1692,7 @@ - (void)testAcquireSilentScopesUserAuthority
16981692
MSIDRequestParameters *params = [obj requestParameters];
16991693
XCTAssertNotNil(params);
17001694

1701-
NSString *expectedApiId = [NSString stringWithFormat:@"%ld", (long)MSALTelemetryApiIdAcquireSilentWithUserAndAuthority];
1695+
NSString *expectedApiId = [NSString stringWithFormat:@"%ld", (long)MSALTelemetryApiIdAcquireSilentWithTokenParameters];
17021696
XCTAssertEqualObjects(params.telemetryApiId, expectedApiId);
17031697
XCTAssertEqualObjects(params.accountIdentifier.displayableId, @"[email protected]");
17041698
XCTAssertEqualObjects(params.accountIdentifier.homeAccountId, @"1.1234-5678-90abcdefg");
@@ -1826,7 +1820,7 @@ - (void)testAcquireSilentScopesUser_whenNoAuthority_andCommonAuthorityInPublicCl
18261820
MSIDRequestParameters *params = [obj requestParameters];
18271821
XCTAssertNotNil(params);
18281822

1829-
NSString *expectedApiId = [NSString stringWithFormat:@"%ld", (long)MSALTelemetryApiIdAcquireSilentWithUser];
1823+
NSString *expectedApiId = [NSString stringWithFormat:@"%ld", (long)MSALTelemetryApiIdAcquireSilentWithTokenParameters];
18301824
XCTAssertEqualObjects(params.telemetryApiId, expectedApiId);
18311825
XCTAssertEqualObjects(params.accountIdentifier.displayableId, @"[email protected]");
18321826
XCTAssertEqualObjects(params.accountIdentifier.homeAccountId, @"1.1234-5678-90abcdefg");

0 commit comments

Comments
 (0)