-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1216 from github/1094-reclaim-mannequin-commands
Add `target-api-url` to reclaim mannequin and grant migrator commands
- Loading branch information
Showing
19 changed files
with
179 additions
and
15 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
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
44 changes: 44 additions & 0 deletions
44
...CLI.Tests/Octoshift/Commands/GenerateMannequinCsv/GenerateMannequinCsvCommandBaseTests.cs
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,44 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Moq; | ||
using OctoshiftCLI.Commands.GenerateMannequinCsv; | ||
using OctoshiftCLI.Contracts; | ||
using OctoshiftCLI.Services; | ||
using Xunit; | ||
|
||
namespace OctoshiftCLI.Tests.Octoshift.Commands.GeneerateMannequinCsv; | ||
|
||
public class GenerateMannequinCsvCommandBaseTests | ||
{ | ||
private readonly Mock<OctoLogger> _mockOctoLogger = TestHelpers.CreateMock<OctoLogger>(); | ||
private readonly Mock<ITargetGithubApiFactory> _mockGithubApiFactory = new(); | ||
private readonly ServiceProvider _serviceProvider; | ||
private readonly GenerateMannequinCsvCommandBase _command = new(); | ||
private const string GITHUB_ORG = "FooOrg"; | ||
|
||
public GenerateMannequinCsvCommandBaseTests() | ||
{ | ||
var serviceCollection = new ServiceCollection(); | ||
serviceCollection | ||
.AddSingleton(_mockOctoLogger.Object) | ||
.AddSingleton(_mockGithubApiFactory.Object); | ||
|
||
_serviceProvider = serviceCollection.BuildServiceProvider(); | ||
} | ||
|
||
[Fact] | ||
public void It_Uses_The_TargetApiUrl_When_Provided() | ||
{ | ||
var targetApiUrl = "TARGET-API-URL"; | ||
|
||
var args = new GenerateMannequinCsvCommandArgs | ||
{ | ||
GithubOrg = GITHUB_ORG, | ||
IncludeReclaimed = false, | ||
TargetApiUrl = targetApiUrl, | ||
}; | ||
|
||
_command.BuildHandler(args, _serviceProvider); | ||
|
||
_mockGithubApiFactory.Verify(m => m.Create(targetApiUrl, null)); | ||
} | ||
} |
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
47 changes: 47 additions & 0 deletions
47
...ctoshiftCLI.Tests/Octoshift/Commands/ReclaimMannequin/ReclaimMannequinCommandBaseTests.cs
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,47 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Moq; | ||
using OctoshiftCLI.Commands.ReclaimMannequin; | ||
using OctoshiftCLI.Contracts; | ||
using OctoshiftCLI.Services; | ||
using Xunit; | ||
|
||
namespace OctoshiftCLI.Tests.Octoshift.Commands.ReclaimMannequin; | ||
|
||
public class ReclaimMannequinCommandBaseTests | ||
{ | ||
private readonly Mock<OctoLogger> _mockOctoLogger = TestHelpers.CreateMock<OctoLogger>(); | ||
private readonly Mock<ConfirmationService> _mockConfirmationService = TestHelpers.CreateMock<ConfirmationService>(); | ||
private readonly Mock<ITargetGithubApiFactory> _mockGithubApiFactory = new(); | ||
private readonly ServiceProvider _serviceProvider; | ||
private readonly ReclaimMannequinCommandBase _command = new(); | ||
|
||
private const string GITHUB_ORG = "FooOrg"; | ||
|
||
public ReclaimMannequinCommandBaseTests() | ||
{ | ||
var serviceCollection = new ServiceCollection(); | ||
serviceCollection | ||
.AddSingleton(_mockOctoLogger.Object) | ||
.AddSingleton(_mockGithubApiFactory.Object) | ||
.AddSingleton(_mockConfirmationService.Object); | ||
|
||
_serviceProvider = serviceCollection.BuildServiceProvider(); | ||
} | ||
|
||
[Fact] | ||
public void It_Uses_The_TargetApiUrl_When_Provided() | ||
{ | ||
var targetApiUrl = "TARGET-API-URL"; | ||
|
||
var args = new ReclaimMannequinCommandArgs | ||
{ | ||
GithubOrg = GITHUB_ORG, | ||
Csv = "file.csv", | ||
TargetApiUrl = targetApiUrl, | ||
}; | ||
|
||
_command.BuildHandler(args, _serviceProvider); | ||
|
||
_mockGithubApiFactory.Verify(m => m.Create(targetApiUrl, null)); | ||
} | ||
} |
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
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
Oops, something went wrong.