Merge pull request #787 from octokit/release-candidate

release candidate
This commit is contained in:
Brendan Forster
2015-04-21 20:02:01 -07:00
13 changed files with 33 additions and 188 deletions
@@ -50,18 +50,6 @@ namespace Octokit.Reactive
Justification = "Makes a network request")]
IObservable<Repository> GetAllPublic();
/// <summary>
/// Retrieves every public <see cref="Repository"/> since the last repository seen.
/// </summary>
/// <remarks>
/// The default page size on GitHub.com is 30.
/// </remarks>
/// <param name="request">Search parameters of the last repository seen</param>
/// <returns>A <see cref="IReadOnlyPagedCollection{Repository}"/> of <see cref="Repository"/>.</returns>
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate",
Justification = "Makes a network request")]
IObservable<Repository> GetAllPublic(PublicRepositoryRequest request);
/// <summary>
/// Retrieves every <see cref="Repository"/> that belongs to the current user.
/// </summary>
@@ -102,21 +102,6 @@ namespace Octokit.Reactive
return _connection.GetAndFlattenAllPages<Repository>(ApiUrls.AllPublicRepositories());
}
/// <summary>
/// Retrieves every public <see cref="Repository"/> since the last repository seen.
/// </summary>
/// <remarks>
/// The default page size on GitHub.com is 30.
/// </remarks>
/// <param name="request">Search parameters of the last repository seen</param>
/// <returns>A <see cref="IReadOnlyPagedCollection{Repository}"/> of <see cref="Repository"/>.</returns>
public IObservable<Repository> GetAllPublic(PublicRepositoryRequest request)
{
Ensure.ArgumentNotNull(request, "request");
return _connection.GetAndFlattenAllPages<Repository>(ApiUrls.AllPublicRepositories(), request.ToParametersDictionary());
}
/// <summary>
/// Retrieves every <see cref="Repository"/> that belongs to the current user.
/// </summary>
@@ -34,7 +34,7 @@ namespace Octokit.Tests.Integration.Clients
Assert.True(_events.All(e => e.Payload != null));
}
[IntegrationTest]
[IntegrationTest(Skip = "no longer able to access this event")]
public void IssueCommentPayloadEventDeserializesCorrectly()
{
var commentEvent = _events.FirstOrDefault(e => e.Id == "2628548686");
@@ -49,7 +49,7 @@ namespace Octokit.Tests.Integration.Clients
Assert.Equal(742, commentPayload.Issue.Number);
}
[IntegrationTest]
[IntegrationTest(Skip = "no longer able to access this event")]
public void PushEventPayloadDeserializesCorrectly()
{
var pushEvent = _events.FirstOrDefault(e => e.Id == "2628858765");
@@ -65,7 +65,7 @@ namespace Octokit.Tests.Integration.Clients
Assert.Equal(1, pushPayload.Size);
}
[IntegrationTest]
[IntegrationTest(Skip = "no longer able to access this event")]
public void PREventPayloadDeserializesCorrectly()
{
var prEvent = _events.FirstOrDefault(e => e.Id == "2628718313");
@@ -79,7 +79,7 @@ namespace Octokit.Tests.Integration.Clients
Assert.Equal(743, prPayload.PullRequest.Number);
}
[IntegrationTest]
[IntegrationTest(Skip = "no longer able to access this event")]
public void PRReviewCommentEventPayloadDeserializesCorrectly()
{
var prrcEvent = _events.First(e => e.Id == "2623246246");
@@ -553,20 +553,20 @@ public class RepositoriesClientTests
Assert.True(repositories.Count > 80);
}
[IntegrationTest]
public async Task ReturnsAllPublicRepositoriesSinceLastSeen()
{
var github = Helper.GetAuthenticatedClient();
//[IntegrationTest]
//public async Task ReturnsAllPublicRepositoriesSinceLastSeen()
//{
// var github = Helper.GetAuthenticatedClient();
var request = new PublicRepositoryRequest(32732250);
var repositories = await github.Repository.GetAllPublic(request);
// var request = new PublicRepositoryRequest(32732250);
// var repositories = await github.Repository.GetAllPublic(request);
Assert.NotNull(repositories);
Assert.True(repositories.Any());
Assert.Equal(32732252, repositories[0].Id);
Assert.False(repositories[0].Private);
Assert.Equal("zad19", repositories[0].Name);
}
// Assert.NotNull(repositories);
// Assert.True(repositories.Any());
// Assert.Equal(32732252, repositories[0].Id);
// Assert.False(repositories[0].Private);
// Assert.Equal("zad19", repositories[0].Name);
//}
}
public class TheGetAllForOrgMethod
@@ -28,22 +28,5 @@ namespace Octokit.Tests.Integration
Assert.False(repository2.Fork);
}
}
public class TheGetAllPublicSinceMethod
{
[IntegrationTest(Skip = "This will take a very long time to return, so will skip it for now.")]
public async Task ReturnsAllPublicReposSinceLastSeen()
{
var github = Helper.GetAuthenticatedClient();
var client = new ObservableRepositoriesClient(github);
var request = new PublicRepositoryRequest(32732250);
var repositories = await client.GetAllPublic(request).ToArray();
Assert.NotEmpty(repositories);
Assert.Equal(32732252, repositories[0].Id);
Assert.False(repositories[0].Private);
Assert.Equal("zad19", repositories[0].Name);
}
}
}
}
@@ -96,7 +96,7 @@ namespace Octokit.Tests.Clients
authEndpoint.GetOrCreateApplicationAuthentication("clientId", "secret", data);
client.Received().Post<ApplicationAuthorization>(Arg.Is<Uri>(u => u.ToString() == "authorizations/clients/clientId"),
client.Received().Put<ApplicationAuthorization>(Arg.Is<Uri>(u => u.ToString() == "authorizations/clients/clientId"),
Args.Object);
}
@@ -235,7 +235,7 @@ namespace Octokit.Tests.Clients
authEndpoint.GetOrCreateApplicationAuthentication("clientId", "secret", data);
client.Received().Post<ApplicationAuthorization>(Arg.Is<Uri>(u => u.ToString() == "authorizations/clients/clientId/ha-ha-fingerprint"),
client.Received().Put<ApplicationAuthorization>(Arg.Is<Uri>(u => u.ToString() == "authorizations/clients/clientId/ha-ha-fingerprint"),
Args.Object);
}
}
@@ -273,37 +273,6 @@ namespace Octokit.Tests.Clients
}
}
public class TheGetAllPublicSinceMethod
{
[Fact]
public void RequestsTheCorrectUrl()
{
var connection = Substitute.For<IApiConnection>();
var client = new RepositoriesClient(connection);
client.GetAllPublic(new PublicRepositoryRequest(364));
connection.Received()
.GetAll<Repository>(Arg.Is<Uri>(u => u.ToString() == "/repositories"),
Arg.Any<Dictionary<string, string>>());
}
[Fact]
public void SendsTheCorrectParameter()
{
var connection = Substitute.For<IApiConnection>();
var client = new RepositoriesClient(connection);
client.GetAllPublic(new PublicRepositoryRequest(364));
connection.Received()
.GetAll<Repository>(Arg.Is<Uri>(u => u.ToString() == "/repositories"),
Arg.Is<Dictionary<string, string>>(d => d.Count == 1
&& d["since"] == "364"));
}
}
public class TheGetAllForCurrentMethod
{
[Fact]
@@ -158,65 +158,6 @@ namespace Octokit.Tests.Reactive
}
}
public class TheGetAllPublicRepositoriesSinceMethod
{
[Fact]
public async Task ReturnsEveryPageOfRepositories()
{
var firstPageUrl = new Uri("/repositories", UriKind.Relative);
var secondPageUrl = new Uri("https://example.com/page/2");
var firstPageLinks = new Dictionary<string, Uri> { { "next", secondPageUrl } };
IApiResponse<List<Repository>> firstPageResponse = new ApiResponse<List<Repository>>(
CreateResponseWithApiInfo(firstPageLinks),
new List<Repository>
{
new Repository(364),
new Repository(365),
new Repository(366)
});
var thirdPageUrl = new Uri("https://example.com/page/3");
var secondPageLinks = new Dictionary<string, Uri> { { "next", thirdPageUrl } };
IApiResponse<List<Repository>> secondPageResponse = new ApiResponse<List<Repository>>
(
CreateResponseWithApiInfo(secondPageLinks),
new List<Repository>
{
new Repository(367),
new Repository(368),
new Repository(369)
});
IApiResponse<List<Repository>> lastPageResponse = new ApiResponse<List<Repository>>(
new Response(),
new List<Repository>
{
new Repository(370)
});
var gitHubClient = Substitute.For<IGitHubClient>();
gitHubClient.Connection.Get<List<Repository>>(firstPageUrl,
Arg.Is<Dictionary<string, string>>(d => d.Count == 1
&& d["since"] == "364"), null)
.Returns(Task.FromResult(firstPageResponse));
gitHubClient.Connection.Get<List<Repository>>(secondPageUrl, null, null)
.Returns(Task.FromResult(secondPageResponse));
gitHubClient.Connection.Get<List<Repository>>(thirdPageUrl, null, null)
.Returns(Task.FromResult(lastPageResponse));
var repositoriesClient = new ObservableRepositoriesClient(gitHubClient);
var results = await repositoriesClient.GetAllPublic(new PublicRepositoryRequest(364)).ToArray();
Assert.Equal(7, results.Length);
gitHubClient.Connection.Received(1).Get<List<Repository>>(firstPageUrl,
Arg.Is<Dictionary<string, string>>(d=>d.Count == 1
&& d["since"] == "364"), null);
gitHubClient.Connection.Received(1).Get<List<Repository>>(secondPageUrl, null, null);
gitHubClient.Connection.Received(1).Get<List<Repository>>(thirdPageUrl, null, null);
}
}
public class TheGetAllBranchesMethod
{
[Fact]
-14
View File
@@ -109,20 +109,6 @@ namespace Octokit
Justification = "Makes a network request")]
Task<IReadOnlyList<Repository>> GetAllPublic();
/// <summary>
/// Gets all public repositories since the integer ID of the last Repository that you've seen.
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/repos/#list-all-public-repositories">API documentation</a> for more information.
/// The default page size on GitHub.com is 30.
/// </remarks>
/// <param name="request">Search parameters of the last repository seen</param>
/// <exception cref="AuthorizationException">Thrown if the client is not authenticated.</exception>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
/// <returns>A <see cref="IReadOnlyPagedCollection{Repository}"/> of <see cref="Repository"/>.</returns>
Task<IReadOnlyList<Repository>> GetAllPublic(PublicRepositoryRequest request);
/// <summary>
/// Gets all repositories owned by the current user.
/// </summary>
-18
View File
@@ -188,24 +188,6 @@ namespace Octokit
return ApiConnection.GetAll<Repository>(ApiUrls.AllPublicRepositories());
}
/// <summary>
/// Gets all public repositories since the integer ID of the last Repository that you've seen.
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/repos/#list-all-public-repositories">API documentation</a> for more information.
/// The default page size on GitHub.com is 30.
/// </remarks>
/// <param name="request">Search parameters of the last repository seen</param>
/// <exception cref="AuthorizationException">Thrown if the client is not authenticated.</exception>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
/// <returns>A <see cref="IReadOnlyPagedCollection{Repository}"/> of <see cref="Repository"/>.</returns>
public Task<IReadOnlyList<Repository>> GetAllPublic(PublicRepositoryRequest request)
{
Ensure.ArgumentNotNull(request, "request");
return ApiConnection.GetAll<Repository>(ApiUrls.AllPublicRepositories(), request.ToParametersDictionary());
}
/// <summary>
/// Gets all repositories owned by the current user.
/// </summary>
+1 -1
View File
@@ -56,7 +56,7 @@ namespace Octokit
/// <summary>
/// Line index in the diff that was commented on.
/// </summary>
public int Position { get; protected set; }
public int? Position { get; protected set; }
/// <summary>
/// The line number in the file that was commented on.
+11
View File
@@ -1,3 +1,14 @@
### New in 0.10.0 (released 2015/04/22)
* Fixed: renamed methods to follow `GetAll` convention - #771 via @alfhenrik
* Fixed: helper functions and cleanup to make using Authorization API easier to consume - #786 via @haacked
**Breaking Changes:**
- As part of #771 there were many method which were returning collections
but the method name made it unclear. You might think that it wasn't much, but
you'd be wrong. So if you have a method that no longer compile,
it is likely that you need to set the prefix to `GetAll` to re-disocver that API.
- `CommitComment.Position` is now a nullable `int` to prevent serialization issues.
### New in 0.9.0 (released 2015/04/04)
* New: added `PullRequest.Files` APIs - #752 via @alfhenrik
* Fixed: `PullRequestRequest` now supports `SortDirection` and `SortProperty` - #752 via @alfhenrik
+3 -3
View File
@@ -3,11 +3,11 @@ using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyProductAttribute("Octokit")]
[assembly: AssemblyVersionAttribute("0.9.0")]
[assembly: AssemblyFileVersionAttribute("0.9.0")]
[assembly: AssemblyVersionAttribute("0.10.0")]
[assembly: AssemblyFileVersionAttribute("0.10.0")]
[assembly: ComVisibleAttribute(false)]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "0.9.0";
internal const string Version = "0.10.0";
}
}