2424
2525import com .microsoft .identity .labapi .utilities .TestBuildConfig ;
2626import com .microsoft .identity .labapi .utilities .authentication .LabApiAuthenticationClient ;
27- import com .microsoft .identity .labapi .utilities .constants .AzureEnvironment ;
2827import com .microsoft .identity .labapi .utilities .constants .ProtectionPolicy ;
2928import com .microsoft .identity .labapi .utilities .constants .TempUserType ;
3029import com .microsoft .identity .labapi .utilities .constants .UserType ;
3433import org .junit .After ;
3534import org .junit .Assert ;
3635import org .junit .Before ;
37- import org .junit .Ignore ;
3836import org .junit .Rule ;
3937import 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 ());
0 commit comments