Skip to content

Commit cbaa80a

Browse files
committed
adjustments
1 parent 342fd32 commit cbaa80a

4 files changed

Lines changed: 16 additions & 76 deletions

File tree

LabApiUtilities/src/test/com/microsoft/identity/labapi/utilities/client/LabClientTest.java

Lines changed: 9 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
import com.microsoft.identity.labapi.utilities.TestBuildConfig;
2626
import com.microsoft.identity.labapi.utilities.authentication.LabApiAuthenticationClient;
27-
import com.microsoft.identity.labapi.utilities.constants.AzureEnvironment;
2827
import com.microsoft.identity.labapi.utilities.constants.ProtectionPolicy;
2928
import com.microsoft.identity.labapi.utilities.constants.TempUserType;
3029
import com.microsoft.identity.labapi.utilities.constants.UserType;
@@ -34,7 +33,6 @@
3433
import org.junit.After;
3534
import org.junit.Assert;
3635
import org.junit.Before;
37-
import org.junit.Ignore;
3836
import org.junit.Rule;
3937
import org.junit.Test;
4038

@@ -55,6 +53,7 @@ public class LabClientTest {
5553
public RetryTestRule retryRule = new RetryTestRule(3);
5654

5755
private final String DEFAULT_LAB_NAME = "id4slab2";
56+
private final String GUEST_LAB_NAME = "id4slab1";
5857

5958
@Before
6059
public void setup() {
@@ -71,44 +70,30 @@ public void cleanup() {
7170
}
7271

7372
@Test
74-
@Ignore
7573
public void canFetchCloudAccount() {
76-
final LabQuery query = LabQuery.builder()
77-
.userType(UserType.CLOUD)
78-
.build();
79-
8074
try {
81-
final ILabAccount labAccount = mLabClient.getLabAccount(query);
82-
assertLabAccount(labAccount, UserType.CLOUD, DEFAULT_LAB_NAME);
75+
final ILabAccount labAccount = mLabClient.getAccountFromLabJsonStringInMobileBuildVault(UserType.BASIC);
76+
assertLabAccount(labAccount, UserType.BASIC, DEFAULT_LAB_NAME);
8377
} catch (final LabApiException e) {
8478
throw new AssertionError(e);
8579
}
8680
}
8781

8882
@Test
8983
public void canFetchMSAAccount() {
90-
final LabQuery query = LabQuery.builder()
91-
.userType(UserType.MSA)
92-
.build();
93-
9484
try {
95-
final ILabAccount labAccount = mLabClient.getLabAccount(query);
85+
final ILabAccount labAccount = mLabClient.getAccountFromLabJsonStringInMobileBuildVault(UserType.MSA);
9686
assertLabAccount(labAccount, UserType.MSA, "outlook");
9787
} catch (final LabApiException e) {
9888
throw new AssertionError(e);
9989
}
10090
}
10191

10292
@Test
103-
@Ignore
10493
public void canFetchGuestAccount() {
105-
final LabQuery query = LabQuery.builder()
106-
.userType(UserType.GUEST)
107-
.build();
108-
10994
try {
110-
final ILabAccount labAccount = mLabClient.getLabAccount(query);
111-
assertLabAccount(labAccount, UserType.GUEST, DEFAULT_LAB_NAME);
95+
final ILabAccount labAccount = mLabClient.getAccountFromLabJsonStringInMobileBuildVault(UserType.GUEST);
96+
assertLabAccount(labAccount, UserType.GUEST, GUEST_LAB_NAME);
11297
} catch (final LabApiException e) {
11398
throw new AssertionError(e);
11499
}
@@ -126,37 +111,21 @@ public void canFetchFederatedAccount() {
126111

127112
@Test
128113
public void canFetchUsGovAccount() {
129-
final LabQuery query = LabQuery.builder()
130-
.azureEnvironment(AzureEnvironment.AZURE_US_GOVERNMENT)
131-
.build();
132114
try {
133-
final ILabAccount labAccount = mLabClient.getLabAccount(query);
134-
final ILabAccount labAccount2 = mLabClient.getAccountFromLabJsonStringInMobileBuildVault(UserType.USGOV);
115+
final ILabAccount labAccount = mLabClient.getAccountFromLabJsonStringInMobileBuildVault(UserType.USGOV);
135116

136117
assertLabAccount(labAccount, null, "arlmsidlab1");
137-
assertLabAccount(labAccount2, null, "arlmsidlab1");
138-
139-
Assert.assertEquals(labAccount.getUsername(), labAccount2.getUsername());
140-
Assert.assertEquals(labAccount.getAssociatedClientId(), labAccount2.getAssociatedClientId());
141118
} catch (final LabApiException e) {
142119
throw new AssertionError(e);
143120
}
144121
}
145122

146123
@Test
147124
public void canFetchChinaAccount() {
148-
final LabQuery query = LabQuery.builder()
149-
.azureEnvironment(AzureEnvironment.AZURE_CHINA_CLOUD)
150-
.build();
151125
try {
152-
final ILabAccount labAccount = mLabClient.getLabAccount(query);
153-
final ILabAccount labAccount2 = mLabClient.getAccountFromLabJsonStringInMobileBuildVault(UserType.CHINA);
126+
final ILabAccount labAccount = mLabClient.getAccountFromLabJsonStringInMobileBuildVault(UserType.CHINA);
154127

155128
assertLabAccount(labAccount, null, "mncmsidlab1");
156-
assertLabAccount(labAccount2, null, "mncmsidlab1");
157-
158-
Assert.assertEquals(labAccount.getUsername(), labAccount2.getUsername());
159-
Assert.assertEquals(labAccount.getAssociatedClientId(), labAccount2.getAssociatedClientId());
160129
} catch (final LabApiException e) {
161130
throw new AssertionError(e);
162131
}
@@ -226,25 +195,11 @@ public void canFetchPasswordFromKeyVault() {
226195
}
227196

228197
@Test
229-
public void canFetchAccountUpnJsonString() {
198+
public void canFetchAccountUpnJsonStringOtherAccounts() {
230199
try {
231200
final Map<String, LabJsonStringAccountEntry> accountUpnMap = mLabClient.getAccountMapJsonFromMobileBuildKeyVault();
232201
Assert.assertTrue(accountUpnMap != null && !accountUpnMap.isEmpty());
233202

234-
final ILabAccount basicUser = mLabClient.getAccountFromLabJsonStringInMobileBuildVault(UserType.BASIC);
235-
Assert.assertNotNull(basicUser);
236-
Assert.assertNotNull(basicUser.getUsername());
237-
Assert.assertNotNull(basicUser.getPassword());
238-
Assert.assertNotNull(basicUser.getHomeObjectId());
239-
Assert.assertNotNull(basicUser.getHomeTenantId());
240-
241-
final ILabAccount msaUser = mLabClient.getAccountFromLabJsonStringInMobileBuildVault(UserType.MSA);
242-
Assert.assertNotNull(msaUser);
243-
Assert.assertNotNull(msaUser.getUsername());
244-
Assert.assertNotNull(msaUser.getPassword());
245-
Assert.assertNotNull(msaUser.getHomeObjectId());
246-
Assert.assertNotNull(msaUser.getHomeTenantId());
247-
248203
final ILabAccount resourceAccount = mLabClient.getAccountFromLabJsonStringInMobileBuildVault(UserType.RESOURCE_ACCOUNT_1);
249204
Assert.assertNotNull(resourceAccount);
250205
Assert.assertNotNull(resourceAccount.getUsername());

common/src/test/java/com/microsoft/identity/common/internal/controllers/LocalMsalControllerTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
import com.microsoft.identity.labapi.utilities.client.ILabAccount;
4646
import com.microsoft.identity.labapi.utilities.client.ILabClient;
4747
import com.microsoft.identity.labapi.utilities.client.LabClient;
48-
import com.microsoft.identity.labapi.utilities.client.LabQuery;
48+
import com.microsoft.identity.labapi.utilities.constants.UserType;
4949
import com.microsoft.identity.labapi.utilities.exception.LabApiException;
5050
import com.microsoft.identity.labapi.utilities.jwt.IJWTParser;
5151
import com.microsoft.identity.labapi.utilities.jwt.JWTParserFactory;
@@ -77,7 +77,7 @@ public class LocalMsalControllerTest {
7777

7878
private static final String AUTHORITY_URL = "https://login.microsoftonline.com/organizations";
7979

80-
private static final String CLIENT_ID = "4b0db8c2-9f26-4417-8bde-3f0e3656f8e0";
80+
private static final String CLIENT_ID = "c6bb302a-1e38-408e-9754-87c18fe81c80";
8181

8282
private static final String REDIRECT_URI = "msauth://com.msft.identity.client.sample.local/1wIqXSqBj7w%2Bh11ZifsnqwgyKrY%3D";
8383

@@ -89,8 +89,7 @@ public class LocalMsalControllerTest {
8989

9090
@BeforeClass
9191
public static void setupClass() throws LabApiException {
92-
final LabQuery query = LabQuery.builder().build();
93-
sTestAccount = sLabClient.getLabAccount(query);
92+
sTestAccount = sLabClient.getAccountFromLabJsonStringInMobileBuildVault(UserType.BASIC);
9493
}
9594

9695
@Before

common/src/test/java/com/microsoft/identity/common/internal/request/MsalBrokerRequestAdapterTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868
@RunWith(RobolectricTestRunner.class)
6969
public class MsalBrokerRequestAdapterTests {
7070

71+
final String CLIENT_ID = "c6bb302a-1e38-408e-9754-87c18fe81c80";
72+
7173
@Test
7274
public void test_getRequestBundleForSsoToken() {
7375
final String anAccountName = "anAccountName";
@@ -110,7 +112,6 @@ public void test_getRequestBundleForAcquireTokenInteractive() {
110112
final String negotiatedBrokerProtocolVersion = "1.0";
111113
final Set<String> scopes = new HashSet<>();
112114
scopes.add("user.read");
113-
final String CLIENT_ID = "4b0db8c2-9f26-4417-8bde-3f0e3656f8e0";
114115
final String REDIRECT_URI = "msauth://com.microsoft.identity.client.sample.local/1wIqXSqBj7w%2Bh11ZifsnqwgyKrY%3D";
115116
final String CALLER_PACKAGE_NAME = ApplicationProvider.getApplicationContext().getPackageName();
116117
final String VERSION = "5.4.0";
@@ -145,7 +146,6 @@ public void test_getRequestBundleForAcquireTokenInteractive_forAccountTransfer()
145146
final String negotiatedBrokerProtocolVersion = "1.0";
146147
final Set<String> scopes = new HashSet<>();
147148
scopes.add("user.read");
148-
final String CLIENT_ID = "4b0db8c2-9f26-4417-8bde-3f0e3656f8e0";
149149
final String REDIRECT_URI = "msauth://com.microsoft.identity.client.sample.local/1wIqXSqBj7w%2Bh11ZifsnqwgyKrY%3D";
150150
final String CALLER_PACKAGE_NAME = ApplicationProvider.getApplicationContext().getPackageName();
151151
final String VERSION = "5.4.0";
@@ -195,7 +195,7 @@ public void test_BrokerRequestFromAcquireTokenParameters_SignInWithGoogleParamet
195195
final AndroidInteractiveTokenCommandParameters params = AndroidInteractiveTokenCommandParameters.builder()
196196
.platformComponents(components)
197197
.correlationId("987d8962-3f4d-4054-a852-ac0c4b6a602e")
198-
.clientId("4b0db8c2-9f26-4417-8bde-3f0e3656f8e0")
198+
.clientId(CLIENT_ID)
199199
.redirectUri("msauth://com.microsoft.identity.client.sample.local/1wIqXSqBj7w%2Bh11ZifsnqwgyKrY%3D")
200200
.applicationName("com.microsoft.identity.client.sample.local")
201201
.applicationVersion("1.0.0")
@@ -297,7 +297,7 @@ private void test_BrokerRequestFromAcquireTokenParametersInternal(final boolean
297297
final InteractiveTokenCommandParameters params = InteractiveTokenCommandParameters.builder()
298298
.platformComponents(components)
299299
.correlationId("987d8962-3f4d-4054-a852-ac0c4b6a602e")
300-
.clientId("4b0db8c2-9f26-4417-8bde-3f0e3656f8e0")
300+
.clientId(CLIENT_ID)
301301
.redirectUri("msauth://com.microsoft.identity.client.sample.local/1wIqXSqBj7w%2Bh11ZifsnqwgyKrY%3D")
302302
.applicationName("com.microsoft.identity.client.sample.local")
303303
.applicationVersion("1.0.0")

uiautomationutilities/src/main/java/com/microsoft/identity/client/ui/automation/app/OutlookApp.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -190,20 +190,6 @@ public void signInThroughSnackBar(@NonNull final String username,
190190
microsoftStsPromptHandler.handlePrompt(username, password);
191191
}
192192

193-
/**
194-
* Click the SIGN IN button shown through snackbar after a token expires, without handling the prompt that follows.
195-
*
196-
* @param username username to be signed in
197-
* @param password password to be used
198-
*/
199-
public void signInThroughSnackBarWithoutPrompt(@NonNull final String username,
200-
@NonNull final String password) {
201-
handleIntroDialogueAfterSignIn();
202-
203-
// Click SIGN IN Button in snackBar
204-
UiAutomatorUtils.handleButtonClick("com.microsoft.office.outlook:id/snackbar_action");
205-
}
206-
207193
/**
208194
* Check to see if the sign in snackbar is present in outlook
209195
* @return whether or not snackbar is present

0 commit comments

Comments
 (0)