forked from microsoft/Git-Credential-Manager-for-Windows
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bitbucket: fix and test microsoft#651
Issue-651 Basic fix and test to allow Bitbucket authentication to work again.
- Loading branch information
Showing
3 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using Atlassian.Bitbucket.Authentication; | ||
using GitHub.Authentication; | ||
using Microsoft.Alm.Authentication; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
namespace Bitbucket.Authentication.Test | ||
{ | ||
public class AuthorityTest | ||
{ | ||
[Fact] | ||
public async void VerifyAcquireTokenAcceptsValidAuthenticationResultTypes() | ||
{ | ||
var context = RuntimeContext.Default; | ||
var authority = new Authority(context); | ||
var targetUri = new TargetUri("https://bitbucket.org"); | ||
var credentials = new Credential("a", "b"); | ||
var resultType = AuthenticationResultType.None; | ||
var tokenScope = Atlassian.Bitbucket.Authentication.TokenScope.None; | ||
|
||
var values = Enum.GetValues(typeof(AuthenticationResultType)).Cast<AuthenticationResultType>(); | ||
values.ToList().ForEach(async _ => | ||
{ | ||
var token = await authority.AcquireToken(targetUri, credentials, resultType, tokenScope); | ||
Assert.NotNull(token); | ||
}); | ||
} | ||
} | ||
} |