{"action":"created","comment":{"url":"https://api.github.com/repos/sigmavirus24/github3.py/pulls/comments/178432322","pull_request_review_id":108492913,"id":178432322,"diff_hunk":"@@ -283,12 +283,35 @@ class ProtectionEnforceAdmins(models.GitHubCore):\n     .. links\n     .. _Branch protection API documentation:\n         https://developer.github.com/v3/repos/branches/#get-branch-protection\n+    .. _Admin enforcement of protected branch\n+        https://developer.github.com/v3/repos/branches/#get-admin-enforcement-of-protected-branch\n     \"\"\"\n \n     def _update_attributes(self, protection):\n         self._api = protection['url']\n         self.enabled = protection['enabled']\n \n+    @decorators.requires_auth\n+    def enable(self):\n+        \"\"\"Enable Admin enforcement for protected branch\"\"\"\n+        resp = self._post(self._api,\n+                          headers=BranchProtection.PREVIEW_HEADERS_MAP)\n+        return self._boolean(resp, 200, 404)\n+\n+    @decorators.requires_auth\n+    def disable(self):\n+        \"\"\"Disable Admin enforcement for protected branch\"\"\"\n+        resp = self._delete(self._api,\n+                            headers=BranchProtection.PREVIEW_HEADERS_MAP)\n+        return self._boolean(resp, 204, 404)\n+\n+    @decorators.requires_auth\n+    def update(self):","path":"github3/repos/branch.py","position":27,"original_position":27,"commit_id":"bdf230b40a319865e8a2dcdd66c82c17f868b67c","original_commit_id":"bdf230b40a319865e8a2dcdd66c82c17f868b67c","user":{"login":"sigmavirus24","id":240830,"avatar_url":"https://avatars3.githubusercontent.com/u/240830?v=4","gravatar_id":"","url":"https://api.github.com/users/sigmavirus24","html_url":"https://github.com/sigmavirus24","followers_url":"https://api.github.com/users/sigmavirus24/followers","following_url":"https://api.github.com/users/sigmavirus24/following{/other_user}","gists_url":"https://api.github.com/users/sigmavirus24/gists{/gist_id}","starred_url":"https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sigmavirus24/subscriptions","organizations_url":"https://api.github.com/users/sigmavirus24/orgs","repos_url":"https://api.github.com/users/sigmavirus24/repos","events_url":"https://api.github.com/users/sigmavirus24/events{/privacy}","received_events_url":"https://api.github.com/users/sigmavirus24/received_events","type":"User","site_admin":false},"body":"How is this supposed to be used? Are you expecting folks to do\r\n\r\n```py\r\nenforce_admins.enabled = True\r\nenforce_admins.update()\r\n```\r\n\r\nThat's completely foreign to this library and I do not want to add that as a pattern. Please, let's not add this method if there are separate `enable` and `disable` methods (which I like and want to keep).","created_at":"2018-03-31T13:41:32Z","updated_at":"2018-03-31T13:48:58Z","html_url":"https://github.com/sigmavirus24/github3.py/pull/815#discussion_r178432322","pull_request_url":"https://api.github.com/repos/sigmavirus24/github3.py/pulls/815","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/sigmavirus24/github3.py/pulls/comments/178432322"},"html":{"href":"https://github.com/sigmavirus24/github3.py/pull/815#discussion_r178432322"},"pull_request":{"href":"https://api.github.com/repos/sigmavirus24/github3.py/pulls/815"}}},"pull_request":{"url":"https://api.github.com/repos/sigmavirus24/github3.py/pulls/815","id":178127052,"html_url":"https://github.com/sigmavirus24/github3.py/pull/815","diff_url":"https://github.com/sigmavirus24/github3.py/pull/815.diff","patch_url":"https://github.com/sigmavirus24/github3.py/pull/815.patch","issue_url":"https://api.github.com/repos/sigmavirus24/github3.py/issues/815","number":815,"state":"open","locked":false,"title":"[WIP] GH-696 Add methods to protect branch:","user":{"login":"paulchubatyy","id":98631,"avatar_url":"https://avatars0.githubusercontent.com/u/98631?v=4","gravatar_id":"","url":"https://api.github.com/users/paulchubatyy","html_url":"https://github.com/paulchubatyy","followers_url":"https://api.github.com/users/paulchubatyy/followers","following_url":"https://api.github.com/users/paulchubatyy/following{/other_user}","gists_url":"https://api.github.com/users/paulchubatyy/gists{/gist_id}","starred_url":"https://api.github.com/users/paulchubatyy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulchubatyy/subscriptions","organizations_url":"https://api.github.com/users/paulchubatyy/orgs","repos_url":"https://api.github.com/users/paulchubatyy/repos","events_url":"https://api.github.com/users/paulchubatyy/events{/privacy}","received_events_url":"https://api.github.com/users/paulchubatyy/received_events","type":"User","site_admin":false},"body":"* [x] ProtectionRestrictions to protect branch for particular teams and users\r\n* [x] ProtectionEnforceAdmins to enforce admin access for protected branch\r\n* [ ] ProtectionRequiredPullRequestReviews for pull requests for protected branches\r\n* [x] ProtectionRequiredStatusChecks for CI status checks for protected branch PRs\r\n\r\nFirst time contributor here and I've got a couple issues I couldn't overcome in a meaningful time, so would definitely make use of the advise:\r\n\r\nThe tests for the HTTP `DELETE` method are failing with a very strange error. This test:\r\n\r\n```python\r\n    def test_remove_teams(self):\r\n        self.instance.remove_teams(['justice-league'])\r\n        self.delete_called_with(protection_restrictions_teams_url_for(), data=['justice-league'],\r\n                                headers=BranchProtection.PREVIEW_HEADERS_MAP)\r\n```\r\nFails with the following errors:\r\n\r\n```__________________________________________________________________________________ TestProtectionRestrictions.test_update __________________________________________________________________________________\r\n\r\nself = <tests.unit.test_repos_branch_protection.TestProtectionRestrictions testMethod=test_update>\r\n\r\n    def test_update(self):\r\n        self.instance.update(['justice-league'], ['sigmavirus24'])\r\n        self.put_called_with(protection_restrictions_teams_url_for(), data=['justice-league'],\r\n>                             headers=BranchProtection.PREVIEW_HEADERS_MAP)\r\n\r\ntests/unit/test_repos_branch_protection.py:104:\r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\r\ntests/unit/helper.py:173: in put_called_with\r\n    self.method_called_with('put', args, kwargs)\r\ntests/unit/helper.py:143: in method_called_with\r\n    call_data = json.loads(call_data)\r\n/usr/local/lib/python2.7/json/__init__.py:339: in loads\r\n    return _default_decoder.decode(s)\r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\r\n\r\nself = <json.decoder.JSONDecoder object at 0x7f50e32f59d0>, s = ['sigmavirus24'], _w = <built-in method match of _sre.SRE_Pattern object at 0x7f50e3341670>\r\n\r\n    def decode(self, s, _w=WHITESPACE.match):\r\n        \"\"\"Return the Python representation of ``s`` (a ``str`` or ``unicode``\r\n            instance containing a JSON document)\r\n\r\n            \"\"\"\r\n>       obj, end = self.raw_decode(s, idx=_w(s, 0).end())\r\nE       TypeError: expected string or buffer\r\n```\r\n\r\nbut frankly HTTP `POST` method with the same payload and similar test passes OK. I would appreciate if somebody could look up the code and explain why is that happening.\r\n\r\nBTW, thanks for an awesome library, saved me many times.","created_at":"2018-03-28T18:39:36Z","updated_at":"2018-03-31T13:48:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f9952cdd89b8fa3e63bcbbd893de99aa675463ae","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/sigmavirus24/github3.py/pulls/815/commits","review_comments_url":"https://api.github.com/repos/sigmavirus24/github3.py/pulls/815/comments","review_comment_url":"https://api.github.com/repos/sigmavirus24/github3.py/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sigmavirus24/github3.py/issues/815/comments","statuses_url":"https://api.github.com/repos/sigmavirus24/github3.py/statuses/bdf230b40a319865e8a2dcdd66c82c17f868b67c","head":{"label":"paulchubatyy:gh-696","ref":"gh-696","sha":"bdf230b40a319865e8a2dcdd66c82c17f868b67c","user":{"login":"paulchubatyy","id":98631,"avatar_url":"https://avatars0.githubusercontent.com/u/98631?v=4","gravatar_id":"","url":"https://api.github.com/users/paulchubatyy","html_url":"https://github.com/paulchubatyy","followers_url":"https://api.github.com/users/paulchubatyy/followers","following_url":"https://api.github.com/users/paulchubatyy/following{/other_user}","gists_url":"https://api.github.com/users/paulchubatyy/gists{/gist_id}","starred_url":"https://api.github.com/users/paulchubatyy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulchubatyy/subscriptions","organizations_url":"https://api.github.com/users/paulchubatyy/orgs","repos_url":"https://api.github.com/users/paulchubatyy/repos","events_url":"https://api.github.com/users/paulchubatyy/events{/privacy}","received_events_url":"https://api.github.com/users/paulchubatyy/received_events","type":"User","site_admin":false},"repo":{"id":126427657,"name":"github3.py","full_name":"paulchubatyy/github3.py","owner":{"login":"paulchubatyy","id":98631,"avatar_url":"https://avatars0.githubusercontent.com/u/98631?v=4","gravatar_id":"","url":"https://api.github.com/users/paulchubatyy","html_url":"https://github.com/paulchubatyy","followers_url":"https://api.github.com/users/paulchubatyy/followers","following_url":"https://api.github.com/users/paulchubatyy/following{/other_user}","gists_url":"https://api.github.com/users/paulchubatyy/gists{/gist_id}","starred_url":"https://api.github.com/users/paulchubatyy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulchubatyy/subscriptions","organizations_url":"https://api.github.com/users/paulchubatyy/orgs","repos_url":"https://api.github.com/users/paulchubatyy/repos","events_url":"https://api.github.com/users/paulchubatyy/events{/privacy}","received_events_url":"https://api.github.com/users/paulchubatyy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/paulchubatyy/github3.py","description":"Hi, I'm a library for interacting with GItHub's REST API in a convenient and ergonomic way. I work on Python 2.7, 3.4, 3.5, and 3.6","fork":true,"url":"https://api.github.com/repos/paulchubatyy/github3.py","forks_url":"https://api.github.com/repos/paulchubatyy/github3.py/forks","keys_url":"https://api.github.com/repos/paulchubatyy/github3.py/keys{/key_id}","collaborators_url":"https://api.github.com/repos/paulchubatyy/github3.py/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/paulchubatyy/github3.py/teams","hooks_url":"https://api.github.com/repos/paulchubatyy/github3.py/hooks","issue_events_url":"https://api.github.com/repos/paulchubatyy/github3.py/issues/events{/number}","events_url":"https://api.github.com/repos/paulchubatyy/github3.py/events","assignees_url":"https://api.github.com/repos/paulchubatyy/github3.py/assignees{/user}","branches_url":"https://api.github.com/repos/paulchubatyy/github3.py/branches{/branch}","tags_url":"https://api.github.com/repos/paulchubatyy/github3.py/tags","blobs_url":"https://api.github.com/repos/paulchubatyy/github3.py/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/paulchubatyy/github3.py/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/paulchubatyy/github3.py/git/refs{/sha}","trees_url":"https://api.github.com/repos/paulchubatyy/github3.py/git/trees{/sha}","statuses_url":"https://api.github.com/repos/paulchubatyy/github3.py/statuses/{sha}","languages_url":"https://api.github.com/repos/paulchubatyy/github3.py/languages","stargazers_url":"https://api.github.com/repos/paulchubatyy/github3.py/stargazers","contributors_url":"https://api.github.com/repos/paulchubatyy/github3.py/contributors","subscribers_url":"https://api.github.com/repos/paulchubatyy/github3.py/subscribers","subscription_url":"https://api.github.com/repos/paulchubatyy/github3.py/subscription","commits_url":"https://api.github.com/repos/paulchubatyy/github3.py/commits{/sha}","git_commits_url":"https://api.github.com/repos/paulchubatyy/github3.py/git/commits{/sha}","comments_url":"https://api.github.com/repos/paulchubatyy/github3.py/comments{/number}","issue_comment_url":"https://api.github.com/repos/paulchubatyy/github3.py/issues/comments{/number}","contents_url":"https://api.github.com/repos/paulchubatyy/github3.py/contents/{+path}","compare_url":"https://api.github.com/repos/paulchubatyy/github3.py/compare/{base}...{head}","merges_url":"https://api.github.com/repos/paulchubatyy/github3.py/merges","archive_url":"https://api.github.com/repos/paulchubatyy/github3.py/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/paulchubatyy/github3.py/downloads","issues_url":"https://api.github.com/repos/paulchubatyy/github3.py/issues{/number}","pulls_url":"https://api.github.com/repos/paulchubatyy/github3.py/pulls{/number}","milestones_url":"https://api.github.com/repos/paulchubatyy/github3.py/milestones{/number}","notifications_url":"https://api.github.com/repos/paulchubatyy/github3.py/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/paulchubatyy/github3.py/labels{/name}","releases_url":"https://api.github.com/repos/paulchubatyy/github3.py/releases{/id}","deployments_url":"https://api.github.com/repos/paulchubatyy/github3.py/deployments","created_at":"2018-03-23T03:23:53Z","updated_at":"2018-03-26T18:00:33Z","pushed_at":"2018-03-29T22:12:05Z","git_url":"git://github.com/paulchubatyy/github3.py.git","ssh_url":"git@github.com:paulchubatyy/github3.py.git","clone_url":"https://github.com/paulchubatyy/github3.py.git","svn_url":"https://github.com/paulchubatyy/github3.py","homepage":"https://github3.readthedocs.io","size":51881,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"sigmavirus24:develop","ref":"develop","sha":"2425b4a7116b94641411c1f70ab9c810c2959499","user":{"login":"sigmavirus24","id":240830,"avatar_url":"https://avatars3.githubusercontent.com/u/240830?v=4","gravatar_id":"","url":"https://api.github.com/users/sigmavirus24","html_url":"https://github.com/sigmavirus24","followers_url":"https://api.github.com/users/sigmavirus24/followers","following_url":"https://api.github.com/users/sigmavirus24/following{/other_user}","gists_url":"https://api.github.com/users/sigmavirus24/gists{/gist_id}","starred_url":"https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sigmavirus24/subscriptions","organizations_url":"https://api.github.com/users/sigmavirus24/orgs","repos_url":"https://api.github.com/users/sigmavirus24/repos","events_url":"https://api.github.com/users/sigmavirus24/events{/privacy}","received_events_url":"https://api.github.com/users/sigmavirus24/received_events","type":"User","site_admin":false},"repo":{"id":3710711,"name":"github3.py","full_name":"sigmavirus24/github3.py","owner":{"login":"sigmavirus24","id":240830,"avatar_url":"https://avatars3.githubusercontent.com/u/240830?v=4","gravatar_id":"","url":"https://api.github.com/users/sigmavirus24","html_url":"https://github.com/sigmavirus24","followers_url":"https://api.github.com/users/sigmavirus24/followers","following_url":"https://api.github.com/users/sigmavirus24/following{/other_user}","gists_url":"https://api.github.com/users/sigmavirus24/gists{/gist_id}","starred_url":"https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sigmavirus24/subscriptions","organizations_url":"https://api.github.com/users/sigmavirus24/orgs","repos_url":"https://api.github.com/users/sigmavirus24/repos","events_url":"https://api.github.com/users/sigmavirus24/events{/privacy}","received_events_url":"https://api.github.com/users/sigmavirus24/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sigmavirus24/github3.py","description":"Hi, I'm a library for interacting with GItHub's REST API in a convenient and ergonomic way. I work on Python 2.7, 3.4, 3.5, and 3.6","fork":false,"url":"https://api.github.com/repos/sigmavirus24/github3.py","forks_url":"https://api.github.com/repos/sigmavirus24/github3.py/forks","keys_url":"https://api.github.com/repos/sigmavirus24/github3.py/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sigmavirus24/github3.py/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sigmavirus24/github3.py/teams","hooks_url":"https://api.github.com/repos/sigmavirus24/github3.py/hooks","issue_events_url":"https://api.github.com/repos/sigmavirus24/github3.py/issues/events{/number}","events_url":"https://api.github.com/repos/sigmavirus24/github3.py/events","assignees_url":"https://api.github.com/repos/sigmavirus24/github3.py/assignees{/user}","branches_url":"https://api.github.com/repos/sigmavirus24/github3.py/branches{/branch}","tags_url":"https://api.github.com/repos/sigmavirus24/github3.py/tags","blobs_url":"https://api.github.com/repos/sigmavirus24/github3.py/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sigmavirus24/github3.py/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sigmavirus24/github3.py/git/refs{/sha}","trees_url":"https://api.github.com/repos/sigmavirus24/github3.py/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sigmavirus24/github3.py/statuses/{sha}","languages_url":"https://api.github.com/repos/sigmavirus24/github3.py/languages","stargazers_url":"https://api.github.com/repos/sigmavirus24/github3.py/stargazers","contributors_url":"https://api.github.com/repos/sigmavirus24/github3.py/contributors","subscribers_url":"https://api.github.com/repos/sigmavirus24/github3.py/subscribers","subscription_url":"https://api.github.com/repos/sigmavirus24/github3.py/subscription","commits_url":"https://api.github.com/repos/sigmavirus24/github3.py/commits{/sha}","git_commits_url":"https://api.github.com/repos/sigmavirus24/github3.py/git/commits{/sha}","comments_url":"https://api.github.com/repos/sigmavirus24/github3.py/comments{/number}","issue_comment_url":"https://api.github.com/repos/sigmavirus24/github3.py/issues/comments{/number}","contents_url":"https://api.github.com/repos/sigmavirus24/github3.py/contents/{+path}","compare_url":"https://api.github.com/repos/sigmavirus24/github3.py/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sigmavirus24/github3.py/merges","archive_url":"https://api.github.com/repos/sigmavirus24/github3.py/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sigmavirus24/github3.py/downloads","issues_url":"https://api.github.com/repos/sigmavirus24/github3.py/issues{/number}","pulls_url":"https://api.github.com/repos/sigmavirus24/github3.py/pulls{/number}","milestones_url":"https://api.github.com/repos/sigmavirus24/github3.py/milestones{/number}","notifications_url":"https://api.github.com/repos/sigmavirus24/github3.py/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sigmavirus24/github3.py/labels{/name}","releases_url":"https://api.github.com/repos/sigmavirus24/github3.py/releases{/id}","deployments_url":"https://api.github.com/repos/sigmavirus24/github3.py/deployments","created_at":"2012-03-13T19:58:53Z","updated_at":"2018-03-31T13:39:22Z","pushed_at":"2018-03-31T13:39:16Z","git_url":"git://github.com/sigmavirus24/github3.py.git","ssh_url":"git@github.com:sigmavirus24/github3.py.git","clone_url":"https://github.com/sigmavirus24/github3.py.git","svn_url":"https://github.com/sigmavirus24/github3.py","homepage":"https://github3.readthedocs.io","size":51855,"stargazers_count":766,"watchers_count":766,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":289,"mirror_url":null,"archived":false,"open_issues_count":82,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":289,"open_issues":82,"watchers":766,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/sigmavirus24/github3.py/pulls/815"},"html":{"href":"https://github.com/sigmavirus24/github3.py/pull/815"},"issue":{"href":"https://api.github.com/repos/sigmavirus24/github3.py/issues/815"},"comments":{"href":"https://api.github.com/repos/sigmavirus24/github3.py/issues/815/comments"},"review_comments":{"href":"https://api.github.com/repos/sigmavirus24/github3.py/pulls/815/comments"},"review_comment":{"href":"https://api.github.com/repos/sigmavirus24/github3.py/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sigmavirus24/github3.py/pulls/815/commits"},"statuses":{"href":"https://api.github.com/repos/sigmavirus24/github3.py/statuses/bdf230b40a319865e8a2dcdd66c82c17f868b67c"}},"author_association":"NONE"}}
{"actor":{"display_login":"sigmavirus24"}}