-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reintroduce api factories into ado2gh (#202)
- Loading branch information
1 parent
dd866b4
commit 0332324
Showing
38 changed files
with
390 additions
and
128 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Release Notes | ||
|
||
- Renamed the CLI from octoshift to ado2gh to indicate that this one is specifically for Azure DevOps -> GitHub migrations (in the future there will be additional CLI's for other migration scenarios) | ||
- Released gei.exe that adds support for Github -> Github migrations (GHEC only for now). In the future this will be exposed as an extension to the Github CLI. | ||
- Released an extension for the official GitHub CLI that adds support for GitHub -> GitHub migrations (GHEC only for now). To install run: `gh extension install github/gh-gei`. To use run: `gh gei --help` | ||
- Automatically remove secrets from log files and console output (previously the verbose logs would contain your PAT's) | ||
- Added --ssh option to generate-script and migrate-repo commands (in both ado2gh and gei). This forces the migration to use an older version of the API's that uses SSH to push the repos into GitHub. The newer API's use HTTPS instead. However some customers have been running into problems with some repos that work fine using the older SSH API's. In the future this option will be deprecated once the issues with the HTTPS-based API's are resolved. | ||
- Added --ssh option to generate-script and migrate-repo commands (in both ado2gh and gh). This forces the migration to use an older version of the API's that uses SSH to push the repos into GitHub. The newer API's use HTTPS instead. However some customers have been running into problems with some repos that work fine using the older SSH API's. In the future this option will be deprecated once the issues with the HTTPS-based API's are resolved. |
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,36 @@ | ||
using System; | ||
using System.Net.Http; | ||
using System.Text; | ||
using FluentAssertions; | ||
using Moq; | ||
using OctoshiftCLI.AdoToGithub; | ||
using Xunit; | ||
|
||
namespace OctoshiftCLI.Tests.AdoToGithub | ||
{ | ||
public class AdoApiFactoryTests | ||
{ | ||
private const string ADO_PAT = "ADO_PAT"; | ||
|
||
[Fact] | ||
public void Create_Should_Create_Ado_Api_With_Ado_Pat() | ||
{ | ||
// Arrange | ||
var environmentVariableProviderMock = new Mock<EnvironmentVariableProvider>(null); | ||
environmentVariableProviderMock.Setup(m => m.AdoPersonalAccessToken()).Returns(ADO_PAT); | ||
|
||
using var httpClient = new HttpClient(); | ||
|
||
// Act | ||
var factory = new AdoApiFactory(null, httpClient, environmentVariableProviderMock.Object); | ||
var result = factory.Create(); | ||
|
||
// Assert | ||
result.Should().NotBeNull(); | ||
|
||
var authToken = Convert.ToBase64String(Encoding.ASCII.GetBytes($":{ADO_PAT}")); | ||
httpClient.DefaultRequestHeaders.Authorization.Parameter.Should().Be(authToken); | ||
httpClient.DefaultRequestHeaders.Authorization.Scheme.Should().Be("Basic"); | ||
} | ||
} | ||
} |
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
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
File renamed without changes.
Oops, something went wrong.