mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-05 23:06:10 +00:00
Co-authored-by: Lehonti Ramos <john@doe> Co-authored-by: Keegan Campbell <me@kfcampbell.com>
54 lines
1.9 KiB
C#
54 lines
1.9 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
|
|
{
|
|
readonly 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
|
|
{
|
|
readonly 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);
|
|
}
|
|
}
|
|
}
|
|
} |