mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-05 03:30:34 +00:00
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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user