-
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 new clients GitHubAppInstallationsClient an…
…d ObservableGitHubAppInstallationsClient
- Loading branch information
1 parent
bb53032
commit 86d4514
Showing
4 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
Octokit.Tests.Integration/Clients/GitHubAppInstallationsClientTests.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,52 @@ | ||
using System.Threading.Tasks; | ||
using Octokit.Tests.Integration; | ||
using Xunit; | ||
|
||
namespace Octokit.Tests.Clients | ||
{ | ||
public class GitHubAppInstallationsClientTests | ||
{ | ||
public class TheGetAllRepositoriesForCurrentMethod | ||
{ | ||
IGitHubClient _github; | ||
|
||
public TheGetAllRepositoriesForCurrentMethod() | ||
{ | ||
// Authenticate as a GitHubApp Installation | ||
_github = Helper.GetAuthenticatedGitHubAppInstallationForOwner(Helper.UserName); | ||
} | ||
|
||
[GitHubAppsTest] | ||
public async Task GetsAllRepositories() | ||
{ | ||
var result = await _github.GitHubApps.Installation.GetAllRepositoriesForCurrent(); | ||
|
||
Assert.NotNull(result); | ||
Assert.True(result.TotalCount > 0); | ||
} | ||
} | ||
|
||
public class TheGetAllRepositoriesForCurrentUserMethod | ||
{ | ||
IGitHubClient _github; | ||
|
||
public TheGetAllRepositoriesForCurrentUserMethod() | ||
{ | ||
// Need to Authenticate as User to Server but not possible without receiving redirect from github.com | ||
//_github = Helper.GetAuthenticatedUserToServer(); | ||
_github = null; | ||
} | ||
|
||
[GitHubAppsTest(Skip = "Not possible to authenticate with User to Server auth")] | ||
public async Task GetsAllRepositories() | ||
{ | ||
var installationId = Helper.GetGitHubAppInstallationForOwner(Helper.UserName).Id; | ||
|
||
var result = await _github.GitHubApps.Installation.GetAllRepositoriesForCurrentUser(installationId); | ||
|
||
Assert.NotNull(result); | ||
Assert.True(result.TotalCount > 0); | ||
} | ||
} | ||
} | ||
} |
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
54 changes: 54 additions & 0 deletions
54
Octokit.Tests.Integration/Reactive/ObservableGitHubAppInstallationsClientTests.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,54 @@ | ||
using System.Reactive.Linq; | ||
using System.Threading.Tasks; | ||
using Octokit.Reactive; | ||
using Octokit.Tests.Integration; | ||
using Xunit; | ||
|
||
namespace Octokit.Tests.Clients | ||
{ | ||
public class ObservableGitHubAppInstallationsClientTests | ||
{ | ||
public class TheGetAllRepositoriesForCurrentMethod | ||
{ | ||
IObservableGitHubClient _github; | ||
|
||
public TheGetAllRepositoriesForCurrentMethod() | ||
{ | ||
// Authenticate as a GitHubApp Installation | ||
_github = new ObservableGitHubClient(Helper.GetAuthenticatedGitHubAppInstallationForOwner(Helper.UserName)); | ||
} | ||
|
||
[GitHubAppsTest] | ||
public async Task GetsAllRepositories() | ||
{ | ||
var result = await _github.GitHubApps.Installation.GetAllRepositoriesForCurrent(); | ||
|
||
Assert.NotNull(result); | ||
Assert.True(result.TotalCount > 0); | ||
} | ||
} | ||
|
||
public class TheGetAllRepositoriesForCurrentUserMethod | ||
{ | ||
IObservableGitHubClient _github; | ||
|
||
public TheGetAllRepositoriesForCurrentUserMethod() | ||
{ | ||
// Need to Authenticate as User to Server but not possible without receiving redirect from github.com | ||
//_github = new ObservableGitHubClient(Helper.GetAuthenticatedUserToServer()); | ||
_github = null; | ||
} | ||
|
||
[GitHubAppsTest(Skip = "Not possible to authenticate with User to Server auth")] | ||
public async Task GetsAllRepositories() | ||
{ | ||
var installationId = Helper.GetGitHubAppInstallationForOwner(Helper.UserName).Id; | ||
|
||
var result = await _github.GitHubApps.Installation.GetAllRepositoriesForCurrentUser(installationId); | ||
|
||
Assert.NotNull(result); | ||
Assert.True(result.TotalCount > 0); | ||
} | ||
} | ||
} | ||
} |
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