From b6af84d2696a518e83b01d2e9e6e00786aa88bb5 Mon Sep 17 00:00:00 2001 From: Georgi Baychev Date: Fri, 19 Dec 2014 23:45:47 +0200 Subject: [PATCH] Removed the preview accepts header from the deployment api - no longer needed --- .../ObservableDeploymentStatusClient.cs | 4 +-- .../Clients/ObservableDeploymentsClient.cs | 2 +- .../Clients/DeploymentStatusClientTests.cs | 34 ++----------------- .../Clients/DeploymentsClientTests.cs | 32 ++--------------- .../ObservableDeploymentStatusClientTests.cs | 14 -------- .../ObservableDeploymentsClientTests.cs | 15 +------- Octokit/Clients/DeploymentStatusClient.cs | 7 ++-- Octokit/Clients/DeploymentsClient.cs | 7 ++-- 8 files changed, 11 insertions(+), 104 deletions(-) diff --git a/Octokit.Reactive/Clients/ObservableDeploymentStatusClient.cs b/Octokit.Reactive/Clients/ObservableDeploymentStatusClient.cs index 3e28963c..893904cc 100644 --- a/Octokit.Reactive/Clients/ObservableDeploymentStatusClient.cs +++ b/Octokit.Reactive/Clients/ObservableDeploymentStatusClient.cs @@ -6,7 +6,6 @@ namespace Octokit.Reactive.Clients { public class ObservableDeploymentStatusClient : IObservableDeploymentStatusClient { - const string acceptsHeader = "application/vnd.github.cannonball-preview+json"; private IDeploymentStatusClient _client; private IConnection _connection; @@ -35,8 +34,7 @@ namespace Octokit.Reactive.Clients Ensure.ArgumentNotNullOrEmptyString(name, "name"); return _connection.GetAndFlattenAllPages( - ApiUrls.DeploymentStatuses(owner, name, deploymentId), - null, acceptsHeader); + ApiUrls.DeploymentStatuses(owner, name, deploymentId)); } /// diff --git a/Octokit.Reactive/Clients/ObservableDeploymentsClient.cs b/Octokit.Reactive/Clients/ObservableDeploymentsClient.cs index ce5c996a..c99ca2fa 100644 --- a/Octokit.Reactive/Clients/ObservableDeploymentsClient.cs +++ b/Octokit.Reactive/Clients/ObservableDeploymentsClient.cs @@ -35,7 +35,7 @@ namespace Octokit.Reactive.Clients Ensure.ArgumentNotNullOrEmptyString(name, "name"); return _connection.GetAndFlattenAllPages( - ApiUrls.Deployments(owner, name), null, "application/vnd.github.cannonball-preview+json"); + ApiUrls.Deployments(owner, name)); } /// diff --git a/Octokit.Tests/Clients/DeploymentStatusClientTests.cs b/Octokit.Tests/Clients/DeploymentStatusClientTests.cs index e59b26af..f8fb8fe5 100644 --- a/Octokit.Tests/Clients/DeploymentStatusClientTests.cs +++ b/Octokit.Tests/Clients/DeploymentStatusClientTests.cs @@ -9,8 +9,6 @@ using System.Threading.Tasks; public class DeploymentStatusClientTests { - const string expectedAcceptsHeader = "application/vnd.github.cannonball-preview+json"; - public class TheGetAllMethod { [Fact] @@ -53,21 +51,7 @@ public class DeploymentStatusClientTests var expectedUrl = "repos/owner/name/deployments/1/statuses"; client.GetAll("owner", "name", 1); - connection.Received().GetAll(Arg.Is(u => u.ToString() == expectedUrl), - Arg.Any>(), - Arg.Any()); - } - - [Fact] - public void UsesPreviewAcceptHeader() - { - var connection = Substitute.For(); - var client = new DeploymentStatusClient(connection); - - client.GetAll("owner", "name", 1); - connection.Received().GetAll(Arg.Any(), - Arg.Any>(), - expectedAcceptsHeader); + connection.Received().GetAll(Arg.Is(u => u.ToString() == expectedUrl)); } } @@ -117,21 +101,7 @@ public class DeploymentStatusClientTests client.Create("owner", "repo", 1, newDeploymentStatus); connection.Received().Post(Arg.Is(u => u.ToString() == expectedUrl), - Arg.Any(), - Arg.Any()); - } - - [Fact] - public void UsesPreviewAcceptHeader() - { - var connection = Substitute.For(); - var client = new DeploymentStatusClient(connection); - - client.Create("owner", "repo", 1, newDeploymentStatus); - - connection.Received().Post(Arg.Any(), - Arg.Any(), - expectedAcceptsHeader); + Arg.Any()); } } diff --git a/Octokit.Tests/Clients/DeploymentsClientTests.cs b/Octokit.Tests/Clients/DeploymentsClientTests.cs index f4863970..a5857631 100644 --- a/Octokit.Tests/Clients/DeploymentsClientTests.cs +++ b/Octokit.Tests/Clients/DeploymentsClientTests.cs @@ -9,8 +9,6 @@ using Xunit.Extensions; public class DeploymentsClientTests { - const string ExpectedAcceptHeader = "application/vnd.github.cannonball-preview+json"; - public class TheGetAllMethod { [Fact] @@ -57,18 +55,6 @@ public class DeploymentsClientTests Arg.Any>(), Arg.Any()); } - - [Fact] - public void UsesPreviewAcceptsHeader() - { - var connection = Substitute.For(); - var client = new DeploymentsClient(connection); - - client.GetAll("owner", "name"); - connection.Received().GetAll(Arg.Any(), - Arg.Any>(), - ExpectedAcceptHeader); - } } public class TheCreateMethod @@ -118,8 +104,7 @@ public class DeploymentsClientTests client.Create("owner", "name", newDeployment); connection.Received(1).Post(Arg.Is(u => u.ToString() == expectedUrl), - Arg.Any(), - Arg.Any()); + Arg.Any()); } [Fact] @@ -131,20 +116,7 @@ public class DeploymentsClientTests client.Create("owner", "name", newDeployment); connection.Received(1).Post(Arg.Any(), - newDeployment, - Arg.Any()); - } - - [Fact] - public void UsesPreviewAcceptsHeader() - { - var connection = Substitute.For(); - var client = new DeploymentsClient(connection); - - client.Create("owner", "name", newDeployment); - connection.Received().Post(Arg.Any(), - Arg.Any(), - Arg.Is(ExpectedAcceptHeader)); + newDeployment); } } diff --git a/Octokit.Tests/Reactive/ObservableDeploymentStatusClientTests.cs b/Octokit.Tests/Reactive/ObservableDeploymentStatusClientTests.cs index 2f3fb51f..c20456ad 100644 --- a/Octokit.Tests/Reactive/ObservableDeploymentStatusClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableDeploymentStatusClientTests.cs @@ -12,8 +12,6 @@ namespace Octokit.Tests.Reactive { public class ObservableDeploymentStatusClientTests { - const string ExpectedAcceptHeader = "application/vnd.github.cannonball-preview+json"; - public class TheGetAllMethod { readonly IGitHubClient _githubClient; @@ -60,18 +58,6 @@ namespace Octokit.Tests.Reactive Arg.Any>(), Arg.Any()); } - - [Fact] - public void UsesPreviewAcceptHeader() - { - _client.GetAll("owner", "repo", 1); - - _githubClient.Connection - .Received(1) - .Get>(Arg.Any(), - Arg.Any>(), - Arg.Is(ExpectedAcceptHeader)); - } } public class TheCreateMethod diff --git a/Octokit.Tests/Reactive/ObservableDeploymentsClientTests.cs b/Octokit.Tests/Reactive/ObservableDeploymentsClientTests.cs index 0e695046..1c40ad07 100644 --- a/Octokit.Tests/Reactive/ObservableDeploymentsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableDeploymentsClientTests.cs @@ -12,8 +12,6 @@ namespace Octokit.Tests.Reactive { public class ObservableDeploymentsClientTests { - const string ExpectedAcceptHeader = "application/vnd.github.cannonball-preview+json"; - public class TheGetAllMethod { readonly IGitHubClient _githubClient; @@ -57,18 +55,7 @@ namespace Octokit.Tests.Reactive _githubClient.Connection .Received(1) .Get>(Arg.Is(expectedUri), - Arg.Any>(), - Arg.Any()); - } - - [Fact] - public void UsesPreviewAcceptHeader() - { - _client.GetAll("owner", "repo"); - _githubClient.Connection.Received(1) - .Get>(Arg.Any(), - Arg.Any>(), - ExpectedAcceptHeader); + Arg.Any>(), Arg.Any()); } } diff --git a/Octokit/Clients/DeploymentStatusClient.cs b/Octokit/Clients/DeploymentStatusClient.cs index 6c329ef9..8c9e3236 100644 --- a/Octokit/Clients/DeploymentStatusClient.cs +++ b/Octokit/Clients/DeploymentStatusClient.cs @@ -12,8 +12,6 @@ namespace Octokit /// public class DeploymentStatusClient : ApiClient, IDeploymentStatusClient { - const string acceptsHeader = "application/vnd.github.cannonball-preview+json"; - public DeploymentStatusClient(IApiConnection apiConnection) : base(apiConnection) { @@ -35,8 +33,7 @@ namespace Octokit Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); - return ApiConnection.GetAll(ApiUrls.DeploymentStatuses(owner, name, deploymentId), - null, acceptsHeader); + return ApiConnection.GetAll(ApiUrls.DeploymentStatuses(owner, name, deploymentId)); } /// @@ -58,7 +55,7 @@ namespace Octokit Ensure.ArgumentNotNull(newDeploymentStatus, "newDeploymentStatus"); return ApiConnection.Post(ApiUrls.DeploymentStatuses(owner, name, deploymentId), - newDeploymentStatus, acceptsHeader); + newDeploymentStatus); } } } diff --git a/Octokit/Clients/DeploymentsClient.cs b/Octokit/Clients/DeploymentsClient.cs index bb13b62b..4ccc2948 100644 --- a/Octokit/Clients/DeploymentsClient.cs +++ b/Octokit/Clients/DeploymentsClient.cs @@ -12,8 +12,6 @@ namespace Octokit /// public class DeploymentsClient : ApiClient, IDeploymentsClient { - const string acceptsHeader = "application/vnd.github.cannonball-preview+json"; - /// /// Instantiates a new GitHub Repository Deployments API client. /// @@ -39,8 +37,7 @@ namespace Octokit Ensure.ArgumentNotNullOrEmptyString(owner, "login"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); - return ApiConnection.GetAll(ApiUrls.Deployments(owner, name), - null, acceptsHeader); + return ApiConnection.GetAll(ApiUrls.Deployments(owner, name)); } /// @@ -61,7 +58,7 @@ namespace Octokit Ensure.ArgumentNotNull(newDeployment, "deployment"); return ApiConnection.Post(ApiUrls.Deployments(owner, name), - newDeployment, acceptsHeader); + newDeployment); } ///