Add BranchProtection.EnforceAdmins object (#1598)

* Add BranchProtection.EnforceAdmins object

* Add EnforceAdmin related methods to RepoBranch clients

* Add unit tests

* Add unit tests for Observable client

* Add integration tests for enforce admin methods

* Tweak integration test to ensure that they actually do something

The `CreateRepositoryWithProtectedBranch` helper method currently sets `EnforceAdmins` as true, so delete it before adding.

* add missing docs

* rename tests

* Add missing ctor

* Remove property that is no longer supported

https://developer.github.com/changes/2017-05-02-adoption-of-admin-enforced/

* Fix failing unit tests
This commit is contained in:
Mordechai Zuber
2017-05-04 15:34:58 +03:00
committed by Ryan Gribble
parent 73feecefb3
commit 58ba2eccf9
11 changed files with 859 additions and 62 deletions
+21
View File
@@ -1733,6 +1733,27 @@ namespace Octokit
return "repositories/{0}/branches/{1}/protection/required_status_checks/contexts".FormatUri(repositoryId, branchName);
}
/// <summary>
/// Returns the <see cref="Uri"/> for admin enforcement for a protected branch
/// </summary>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="branchName">The name of the branch</param>
public static Uri RepoProtectedBranchAdminEnforcement(string owner, string name, string branchName)
{
return "repos/{0}/{1}/branches/{2}/protection/enforce_admins".FormatUri(owner, name, branchName);
}
/// <summary>
/// Returns the <see cref="Uri"/> for admin enforcement for a protected branch
/// </summary>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="branchName">The name of the branch</param>
public static Uri RepoProtectedBranchAdminEnforcement(long repositoryId, string branchName)
{
return "repositories/{0}/branches/{1}/protection/enforce_admins".FormatUri(repositoryId, branchName);
}
/// <summary>
/// Returns the <see cref="Uri"/> for restrictions for a protected branch.
/// </summary>