mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-05 03:30:34 +00:00
Merge branch 'master' of https://github.com/octokit/octokit.net
updating fork
This commit is contained in:
+2
-2
@@ -14,10 +14,10 @@ namespace Octokit.Tests.Integration
|
||||
|
||||
readonly string _testUser = "test-user";
|
||||
readonly string _distinguishedNameUser = "uid=test-user,ou=users,dc=company,dc=com";
|
||||
|
||||
|
||||
readonly EnterpriseTeamContext _context;
|
||||
readonly string _distinguishedNameTeam = "cn=test-team,ou=groups,dc=company,dc=com";
|
||||
|
||||
|
||||
public ObservableEnterpriseLdapClientTests()
|
||||
{
|
||||
_github = new ObservableGitHubClient(EnterpriseHelper.GetAuthenticatedClient());
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Octokit.Reactive;
|
||||
using Xunit;
|
||||
|
||||
namespace Octokit.Tests.Integration.Reactive
|
||||
{
|
||||
public class ObservableAssigneesClientTests
|
||||
{
|
||||
public class TheGetAllMethod
|
||||
{
|
||||
readonly ObservableAssigneesClient _assigneesClient;
|
||||
const string owner = "octokit";
|
||||
const string name = "octokit.net";
|
||||
|
||||
public TheGetAllMethod()
|
||||
{
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
|
||||
_assigneesClient = new ObservableAssigneesClient(github);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsAssignees()
|
||||
{
|
||||
var assignees = await _assigneesClient.GetAllForRepository(owner, name).ToList();
|
||||
|
||||
Assert.NotEmpty(assignees);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsCorrectCountOfAssigneesWithoutStart()
|
||||
{
|
||||
var options = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
PageCount = 1
|
||||
};
|
||||
|
||||
var assignees = await _assigneesClient.GetAllForRepository(owner, name, options).ToList();
|
||||
|
||||
Assert.Equal(5, assignees.Count);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsCorrectCountOfAssigneesWithStart()
|
||||
{
|
||||
var options = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
PageCount = 1,
|
||||
StartPage = 2
|
||||
};
|
||||
|
||||
var releases = await _assigneesClient.GetAllForRepository(owner, name, options).ToList();
|
||||
|
||||
Assert.Equal(5, releases.Count);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsDistinctResultsBasedOnStartPage()
|
||||
{
|
||||
var startOptions = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
PageCount = 1
|
||||
};
|
||||
|
||||
var firstPage = await _assigneesClient.GetAllForRepository(owner, name, startOptions).ToList();
|
||||
|
||||
var skipStartOptions = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
PageCount = 1,
|
||||
StartPage = 2
|
||||
};
|
||||
|
||||
var secondPage = await _assigneesClient.GetAllForRepository(owner, name, skipStartOptions).ToList();
|
||||
|
||||
Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
|
||||
Assert.NotEqual(firstPage[1].Id, secondPage[1].Id);
|
||||
Assert.NotEqual(firstPage[2].Id, secondPage[2].Id);
|
||||
Assert.NotEqual(firstPage[3].Id, secondPage[3].Id);
|
||||
Assert.NotEqual(firstPage[4].Id, secondPage[4].Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Octokit.Reactive;
|
||||
using Xunit;
|
||||
|
||||
namespace Octokit.Tests.Integration.Reactive
|
||||
{
|
||||
public class ObservableAuthorizationsClientTests
|
||||
{
|
||||
readonly ObservableAuthorizationsClient _authorizationsClient;
|
||||
|
||||
public ObservableAuthorizationsClientTests()
|
||||
{
|
||||
var github = Helper.GetBasicAuthClient();
|
||||
|
||||
_authorizationsClient = new ObservableAuthorizationsClient(github);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanGetAuthorization()
|
||||
{
|
||||
var authorization = await _authorizationsClient.GetAll();
|
||||
Assert.NotNull(authorization);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanGetAuthorizationWithApiOptions()
|
||||
{
|
||||
var authorization = await _authorizationsClient.GetAll(ApiOptions.None);
|
||||
Assert.NotNull(authorization);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsNotEmptyAuthorizationsWithoutStart()
|
||||
{
|
||||
var options = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
PageCount = 1
|
||||
};
|
||||
|
||||
var authorizations = await _authorizationsClient.GetAll(options).ToList();
|
||||
Assert.NotEmpty(authorizations);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Octokit.Reactive;
|
||||
using Xunit;
|
||||
|
||||
namespace Octokit.Tests.Integration.Reactive
|
||||
{
|
||||
public class ObservableReleaseClientTests
|
||||
{
|
||||
public class TheGetAllMethod
|
||||
{
|
||||
readonly ObservableReleasesClient _releaseClient;
|
||||
const string owner = "octokit";
|
||||
const string name = "octokit.net";
|
||||
|
||||
public TheGetAllMethod()
|
||||
{
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
|
||||
_releaseClient = new ObservableReleasesClient(github);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsReleases()
|
||||
{
|
||||
var releases = await _releaseClient.GetAll(owner, name).ToList();
|
||||
|
||||
Assert.NotEmpty(releases);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsCorrectCountOfReleasesWithoutStart()
|
||||
{
|
||||
var options = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
PageCount = 1
|
||||
};
|
||||
|
||||
var releases = await _releaseClient.GetAll(owner, name, options).ToList();
|
||||
|
||||
Assert.Equal(5, releases.Count);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsCorrectCountOfReleasesWithStart()
|
||||
{
|
||||
var options = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
PageCount = 1,
|
||||
StartPage = 2
|
||||
};
|
||||
|
||||
var releases = await _releaseClient.GetAll(owner, name, options).ToList();
|
||||
|
||||
Assert.Equal(5, releases.Count);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsDistinctResultsBasedOnStartPage()
|
||||
{
|
||||
var startOptions = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
PageCount = 1
|
||||
};
|
||||
|
||||
var firstPage = await _releaseClient.GetAll(owner, name, startOptions).ToList();
|
||||
|
||||
var skipStartOptions = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
PageCount = 1,
|
||||
StartPage = 2
|
||||
};
|
||||
|
||||
var secondPage = await _releaseClient.GetAll(owner, name, skipStartOptions).ToList();
|
||||
|
||||
Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
|
||||
Assert.NotEqual(firstPage[1].Id, secondPage[1].Id);
|
||||
Assert.NotEqual(firstPage[2].Id, secondPage[2].Id);
|
||||
Assert.NotEqual(firstPage[3].Id, secondPage[3].Id);
|
||||
Assert.NotEqual(firstPage[4].Id, secondPage[4].Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,15 +7,40 @@ namespace Octokit.Tests.Integration
|
||||
{
|
||||
public class ObservableUserEmailsClientTests
|
||||
{
|
||||
[IntegrationTest]
|
||||
public async Task CanGetEmail()
|
||||
readonly ObservableUserEmailsClient _emailClient;
|
||||
|
||||
public ObservableUserEmailsClientTests()
|
||||
{
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
|
||||
var client = new ObservableUserEmailsClient(github);
|
||||
_emailClient = new ObservableUserEmailsClient(github);
|
||||
}
|
||||
|
||||
var email = await client.GetAll();
|
||||
[IntegrationTest]
|
||||
public async Task CanGetEmail()
|
||||
{
|
||||
var email = await _emailClient.GetAll();
|
||||
Assert.NotNull(email);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanGetEmailWithApiOptions()
|
||||
{
|
||||
var email = await _emailClient.GetAll(ApiOptions.None);
|
||||
Assert.NotNull(email);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsCorrectCountOfEmailsWithoutStart()
|
||||
{
|
||||
var options = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
PageCount = 1
|
||||
};
|
||||
|
||||
var emails = await _emailClient.GetAll(options).ToList();
|
||||
Assert.NotEmpty(emails);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Octokit.Tests.Integration.Clients
|
||||
// Create a key
|
||||
string keyTitle = "title";
|
||||
string keyData = "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAjo4DqFKg8dOxiz/yjypmN1A4itU5QOStyYrfOFuTinesU/2zm9hqxJ5BctIhgtSHJ5foxkhsiBji0qrUg73Q25BThgNg8YFE8njr4EwjmqSqW13akx/zLV0GFFU0SdJ2F6rBldhi93lMnl0ex9swBqa3eLTY8C+HQGBI6MQUMw+BKp0oFkz87Kv+Pfp6lt/Uo32ejSxML1PT5hTH5n+fyl0ied+sRmPGZWmWoHB5Bc9mox7lB6I6A/ZgjtBqbEEn4HQ2/6vp4ojKfSgA4Mm7XMu0bZzX0itKjH1QWD9Lr5apV1cmZsj49Xf8SHucTtH+bq98hb8OOXEGFzplwsX2MQ==";
|
||||
|
||||
|
||||
var observable = _github.User.Keys.Create(new NewPublicKey(keyTitle, keyData));
|
||||
var key = await observable;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user