mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-07 12:26:18 +00:00
Removed the preview accepts header from the deployment api - no longer needed
This commit is contained in:
@@ -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<DeploymentStatus>(
|
||||
ApiUrls.DeploymentStatuses(owner, name, deploymentId),
|
||||
null, acceptsHeader);
|
||||
ApiUrls.DeploymentStatuses(owner, name, deploymentId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Octokit.Reactive.Clients
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
|
||||
return _connection.GetAndFlattenAllPages<Deployment>(
|
||||
ApiUrls.Deployments(owner, name), null, "application/vnd.github.cannonball-preview+json");
|
||||
ApiUrls.Deployments(owner, name));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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<DeploymentStatus>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
|
||||
Arg.Any<IDictionary<string, string>>(),
|
||||
Arg.Any<string>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UsesPreviewAcceptHeader()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new DeploymentStatusClient(connection);
|
||||
|
||||
client.GetAll("owner", "name", 1);
|
||||
connection.Received().GetAll<DeploymentStatus>(Arg.Any<Uri>(),
|
||||
Arg.Any<IDictionary<string, string>>(),
|
||||
expectedAcceptsHeader);
|
||||
connection.Received().GetAll<DeploymentStatus>(Arg.Is<Uri>(u => u.ToString() == expectedUrl));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,21 +101,7 @@ public class DeploymentStatusClientTests
|
||||
client.Create("owner", "repo", 1, newDeploymentStatus);
|
||||
|
||||
connection.Received().Post<DeploymentStatus>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
|
||||
Arg.Any<NewDeploymentStatus>(),
|
||||
Arg.Any<string>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UsesPreviewAcceptHeader()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new DeploymentStatusClient(connection);
|
||||
|
||||
client.Create("owner", "repo", 1, newDeploymentStatus);
|
||||
|
||||
connection.Received().Post<DeploymentStatus>(Arg.Any<Uri>(),
|
||||
Arg.Any<NewDeploymentStatus>(),
|
||||
expectedAcceptsHeader);
|
||||
Arg.Any<NewDeploymentStatus>());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<IDictionary<string, string>>(),
|
||||
Arg.Any<string>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UsesPreviewAcceptsHeader()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new DeploymentsClient(connection);
|
||||
|
||||
client.GetAll("owner", "name");
|
||||
connection.Received().GetAll<Deployment>(Arg.Any<Uri>(),
|
||||
Arg.Any<IDictionary<string, string>>(),
|
||||
ExpectedAcceptHeader);
|
||||
}
|
||||
}
|
||||
|
||||
public class TheCreateMethod
|
||||
@@ -118,8 +104,7 @@ public class DeploymentsClientTests
|
||||
client.Create("owner", "name", newDeployment);
|
||||
|
||||
connection.Received(1).Post<Deployment>(Arg.Is<Uri>(u => u.ToString() == expectedUrl),
|
||||
Arg.Any<NewDeployment>(),
|
||||
Arg.Any<string>());
|
||||
Arg.Any<NewDeployment>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -131,20 +116,7 @@ public class DeploymentsClientTests
|
||||
client.Create("owner", "name", newDeployment);
|
||||
|
||||
connection.Received(1).Post<Deployment>(Arg.Any<Uri>(),
|
||||
newDeployment,
|
||||
Arg.Any<string>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UsesPreviewAcceptsHeader()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new DeploymentsClient(connection);
|
||||
|
||||
client.Create("owner", "name", newDeployment);
|
||||
connection.Received().Post<Deployment>(Arg.Any<Uri>(),
|
||||
Arg.Any<NewDeployment>(),
|
||||
Arg.Is(ExpectedAcceptHeader));
|
||||
newDeployment);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<IDictionary<string, string>>(),
|
||||
Arg.Any<string>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UsesPreviewAcceptHeader()
|
||||
{
|
||||
_client.GetAll("owner", "repo", 1);
|
||||
|
||||
_githubClient.Connection
|
||||
.Received(1)
|
||||
.Get<List<DeploymentStatus>>(Arg.Any<Uri>(),
|
||||
Arg.Any<IDictionary<string, string>>(),
|
||||
Arg.Is(ExpectedAcceptHeader));
|
||||
}
|
||||
}
|
||||
|
||||
public class TheCreateMethod
|
||||
|
||||
@@ -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<List<Deployment>>(Arg.Is(expectedUri),
|
||||
Arg.Any<IDictionary<string, string>>(),
|
||||
Arg.Any<string>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UsesPreviewAcceptHeader()
|
||||
{
|
||||
_client.GetAll("owner", "repo");
|
||||
_githubClient.Connection.Received(1)
|
||||
.Get<List<Deployment>>(Arg.Any<Uri>(),
|
||||
Arg.Any<IDictionary<string, string>>(),
|
||||
ExpectedAcceptHeader);
|
||||
Arg.Any<IDictionary<string, string>>(), Arg.Any<string>());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,6 @@ namespace Octokit
|
||||
/// </remarks>
|
||||
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<DeploymentStatus>(ApiUrls.DeploymentStatuses(owner, name, deploymentId),
|
||||
null, acceptsHeader);
|
||||
return ApiConnection.GetAll<DeploymentStatus>(ApiUrls.DeploymentStatuses(owner, name, deploymentId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -58,7 +55,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNull(newDeploymentStatus, "newDeploymentStatus");
|
||||
|
||||
return ApiConnection.Post<DeploymentStatus>(ApiUrls.DeploymentStatuses(owner, name, deploymentId),
|
||||
newDeploymentStatus, acceptsHeader);
|
||||
newDeploymentStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,6 @@ namespace Octokit
|
||||
/// </remarks>
|
||||
public class DeploymentsClient : ApiClient, IDeploymentsClient
|
||||
{
|
||||
const string acceptsHeader = "application/vnd.github.cannonball-preview+json";
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a new GitHub Repository Deployments API client.
|
||||
/// </summary>
|
||||
@@ -39,8 +37,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "login");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
|
||||
return ApiConnection.GetAll<Deployment>(ApiUrls.Deployments(owner, name),
|
||||
null, acceptsHeader);
|
||||
return ApiConnection.GetAll<Deployment>(ApiUrls.Deployments(owner, name));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -61,7 +58,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNull(newDeployment, "deployment");
|
||||
|
||||
return ApiConnection.Post<Deployment>(ApiUrls.Deployments(owner, name),
|
||||
newDeployment, acceptsHeader);
|
||||
newDeployment);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user