Skip to content

Commit

Permalink
add integration tests for new clients GitHubAppInstallationsClient an…
Browse files Browse the repository at this point in the history
…d ObservableGitHubAppInstallationsClient
  • Loading branch information
ryangribble committed Aug 29, 2018
1 parent bb53032 commit 86d4514
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 0 deletions.
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);
}
}
}
}
1 change: 1 addition & 0 deletions Octokit.Tests.Integration/Clients/GitHubAppsClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public async Task GetsAllInstallationsForCurrentUser()
var result = await _github.GitHubApps.GetAllInstallationsForCurrentUser();

Assert.NotNull(result);
Assert.True(result.TotalCount > 0);
}
}

Expand Down
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);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public async Task GetsAllInstallationsForCurrentUser()
var result = await _github.GitHubApps.GetAllInstallationsForCurrentUser();

Assert.NotNull(result);
Assert.True(result.TotalCount > 0);
}
}

Expand Down

0 comments on commit 86d4514

Please sign in to comment.