@@ -145,7 +145,7 @@ public async Task BitbucketHostProvider_GetCredentialAsync_Succeeds_ForValidStor
145
145
var context = new TestCommandContext ( ) ;
146
146
147
147
MockStoredAccount ( context , input , password ) ;
148
- MockRemoteBasicAuthAccountIsValid ( bitbucketApi , input , password , twoFactor : false ) ;
148
+ MockRemoteBasicValid ( bitbucketApi , input , password , twoFactor : false ) ;
149
149
150
150
var provider = new BitbucketHostProvider ( context , bitbucketAuthentication . Object , bitbucketApi . Object ) ;
151
151
@@ -163,7 +163,7 @@ public async Task BitbucketHostProvider_GetCredentialAsync_Succeeds_ForValidStor
163
163
}
164
164
165
165
// Stored credentials so don't ask for more
166
- VerifyInteractiveBasicAuthFlowNeverRan ( password , input , credential ) ;
166
+ VerifyInteractiveAuthNeverRan ( password , input , credential ) ;
167
167
168
168
// Valid Basic Auth credentials so don't run Oauth
169
169
VerifyInteractiveOAuthFlowNeverRan ( input , credential ) ;
@@ -179,7 +179,7 @@ public async Task BitbucketHostProvider_GetCredentialAsync_Succeeds_ForValidStor
179
179
var context = new TestCommandContext ( ) ;
180
180
181
181
MockStoredAccount ( context , input , token ) ;
182
- MockRemoteOAuthAccountIsValid ( bitbucketApi , input , token , false ) ;
182
+ MockRemoteAccessTokenValid ( bitbucketApi , input , token , false ) ;
183
183
184
184
var provider = new BitbucketHostProvider ( context , bitbucketAuthentication . Object , bitbucketApi . Object ) ;
185
185
@@ -189,7 +189,7 @@ public async Task BitbucketHostProvider_GetCredentialAsync_Succeeds_ForValidStor
189
189
VerifyValidateOAuthCredentialsRan ( ) ;
190
190
191
191
// Stored credentials so don't ask for more
192
- VerifyInteractiveBasicAuthFlowNeverRan ( token , input , credential ) ;
192
+ VerifyInteractiveAuthNeverRan ( token , input , credential ) ;
193
193
194
194
// Valid Basic Auth credentials so don't run Oauth
195
195
VerifyInteractiveOAuthFlowNeverRan ( input , credential ) ;
@@ -206,14 +206,14 @@ public async Task BitbucketHostProvider_GetCredentialAsync_Succeeds_ForFreshVali
206
206
207
207
var context = new TestCommandContext ( ) ;
208
208
209
- MockUserEntersValidBasicCredentials ( bitbucketAuthentication , input , password ) ;
209
+ MockPromptBasic ( bitbucketAuthentication , input , password ) ;
210
210
211
211
if ( BITBUCKET_DOT_ORG_HOST . Equals ( host ) )
212
212
{
213
- MockRemoteOAuthAccountIsValid ( bitbucketApi , input , password , true ) ;
213
+ MockRemoteAccessTokenValid ( bitbucketApi , input , password , true ) ;
214
214
}
215
215
216
- MockRemoteBasicAuthAccountIsValid ( bitbucketApi , input , password , twoFactor : false ) ;
216
+ MockRemoteBasicValid ( bitbucketApi , input , password , twoFactor : false ) ;
217
217
218
218
var provider = new BitbucketHostProvider ( context , bitbucketAuthentication . Object , bitbucketApi . Object ) ;
219
219
@@ -234,10 +234,10 @@ public async Task BitbucketHostProvider_GetCredentialAsync_Succeeds_ForFreshVali
234
234
var context = new TestCommandContext ( ) ;
235
235
236
236
// user is prompted for basic auth credentials
237
- MockUserEntersValidBasicCredentials ( bitbucketAuthentication , input , password ) ;
237
+ MockPromptBasic ( bitbucketAuthentication , input , password ) ;
238
238
// basic auth credentials are valid but 2FA is ON
239
- MockRemoteBasicAuthAccountIsValid ( bitbucketApi , input , password , twoFactor : true ) ;
240
- MockRemoteOAuthAccountIsValid ( bitbucketApi , input , password , true ) ;
239
+ MockRemoteBasicValid ( bitbucketApi , input , password , twoFactor : true ) ;
240
+ MockRemoteAccessTokenValid ( bitbucketApi , input , password , true ) ;
241
241
MockRemoteValidRefreshToken ( ) ;
242
242
243
243
var provider = new BitbucketHostProvider ( context , bitbucketAuthentication . Object , bitbucketApi . Object ) ;
@@ -265,8 +265,8 @@ public async Task BitbucketHostProvider_GetCredentialAsync_ForcedAuthMode_IsResp
265
265
context . Environment . Variables . Add ( BitbucketConstants . EnvironmentVariables . AuthenticationModes , preconfiguredAuthModes ) ;
266
266
}
267
267
268
- MockUserEntersValidBasicCredentials ( bitbucketAuthentication , input , password ) ;
269
- MockRemoteBasicAuthAccountIsValid ( bitbucketApi , input , password , twoFactor : true ) ;
268
+ MockPromptBasic ( bitbucketAuthentication , input , password ) ;
269
+ MockRemoteBasicValid ( bitbucketApi , input , password , twoFactor : true ) ;
270
270
bitbucketAuthentication . Setup ( m => m . ShowOAuthRequiredPromptAsync ( ) ) . ReturnsAsync ( true ) ;
271
271
272
272
var provider = new BitbucketHostProvider ( context , bitbucketAuthentication . Object , bitbucketApi . Object ) ;
@@ -283,7 +283,7 @@ public async Task BitbucketHostProvider_GetCredentialAsync_ForcedAuthMode_IsResp
283
283
284
284
if ( preconfiguredAuthModes . Contains ( "oauth" ) )
285
285
{
286
- VerifyInteractiveBasicAuthFlowNeverRan ( password , input , credential ) ;
286
+ VerifyInteractiveAuthNeverRan ( password , input , credential ) ;
287
287
VerifyInteractiveOAuthFlowRan ( password , input , credential ) ;
288
288
}
289
289
}
@@ -313,9 +313,9 @@ public async Task BitbucketHostProvider_GetCredentialAsync_AlwaysRefreshCredenti
313
313
}
314
314
315
315
MockStoredAccount ( context , input , password ) ;
316
- MockUserEntersValidBasicCredentials ( bitbucketAuthentication , input , password ) ;
317
- MockRemoteOAuthAccountIsValid ( bitbucketApi , input , password , true ) ;
318
- MockRemoteBasicAuthAccountIsValid ( bitbucketApi , input , password , twoFactor : false ) ;
316
+ MockPromptBasic ( bitbucketAuthentication , input , password ) ;
317
+ MockRemoteAccessTokenValid ( bitbucketApi , input , password , true ) ;
318
+ MockRemoteBasicValid ( bitbucketApi , input , password , twoFactor : false ) ;
319
319
320
320
var provider = new BitbucketHostProvider ( context , bitbucketAuthentication . Object , bitbucketApi . Object ) ;
321
321
@@ -389,8 +389,8 @@ public async Task BitbucketHostProvider_GetCredentialAsync_ValidateTargetUriAsyn
389
389
}
390
390
else
391
391
{
392
- MockUserEntersValidBasicCredentials ( bitbucketAuthentication , input , password ) ;
393
- MockRemoteBasicAuthAccountIsValid ( bitbucketApi , input , password , twoFactor : true ) ;
392
+ MockPromptBasic ( bitbucketAuthentication , input , password ) ;
393
+ MockRemoteBasicValid ( bitbucketApi , input , password , twoFactor : true ) ;
394
394
MockRemoteValidRefreshToken ( ) ;
395
395
bitbucketAuthentication . Setup ( m => m . ShowOAuthRequiredPromptAsync ( ) ) . ReturnsAsync ( true ) ;
396
396
bitbucketAuthentication . Setup ( m => m . CreateOAuthCredentialsAsync ( It . IsAny < Uri > ( ) ) ) . ReturnsAsync ( new OAuth2TokenResult ( MOCK_ACCESS_TOKEN , "access_token" ) ) ;
@@ -485,7 +485,7 @@ private void VerifyBasicAuthFlowNeverRan(string password, InputArguments input,
485
485
}
486
486
}
487
487
488
- private void VerifyInteractiveBasicAuthFlowNeverRan ( string password , InputArguments input , ICredential credential )
488
+ private void VerifyInteractiveAuthNeverRan ( string password , InputArguments input , ICredential credential )
489
489
{
490
490
var remoteUri = input . GetRemoteUri ( ) ;
491
491
@@ -579,14 +579,14 @@ private void MockRemoteValidRefreshToken()
579
579
bitbucketAuthentication . Setup ( m => m . RefreshOAuthCredentialsAsync ( MOCK_REFRESH_TOKEN ) ) . ReturnsAsync ( new OAuth2TokenResult ( MOCK_ACCESS_TOKEN , "access_token" ) ) ;
580
580
}
581
581
582
- private static void MockUserEntersValidBasicCredentials ( Mock < IBitbucketAuthentication > bitbucketAuthentication , InputArguments input , string password )
582
+ private static void MockPromptBasic ( Mock < IBitbucketAuthentication > bitbucketAuthentication , InputArguments input , string password )
583
583
{
584
584
var remoteUri = input . GetRemoteUri ( ) ;
585
585
bitbucketAuthentication . Setup ( m => m . GetCredentialsAsync ( remoteUri , input . UserName , It . IsAny < AuthenticationModes > ( ) ) )
586
586
. ReturnsAsync ( new CredentialsPromptResult ( AuthenticationModes . Basic , new TestCredential ( input . Host , input . UserName , password ) ) ) ;
587
587
}
588
588
589
- private static void MockRemoteBasicAuthAccountIsValid ( Mock < IBitbucketRestApi > bitbucketApi , InputArguments input , string password , bool twoFactor )
589
+ private static void MockRemoteBasicValid ( Mock < IBitbucketRestApi > bitbucketApi , InputArguments input , string password , bool twoFactor )
590
590
{
591
591
var userInfo = new UserInfo ( ) { IsTwoFactorAuthenticationEnabled = twoFactor } ;
592
592
// Basic
@@ -595,7 +595,7 @@ private static void MockRemoteBasicAuthAccountIsValid(Mock<IBitbucketRestApi> bi
595
595
596
596
}
597
597
598
- private static void MockRemoteOAuthAccountIsValid ( Mock < IBitbucketRestApi > bitbucketApi , InputArguments input , string password , bool twoFAEnabled )
598
+ private static void MockRemoteAccessTokenValid ( Mock < IBitbucketRestApi > bitbucketApi , InputArguments input , string password , bool twoFAEnabled )
599
599
{
600
600
var userInfo = new UserInfo ( ) { IsTwoFactorAuthenticationEnabled = twoFAEnabled } ;
601
601
// OAuth
0 commit comments