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
@@ -314,6 +314,69 @@ namespace Octokit.Reactive
/// <param name="contexts">The contexts to remove</param>
IObservable<string> DeleteRequiredStatusChecksContexts(long repositoryId, string branch, IReadOnlyList<string> contexts);
/// <summary>
/// Get admin enforcement of protected branch
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/repos/branches/#get-admin-enforcement-of-protected-branch">API documentation</a> for more details
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="branch">The name of the branch</param>
IObservable<EnforceAdmins> GetAdminEnforcement(string owner, string name, string branch);
/// <summary>
/// Get admin enforcement of protected branch
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/repos/branches/#get-admin-enforcement-of-protected-branch">API documentation</a> for more details
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="branch">The name of the branch</param>
IObservable<EnforceAdmins> GetAdminEnforcement(long repositoryId, string branch);
/// <summary>
/// Add admin enforcement to protected branch
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/repos/branches/#add-admin-enforcement-of-protected-branch">API documentation</a> for more details
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="branch">The name of the branch</param>
IObservable<EnforceAdmins> AddAdminEnforcement(string owner, string name, string branch);
/// <summary>
/// Add admin enforcement to protected branch
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/repos/branches/#add-admin-enforcement-of-protected-branch">API documentation</a> for more details
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="branch">The name of the branch</param>
IObservable<EnforceAdmins> AddAdminEnforcement(long repositoryId, string branch);
/// <summary>
/// Remove admin enforcement on protected branch
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/repos/branches/#remove-admin-enforcement-of-protected-branch">API documentation</a> for more details
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="branch">The name of the branch</param>
IObservable<bool> RemoveAdminEnforcement(string owner, string name, string branch);
/// <summary>
/// Remove admin enforcement on protected branch
/// </summary>
/// <remarks>
/// See the <a href="https://developer.github.com/v3/repos/branches/#remove-admin-enforcement-of-protected-branch">API documentation</a> for more details
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="branch">The name of the branch</param>
IObservable<bool> RemoveAdminEnforcement(long repositoryId, string branch);
/// <summary>
/// Get the restrictions for the specified branch (applies only to Organization owned repositories)
/// </summary>