ProtectedBranches API changes for Required Review Enforcement (#1523)

* Add `BranchProtectionRequiredPullRequestReviews` and `BranchProtectionRequiredPullRequestReviewsUpdate` models

* Add missing ctors and fix naming

Tests where updated to use the minimum nesseccary constructor

* Fix debugger display

* Update BranchProtection response model to include new dismissal restrictions fields and tidy up existing properties ctors and DebuggerDisplay

* Update BranchProtectionUpdate request model to include new dismissal restrictions fields/classes and tidy up existing properties and DebuggerDisplay

* Update BranchProtection tests to use new RequiredReviews and dismissal restrictions options

* Add specific client endpoints for GetReviewEnforcement UpdateReviewEnforcement and RemoveReviewEnforcement

* Add unit and integration tests for new client methods

* Implement Observable client methods and unit tests

* Add integration tests for Observable client

* Run CodeFormatter to fix up whitespace

* Clarify review dismissal restriction behaviour in code comments
This commit is contained in:
Mordechai Zuber
2017-08-30 14:12:42 +03:00
committed by Ryan Gribble
parent dd2d977c88
commit a2b48a66a4
13 changed files with 1839 additions and 37 deletions
@@ -30,7 +30,11 @@ namespace Octokit.Tests.Integration.Helpers
var contextUserRepo = await client.CreateRepositoryContext(userRepo);
// Protect master branch
var update = new BranchProtectionSettingsUpdate(new BranchProtectionRequiredStatusChecksUpdate(true, new[] { "build", "test" }), null, true);
var update = new BranchProtectionSettingsUpdate(
new BranchProtectionRequiredStatusChecksUpdate(true, new[] { "build", "test" }),
new BranchProtectionRequiredReviewsUpdate(true, true),
null,
true);
await client.Repository.Branch.UpdateBranchProtection(contextUserRepo.RepositoryOwner, contextUserRepo.RepositoryName, "master", update);
@@ -56,6 +60,7 @@ namespace Octokit.Tests.Integration.Helpers
// Protect master branch
var protection = new BranchProtectionSettingsUpdate(
new BranchProtectionRequiredStatusChecksUpdate(true, new[] { "build", "test" }),
new BranchProtectionRequiredReviewsUpdate(new BranchProtectionRequiredReviewsDismissalRestrictionsUpdate(new BranchProtectionTeamCollection { contextOrgTeam.TeamName }), true, true),
new BranchProtectionPushRestrictionsUpdate(new BranchProtectionTeamCollection { contextOrgTeam.TeamName }),
true);
await client.Repository.Branch.UpdateBranchProtection(contextOrgRepo.RepositoryOwner, contextOrgRepo.RepositoryName, "master", protection);