Skip to content

Commit 81eccb9

Browse files
committed
bb-test: remove unused test helpers
1 parent 2babadc commit 81eccb9

File tree

1 file changed

+0
-46
lines changed

1 file changed

+0
-46
lines changed

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

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -568,53 +568,24 @@ private void VerifyValidateBasicAuthCredentialsRan()
568568
bitbucketApi.Verify(m => m.GetUserInformationAsync(It.IsAny<string>(), It.IsAny<string>(), false), Times.Once);
569569
}
570570

571-
private void VerifyValidateOAuthCredentialsNeverRan()
572-
{
573-
// never check username/password works
574-
bitbucketApi.Verify(m => m.GetUserInformationAsync(null, It.IsAny<string>(), false), Times.Never);
575-
}
576-
577571
private void VerifyValidateOAuthCredentialsRan()
578572
{
579573
// check username/password works
580574
bitbucketApi.Verify(m => m.GetUserInformationAsync(null, It.IsAny<string>(), true), Times.Once);
581575
}
582576

583-
private void MockStoredOAuthAccount(TestCommandContext context, InputArguments input)
584-
{
585-
// refresh token
586-
context.CredentialStore.Add("https://bitbucket.org/refresh_token", new TestCredential(input.Host, input.UserName, MOCK_REFRESH_TOKEN));
587-
// auth token
588-
context.CredentialStore.Add("https://bitbucket.org", new TestCredential(input.Host, input.UserName, MOCK_ACCESS_TOKEN));
589-
}
590-
591577
private void MockRemoteValidRefreshToken()
592578
{
593579
bitbucketAuthentication.Setup(m => m.RefreshOAuthCredentialsAsync(MOCK_REFRESH_TOKEN)).ReturnsAsync(new OAuth2TokenResult(MOCK_ACCESS_TOKEN, "access_token"));
594580
}
595581

596-
private static void MockInvalidRemoteBasicAccount(Mock<IBitbucketRestApi> bitbucketApi, Mock<IBitbucketAuthentication> bitbucketAuthentication)
597-
{
598-
bitbucketAuthentication.Setup(m => m.GetCredentialsAsync(It.IsAny<Uri>(), It.IsAny<String>(), It.IsAny<AuthenticationModes>()))
599-
.ReturnsAsync(new CredentialsPromptResult(AuthenticationModes.Basic, null));
600-
601-
bitbucketApi.Setup(x => x.GetUserInformationAsync(It.IsAny<String>(), It.IsAny<String>(), false))
602-
.ReturnsAsync(new RestApiResult<UserInfo>(System.Net.HttpStatusCode.Unauthorized));
603-
604-
}
605582
private static void MockUserEntersValidBasicCredentials(Mock<IBitbucketAuthentication> bitbucketAuthentication, InputArguments input, string password)
606583
{
607584
var remoteUri = input.GetRemoteUri();
608585
bitbucketAuthentication.Setup(m => m.GetCredentialsAsync(remoteUri, input.UserName, It.IsAny<AuthenticationModes>()))
609586
.ReturnsAsync(new CredentialsPromptResult(AuthenticationModes.Basic, new TestCredential(input.Host, input.UserName, password)));
610587
}
611588

612-
private static void MockUserDoesNotEntersValidBasicCredentials(Mock<IBitbucketAuthentication> bitbucketAuthentication)
613-
{
614-
bitbucketAuthentication.Setup(m => m.GetCredentialsAsync(It.IsAny<Uri>(), It.IsAny<String>(), It.IsAny<AuthenticationModes>()))
615-
.ReturnsAsync(new CredentialsPromptResult(AuthenticationModes.Basic, null));
616-
}
617-
618589
private static void MockRemoteBasicAuthAccountIsValid(Mock<IBitbucketRestApi> bitbucketApi, InputArguments input, string password, bool twoFactor)
619590
{
620591
var userInfo = new UserInfo() { IsTwoFactorAuthenticationEnabled = twoFactor };
@@ -624,15 +595,6 @@ private static void MockRemoteBasicAuthAccountIsValid(Mock<IBitbucketRestApi> bi
624595

625596
}
626597

627-
private static void MockRemoteBasicAuthAccountIsInvalid(Mock<IBitbucketRestApi> bitbucketApi, InputArguments input, string password)
628-
{
629-
var userInfo = new UserInfo();
630-
// Basic
631-
bitbucketApi.Setup(x => x.GetUserInformationAsync(input.UserName, password, false))
632-
.ReturnsAsync(new RestApiResult<UserInfo>(System.Net.HttpStatusCode.Forbidden, userInfo));
633-
634-
}
635-
636598
private static void MockRemoteOAuthAccountIsValid(Mock<IBitbucketRestApi> bitbucketApi, InputArguments input, string password, bool twoFAEnabled)
637599
{
638600
var userInfo = new UserInfo() { IsTwoFactorAuthenticationEnabled = twoFAEnabled };
@@ -648,14 +610,6 @@ private static void MockStoredAccount(TestCommandContext context, InputArguments
648610
context.CredentialStore.Add(remoteUrl, new TestCredential(input.Host, input.UserName, password));
649611
}
650612

651-
private static void MockValidStoredOAuthUser(TestCommandContext context, Mock<IBitbucketRestApi> bitbucketApi)
652-
{
653-
var userInfo = new UserInfo() { IsTwoFactorAuthenticationEnabled = false };
654-
bitbucketApi.Setup(x => x.GetUserInformationAsync("jsquire", "password1", false))
655-
.ReturnsAsync(new RestApiResult<UserInfo>(System.Net.HttpStatusCode.OK, userInfo));
656-
context.CredentialStore.Add("https://bitbucket.org", new TestCredential("https://bitbucket.org", "jsquire", "password1"));
657-
}
658-
659613
#endregion
660614
}
661615
}

0 commit comments

Comments
 (0)