Files
octokit.net/Octokit.Tests.Integration/Reactive/ObservableGitHubAppInstallationsClientTests.cs
Stanley Goldman 5f1421bd34 Additional GitHub Apps APIs (#1854)
* Adding functionality to query installations for user

* Rename method

* Adding installation methods

* Adding tests

* Adding observable client methods

* Adding InstallationResponse

* Adding GitHub Apps Installations Client

* Tweaking doc comments

* Undoing unintentional changes and cleaning up

* Reordering functions in clients to keep the same code look and feel

* Making sure all methods are documented with their authentication requirements

* Syntax error

* Renaming methods and tests

* Renaming property

* Test cleanup

* XmlDoc comment fixups and consistency

* rename User -To-Server auth methods from xxxForUser to xxxForCurrentUser

* rename GitHubAppsInstallationsClient to GitHubAppInstallationsClient to be consistent with single/plural naming conventions

* make method order match the order on github docs site

* tidy up usings

* correct implementation of GetALlInstallationsForCurrent method to be consistent

* Add missing unit and integration tests for ObservableGitHubAppsClient

* fix renamed method in observable tests

* Add EnsuresNonEmptyArguments tests and fixup asserts in GitHubAppsClient

* Add tests for new Observable client methods and fixup Null/Empty asserts in Observable client

* change non paginated call to call through to other method but with ApiOptions.None

* add unit tests for observable client and fixup errors they found

* add integration tests for new GitHubAppsClient methods, fixed an incorrect route that the tests found!

* add integration tests for extra methods on observable client

* add integration tests for new clients GitHubAppInstallationsClient and ObservableGitHubAppInstallationsClient

* deprecate renamed method properly, to avoid breaking change
2018-09-03 20:36:33 +10:00

54 lines
1.8 KiB
C#

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);
}
}
}
}