-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration tests for Migrations API.
- Loading branch information
Showing
2 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
103 changes: 103 additions & 0 deletions
103
Octokit.Tests.Integration/Clients/MigrationsClientTests.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,103 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Octokit; | ||
using Octokit.Tests.Integration; | ||
using Xunit; | ||
|
||
public class MigrationsClientTests | ||
{ | ||
public class TheStartNewMethod | ||
{ | ||
readonly IGitHubClient _gitHub; | ||
|
||
public TheStartNewMethod() | ||
{ | ||
_gitHub = Helper.GetAuthenticatedClient(); | ||
|
||
} | ||
|
||
[IntegrationTest] | ||
public async Task CanStartNewMigration() | ||
{ | ||
var organization = Environment.GetEnvironmentVariable("OCTOKIT_GITHUBORGANIZATION"); | ||
var repos = (await _gitHub.Repository.GetAllForOrg(organization)); | ||
var repoNames = repos.Select(repo => repo.FullName).ToList(); | ||
var migrationRequest = new StartMigrationRequest(repoNames); | ||
|
||
var migration = await _gitHub.Migration.Migrations.Start(organization, migrationRequest); | ||
|
||
Assert.Equal(repos.Count, migration.Repositories.Count); | ||
Assert.Equal("pending", migration.State); | ||
} | ||
} | ||
|
||
public class TheGetAllMethod | ||
{ | ||
readonly IGitHubClient _gitHub; | ||
|
||
public TheGetAllMethod() | ||
{ | ||
_gitHub = Helper.GetAuthenticatedClient(); | ||
} | ||
|
||
[IntegrationTest] | ||
public async Task CanGetAllMigrations() | ||
{ | ||
var organization = Environment.GetEnvironmentVariable("OCTOKIT_GITHUBORGANIZATION"); | ||
var migrations = await _gitHub.Migration.Migrations.GetAll(organization); | ||
|
||
Assert.NotNull(migrations); | ||
Assert.NotEqual(0, migrations.Count); | ||
} | ||
} | ||
|
||
public class TheGetMethod | ||
{ | ||
readonly IGitHubClient _gitHub; | ||
|
||
public TheGetMethod() | ||
{ | ||
_gitHub = Helper.GetAuthenticatedClient(); | ||
} | ||
|
||
[IntegrationTest] | ||
public async Task CanGetMigration() | ||
{ | ||
var organization = Environment.GetEnvironmentVariable("OCTOKIT_GITHUBORGANIZATION"); | ||
var repos = (await _gitHub.Repository.GetAllForOrg(organization)); | ||
var repoNames = repos.Select(repo => repo.FullName).ToList(); | ||
var migrationRequest = new StartMigrationRequest(repoNames); | ||
var migration = await _gitHub.Migration.Migrations.Start(organization, migrationRequest); | ||
|
||
var retreivedMigration = await _gitHub.Migration.Migrations.Get(organization, migration.Id); | ||
|
||
Assert.Equal(migration.Guid, retreivedMigration.Guid); | ||
} | ||
} | ||
|
||
public class TheGetArchiveMethod | ||
{ | ||
readonly IGitHubClient _gitHub; | ||
|
||
public TheGetArchiveMethod() | ||
{ | ||
_gitHub = Helper.GetAuthenticatedClient(); | ||
} | ||
|
||
[IntegrationTest] | ||
public async Task CanGetArchive() | ||
{ | ||
var organization = Environment.GetEnvironmentVariable("OCTOKIT_GITHUBORGANIZATION"); | ||
var repos = (await _gitHub.Repository.GetAllForOrg(organization)); | ||
var repoNames = repos.Select(repo => repo.FullName).ToList(); | ||
var migrationRequest = new StartMigrationRequest(repoNames); | ||
var migration = await _gitHub.Migration.Migrations.Start(organization, migrationRequest); | ||
|
||
var url = await _gitHub.Migration.Migrations.GetArchive(organization, migration.Id); | ||
|
||
Assert.NotEmpty(url); | ||
} | ||
} | ||
} |
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