push restrictions only apply to org repos so provide a ctor for the update request that doesnt take a restrictions parameter

This commit is contained in:
Ryan Gribble
2016-08-08 23:28:20 +10:00
parent 3bd7323044
commit 2c7d6fbe42
2 changed files with 13 additions and 6 deletions
@@ -257,8 +257,7 @@ namespace Octokit.Tests.Clients
var connection = Substitute.For<IApiConnection>();
var client = new RepositoryBranchesClient(connection);
var update = new BranchProtectionSettingsUpdate(
new BranchProtectionRequiredStatusChecksUpdate(true, true, new[] { "test" }),
new ProtectedBranchRestrictionsUpdate(null, null));
new BranchProtectionRequiredStatusChecksUpdate(true, true, new[] { "test" }));
const string previewAcceptsHeader = "application/vnd.github.loki-preview+json";
client.UpdateBranchProtection("owner", "repo", "branch", update);
@@ -273,8 +272,7 @@ namespace Octokit.Tests.Clients
var connection = Substitute.For<IApiConnection>();
var client = new RepositoryBranchesClient(connection);
var update = new BranchProtectionSettingsUpdate(
new BranchProtectionRequiredStatusChecksUpdate(true, true, new[] { "test" }),
new ProtectedBranchRestrictionsUpdate(null, null));
new BranchProtectionRequiredStatusChecksUpdate(true, true, new[] { "test" }));
const string previewAcceptsHeader = "application/vnd.github.loki-preview+json";
client.UpdateBranchProtection(1, "branch", update);
@@ -288,8 +286,7 @@ namespace Octokit.Tests.Clients
{
var client = new RepositoryBranchesClient(Substitute.For<IApiConnection>());
var update = new BranchProtectionSettingsUpdate(
new BranchProtectionRequiredStatusChecksUpdate(true, true, new[] { "test" }),
new ProtectedBranchRestrictionsUpdate(null, null));
new BranchProtectionRequiredStatusChecksUpdate(true, true, new[] { "test" }));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.UpdateBranchProtection(null, "repo", "branch", update));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.UpdateBranchProtection("owner", null, "branch", update));
@@ -11,6 +11,16 @@ namespace Octokit
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class BranchProtectionSettingsUpdate
{
/// <summary>
/// Create a BranchProtection update request
/// </summary>
/// <param name="requiredStatusChecks">Specifies the requested status check settings</param>
public BranchProtectionSettingsUpdate(BranchProtectionRequiredStatusChecksUpdate requiredStatusChecks)
{
RequiredStatusChecks = requiredStatusChecks;
Restrictions = null;
}
/// <summary>
/// Create a BranchProtection update request
/// </summary>