Skip to content

Commit f45a505

Browse files
committed
bb-test: update tests to await ICredential results
1 parent f128d21 commit f45a505

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

src/shared/Atlassian.Bitbucket.Tests/BitbucketHostProviderTest.cs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public void BitbucketHostProvider_IsSupported_HttpResponseMessage(string header,
138138
[Theory]
139139
[InlineData("https", DC_SERVER_HOST, "jsquire", "password")]
140140
[InlineData("https", BITBUCKET_DOT_ORG_HOST, "jsquire", "password")]
141-
public void BitbucketHostProvider_GetCredentialAsync_Succeeds_ForValidStoredBasicAuthAccount(string protocol, string host, string username,string password)
141+
public async Task BitbucketHostProvider_GetCredentialAsync_Succeeds_ForValidStoredBasicAuthAccount(string protocol, string host, string username,string password)
142142
{
143143
InputArguments input = MockInput(protocol, host, username);
144144

@@ -149,7 +149,7 @@ public void BitbucketHostProvider_GetCredentialAsync_Succeeds_ForValidStoredBasi
149149

150150
var provider = new BitbucketHostProvider(context, bitbucketAuthentication.Object, bitbucketApi.Object);
151151

152-
var credential = provider.GetCredentialAsync(input);
152+
var credential = await provider.GetCredentialAsync(input);
153153

154154
//verify bitbucket.org credentials were validated
155155
if (BITBUCKET_DOT_ORG_HOST.Equals(host))
@@ -172,7 +172,7 @@ public void BitbucketHostProvider_GetCredentialAsync_Succeeds_ForValidStoredBasi
172172
[Theory]
173173
// DC/Server does not currently support OAuth
174174
[InlineData("https", BITBUCKET_DOT_ORG_HOST, "jsquire", "password")]
175-
public void BitbucketHostProvider_GetCredentialAsync_Succeeds_ForValidStoredOAuthAccount(string protocol, string host, string username,string token)
175+
public async Task BitbucketHostProvider_GetCredentialAsync_Succeeds_ForValidStoredOAuthAccount(string protocol, string host, string username,string token)
176176
{
177177
InputArguments input = MockInput(protocol, host, username);
178178

@@ -183,7 +183,7 @@ public void BitbucketHostProvider_GetCredentialAsync_Succeeds_ForValidStoredOAut
183183

184184
var provider = new BitbucketHostProvider(context, bitbucketAuthentication.Object, bitbucketApi.Object);
185185

186-
var credential = provider.GetCredentialAsync(input);
186+
var credential = await provider.GetCredentialAsync(input);
187187

188188
//verify bitbucket.org credentials were validated
189189
VerifyValidateOAuthCredentialsRan();
@@ -200,7 +200,7 @@ public void BitbucketHostProvider_GetCredentialAsync_Succeeds_ForValidStoredOAut
200200
[InlineData("https", DC_SERVER_HOST, "jsquire", "password")]
201201
// cloud
202202
[InlineData("https", BITBUCKET_DOT_ORG_HOST, "jsquire", "password")]
203-
public void BitbucketHostProvider_GetCredentialAsync_Succeeds_ForFreshValidBasicAuthAccount(string protocol, string host, string username, string password)
203+
public async Task BitbucketHostProvider_GetCredentialAsync_Succeeds_ForFreshValidBasicAuthAccount(string protocol, string host, string username, string password)
204204
{
205205
InputArguments input = MockInput(protocol, host, username);
206206

@@ -217,7 +217,7 @@ public void BitbucketHostProvider_GetCredentialAsync_Succeeds_ForFreshValidBasic
217217

218218
var provider = new BitbucketHostProvider(context, bitbucketAuthentication.Object, bitbucketApi.Object);
219219

220-
var credential = provider.GetCredentialAsync(input);
220+
var credential = await provider.GetCredentialAsync(input);
221221

222222
VerifyBasicAuthFlowRan(password, true, input, credential);
223223

@@ -227,7 +227,7 @@ public void BitbucketHostProvider_GetCredentialAsync_Succeeds_ForFreshValidBasic
227227
[Theory]
228228
// DC/Server does not currently support OAuth
229229
[InlineData("https", BITBUCKET_DOT_ORG_HOST, "jsquire", MOCK_ACCESS_TOKEN)]
230-
public void BitbucketHostProvider_GetCredentialAsync_Succeeds_ForFreshValid2FAAcccount(string protocol, string host, string username, string password)
230+
public async Task BitbucketHostProvider_GetCredentialAsync_Succeeds_ForFreshValid2FAAcccount(string protocol, string host, string username, string password)
231231
{
232232
var input = MockInput(protocol, host, username);
233233

@@ -242,7 +242,7 @@ public void BitbucketHostProvider_GetCredentialAsync_Succeeds_ForFreshValid2FAAc
242242

243243
var provider = new BitbucketHostProvider(context, bitbucketAuthentication.Object, bitbucketApi.Object);
244244

245-
var credential = provider.GetCredentialAsync(input);
245+
var credential = await provider.GetCredentialAsync(input);
246246

247247
VerifyOAuthFlowRan(password, false, true, input, credential, null);
248248

@@ -254,7 +254,7 @@ public void BitbucketHostProvider_GetCredentialAsync_Succeeds_ForFreshValid2FAAc
254254
[InlineData("https", BITBUCKET_DOT_ORG_HOST, "jsquire", "password", "basic")]
255255
[InlineData("https", BITBUCKET_DOT_ORG_HOST, "jsquire", "password", "oauth")]
256256
// Basic Auth works
257-
public void BitbucketHostProvider_GetCredentialAsync_ForcedAuthMode_IsRespected(string protocol, string host, string username, string password,
257+
public async Task BitbucketHostProvider_GetCredentialAsync_ForcedAuthMode_IsRespected(string protocol, string host, string username, string password,
258258
string preconfiguredAuthModes)
259259
{
260260
var input = MockInput(protocol, host, username);
@@ -271,7 +271,7 @@ public void BitbucketHostProvider_GetCredentialAsync_ForcedAuthMode_IsRespected(
271271

272272
var provider = new BitbucketHostProvider(context, bitbucketAuthentication.Object, bitbucketApi.Object);
273273

274-
var credential = provider.GetCredentialAsync(input);
274+
var credential = await provider.GetCredentialAsync(input);
275275

276276
Assert.NotNull(credential);
277277

@@ -301,7 +301,7 @@ public void BitbucketHostProvider_GetCredentialAsync_ForcedAuthMode_IsRespected(
301301
[InlineData("https", DC_SERVER_HOST, "jsquire", "password", "1")]
302302
[InlineData("https", DC_SERVER_HOST, "jsquire", "password", "true")]
303303
[InlineData("https", DC_SERVER_HOST, "jsquire", "password", null)]
304-
public void BitbucketHostProvider_GetCredentialAsync_AlwaysRefreshCredentials_IsRespected(string protocol, string host, string username, string password,
304+
public async Task BitbucketHostProvider_GetCredentialAsync_AlwaysRefreshCredentials_IsRespected(string protocol, string host, string username, string password,
305305
string alwaysRefreshCredentials)
306306
{
307307
var input = MockInput(protocol, host, username);
@@ -319,7 +319,7 @@ public void BitbucketHostProvider_GetCredentialAsync_AlwaysRefreshCredentials_Is
319319

320320
var provider = new BitbucketHostProvider(context, bitbucketAuthentication.Object, bitbucketApi.Object);
321321

322-
var credential = provider.GetCredentialAsync(input);
322+
var credential = await provider.GetCredentialAsync(input);
323323

324324
var alwaysRefreshCredentialsBool = "1".Equals(alwaysRefreshCredentials)
325325
|| "on".Equals(alwaysRefreshCredentials)
@@ -450,7 +450,7 @@ private static InputArguments MockInput(string protocol, string host, string use
450450
});
451451
}
452452

453-
private void VerifyBasicAuthFlowRan(string password, bool expected, InputArguments input, Task<ICredential> credential)
453+
private void VerifyBasicAuthFlowRan(string password, bool expected, InputArguments input, ICredential credential)
454454
{
455455
Assert.Equal(expected, credential != null);
456456

@@ -459,7 +459,7 @@ private void VerifyBasicAuthFlowRan(string password, bool expected, InputArgumen
459459
bitbucketAuthentication.Verify(m => m.GetCredentialsAsync(remoteUri, input.UserName, It.IsAny<AuthenticationModes>()), Times.Once);
460460
}
461461

462-
private void VerifyInteractiveBasicAuthFlowRan(string password, InputArguments input, Task<ICredential> credential)
462+
private void VerifyInteractiveBasicAuthFlowRan(string password, InputArguments input, ICredential credential)
463463
{
464464
var remoteUri = input.GetRemoteUri();
465465

@@ -485,14 +485,14 @@ private void VerifyBasicAuthFlowNeverRan(string password, InputArguments input,
485485
}
486486
}
487487

488-
private void VerifyInteractiveBasicAuthFlowNeverRan(string password, InputArguments input, Task<ICredential> credential)
488+
private void VerifyInteractiveBasicAuthFlowNeverRan(string password, InputArguments input, ICredential credential)
489489
{
490490
var remoteUri = input.GetRemoteUri();
491491

492492
bitbucketAuthentication.Verify(m => m.GetCredentialsAsync(remoteUri, input.UserName, It.IsAny<AuthenticationModes>()), Times.Never);
493493
}
494494

495-
private void VerifyOAuthFlowRan(string password, bool storedAccount, bool expected, InputArguments input, Task<ICredential> credential,
495+
private void VerifyOAuthFlowRan(string password, bool storedAccount, bool expected, InputArguments input, ICredential credential,
496496
string preconfiguredAuthModes)
497497
{
498498
Assert.Equal(expected, credential != null);
@@ -517,7 +517,7 @@ private void VerifyOAuthFlowRan(string password, bool storedAccount, bool expect
517517
}
518518
}
519519

520-
private void VerifyInteractiveOAuthFlowRan(string password, InputArguments input, System.Threading.Tasks.Task<ICredential> credential)
520+
private void VerifyInteractiveOAuthFlowRan(string password, InputArguments input, ICredential credential)
521521
{
522522
var remoteUri = input.GetRemoteUri();
523523

@@ -526,7 +526,7 @@ private void VerifyInteractiveOAuthFlowRan(string password, InputArguments input
526526

527527
}
528528

529-
private void VerifyOAuthFlowDidNotRun(string password, bool expected, InputArguments input, System.Threading.Tasks.Task<ICredential> credential)
529+
private void VerifyOAuthFlowDidNotRun(string password, bool expected, InputArguments input, ICredential credential)
530530
{
531531
Assert.Equal(expected, credential != null);
532532

@@ -542,7 +542,7 @@ private void VerifyOAuthFlowDidNotRun(string password, bool expected, InputArgum
542542
bitbucketApi.Verify(m => m.GetUserInformationAsync(null, MOCK_ACCESS_TOKEN, true), Times.Never);
543543
}
544544

545-
private void VerifyInteractiveOAuthFlowNeverRan(InputArguments input, System.Threading.Tasks.Task<ICredential> credential)
545+
private void VerifyInteractiveOAuthFlowNeverRan(InputArguments input, ICredential credential)
546546
{
547547
var remoteUri = input.GetRemoteUri();
548548

0 commit comments

Comments
 (0)