diff --git a/github/Branch.py b/github/Branch.py index 6ffd95cf..d5f5b11c 100644 --- a/github/Branch.py +++ b/github/Branch.py @@ -13,6 +13,7 @@ # Copyright 2016 Peter Buckley # # Copyright 2018 Wan Liuyang # # Copyright 2018 sfdye # +# Copyright 2018 Steve Kowalik # # # # This file is part of PyGithub. # # http://pygithub.readthedocs.io/ # @@ -34,12 +35,15 @@ import github.GithubObject +import github.BranchProtection import github.Commit +import github.RequiredPullRequestReviews +import github.RequiredStatusChecks class Branch(github.GithubObject.NonCompletableGithubObject): """ - This class represents Branches. The reference can be found here http://developer.github.com/v3/repos/#list-branches + This class represents Branches. The reference can be found here https://developer.github.com/v3/repos/branches """ def __repr__(self): @@ -67,29 +71,282 @@ class Branch(github.GithubObject.NonCompletableGithubObject): return self._protected.value @property - def enforcement_level(self): + def protection_url(self): """ :type: string """ - return self._enforcement_level.value - - @property - def contexts(self): - """ - :type: list of strings - """ - return self._contexts.value + return self._protection_url.value def _initAttributes(self): self._commit = github.GithubObject.NotSet self._name = github.GithubObject.NotSet + self._protection_url = github.GithubObject.NotSet + self._protected = github.GithubObject.NotSet def _useAttributes(self, attributes): if "commit" in attributes: # pragma no branch self._commit = self._makeClassAttribute(github.Commit.Commit, attributes["commit"]) if "name" in attributes: # pragma no branch self._name = self._makeStringAttribute(attributes["name"]) - if "protection" in attributes: - self._protected = self._makeBoolAttribute(attributes["protection"]["enabled"]) - self._enforcement_level = self._makeStringAttribute(attributes["protection"]["required_status_checks"]["enforcement_level"]) - self._contexts = self._makeListOfStringsAttribute(attributes["protection"]["required_status_checks"]["contexts"]) + if "protection_url" in attributes: # pragma no branch + self._protection_url = self._makeStringAttribute(attributes["protection_url"]) + if "protected" in attributes: # pragma no branch + self._protected = self._makeBoolAttribute(attributes["protected"]) + + def get_protection(self): + """ + :calls: `GET /repos/:owner/:repo/branches/:branch/protection `_ + """ + headers, data = self._requester.requestJsonAndCheck( + "GET", + self.protection_url + ) + return github.BranchProtection.BranchProtection(self._requester, headers, data, completed=True) + + def edit_protection(self, strict=github.GithubObject.NotSet, contexts=github.GithubObject.NotSet, enforce_admins=github.GithubObject.NotSet, dismissal_users=github.GithubObject.NotSet, dismissal_teams=github.GithubObject.NotSet, dismiss_stale_reviews=github.GithubObject.NotSet, require_code_owner_reviews=github.GithubObject.NotSet, user_push_restrictions=github.GithubObject.NotSet, team_push_restrictions=github.GithubObject.NotSet): + """ + :calls: `PUT /repos/:owner/:repo/branches/:branch/protection `_ + :strict: bool + :contexts: list of strings + :enforce_admins: bool + :dismissal_users: list of strings + :dismissal_teams: list of strings + :dismiss_stale_reviews: bool + :require_code_owner_reviews: bool + :user_push_restrictions: list of strings + :team_push_restrictions: list of strings + + NOTE: The GitHub API groups strict and contexts together, both must + be submitted. Take care to pass both as arguments even if only one is + changing. Use edit_required_status_checks() to avoid this. + """ + assert strict is github.GithubObject.NotSet or isinstance(strict, bool), strict + assert contexts is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) or isinstance(element, (str, unicode)) for element in contexts), contexts + assert enforce_admins is github.GithubObject.NotSet or isinstance(enforce_admins, bool), enforce_admins + assert dismissal_users is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) or isinstance(element, (str, unicode)) for element in dismissal_users), dismissal_users + assert dismissal_teams is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) or isinstance(element, (str, unicode)) for element in dismissal_teams), dismissal_teams + assert dismiss_stale_reviews is github.GithubObject.NotSet or isinstance(dismiss_stale_reviews, bool), dismiss_stale_reviews + assert require_code_owner_reviews is github.GithubObject.NotSet or isinstance(require_code_owner_reviews, bool), require_code_owner_reviews + + post_parameters = {} + if strict is not github.GithubObject.NotSet or contexts is not github.GithubObject.NotSet: + if strict is github.GithubObject.NotSet: + strict = False + if contexts is github.GithubObject.NotSet: + contexts = [] + post_parameters["required_status_checks"] = {"strict": strict, "contexts": contexts} + else: + post_parameters["required_status_checks"] = None + + if enforce_admins is not github.GithubObject.NotSet: + post_parameters["enforce_admins"] = enforce_admins + else: + post_parameters["enforce_admins"] = None + + if dismissal_users is not github.GithubObject.NotSet or dismissal_teams is not github.GithubObject.NotSet or dismiss_stale_reviews is not github.GithubObject.NotSet or require_code_owner_reviews is not github.GithubObject.NotSet: + post_parameters["required_pull_request_reviews"] = {} + if dismiss_stale_reviews is not github.GithubObject.NotSet: + post_parameters["required_pull_request_reviews"]["dismiss_stale_reviews"] = dismiss_stale_reviews + if require_code_owner_reviews is not github.GithubObject.NotSet: + post_parameters["required_pull_request_reviews"]["require_code_owner_reviews"] = require_code_owner_reviews + if dismissal_users is not github.GithubObject.NotSet: + post_parameters["required_pull_request_reviews"]["dismissal_restrictions"] = {"users": dismissal_users} + if dismissal_teams is not github.GithubObject.NotSet: + if "dismissal_restrictions" not in post_parameters["required_pull_request_reviews"]: + post_parameters["required_pull_request_reviews"]["dismissal_restrictions"] = {} + post_parameters["required_pull_request_reviews"]["dismissal_restrictions"]["teams"] = dismissal_teams + else: + post_parameters["required_pull_request_reviews"] = None + if user_push_restrictions is not github.GithubObject.NotSet or team_push_restrictions is not github.GithubObject.NotSet: + if user_push_restrictions is github.GithubObject.NotSet: + user_push_restrictions = [] + if team_push_restrictions is github.GithubObject.NotSet: + team_push_restrictions = [] + post_parameters["restrictions"] = {"users": user_push_restrictions, "teams": team_push_restrictions} + else: + post_parameters["restrictions"] = None + + headers, data = self._requester.requestJsonAndCheck( + "PUT", + self.protection_url, + input=post_parameters + ) + + def remove_protection(self): + """ + :calls: `DELETE /repos/:owner/:repo/branches/:branch/protection `_ + """ + headers, data = self._requester.requestJsonAndCheck( + "DELETE", + self.protection_url, + ) + + def get_required_status_checks(self): + """ + :calls: `GET /repos/:owner/:repo/branches/:branch/protection/required_status_checks `_ + :rtype: :class:`github.RequiredStatusChecks.RequiredStatusChecks` + """ + headers, data = self._requester.requestJsonAndCheck( + "GET", + self.protection_url + "/required_status_checks" + ) + return github.RequiredStatusChecks.RequiredStatusChecks(self._requester, headers, data, completed=True) + + def edit_required_status_checks(self, strict=github.GithubObject.NotSet, contexts=github.GithubObject.NotSet): + """ + :calls: `PATCH /repos/:owner/:repo/branches/:branch/protection/required_status_checks `_ + """ + assert strict is github.GithubObject.NotSet or isinstance(strict, bool), strict + assert contexts is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) or isinstance(element, (str, unicode)) for element in contexts), contexts + + post_parameters = {} + if strict is not github.GithubObject.NotSet: + post_parameters["strict"] = strict + if contexts is not github.GithubObject.NotSet: + post_parameters["contexts"] = contexts + headers, data = self._requester.requestJsonAndCheck( + "PATCH", + self.protection_url + "/required_status_checks", + input=post_parameters + ) + + def remove_required_status_checks(self): + """ + :calls: `DELETE /repos/:owner/:repo/branches/:branch/protection/required_status_checks `_ + """ + headers, data = self._requester.requestJsonAndCheck( + "DELETE", + self.protection_url + "/required_status_checks" + ) + + def get_required_pull_request_reviews(self): + """ + :calls: `GET /repos/:owner/:repo/branches/:branch/protection/required_pull_request_reviews `_ + :rtype: :class:`github.RequiredPullRequestReviews.RequiredPullRequestReviews` + """ + headers, data = self._requester.requestJsonAndCheck( + "GET", + self.protection_url + "/required_pull_request_reviews" + ) + return github.RequiredPullRequestReviews.RequiredPullRequestReviews(self._requester, headers, data, completed=True) + + def edit_required_pull_request_reviews(self, dismissal_users=github.GithubObject.NotSet, dismissal_teams=github.GithubObject.NotSet, dismiss_stale_reviews=github.GithubObject.NotSet, require_code_owner_reviews=github.GithubObject.NotSet): + """ + :calls: `PATCH /repos/:owner/:repo/branches/:branch/protection/required_pull_request_reviews `_ + """ + assert dismissal_users is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) or isinstance(element, (str, unicode)) for element in dismissal_users), dismissal_users + assert dismissal_teams is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) or isinstance(element, (str, unicode)) for element in dismissal_teams), dismissal_teams + assert dismiss_stale_reviews is github.GithubObject.NotSet or isinstance(dismiss_stale_reviews, bool), dismiss_stale_reviews + assert require_code_owner_reviews is github.GithubObject.NotSet or isinstance(require_code_owner_reviews, bool), require_code_owner_reviews + + post_parameters = {} + if dismissal_users is not github.GithubObject.NotSet: + post_parameters["dismissal_restrictions"] = {"users": dismissal_users} + if dismissal_teams is not github.GithubObject.NotSet: + if "dismissal_restrictions" not in post_parameters: + post_parameters["dismissal_restrictions"] = {} + post_parameters["dismissal_restrictions"]["teams"] = dismissal_teams + if dismiss_stale_reviews is not github.GithubObject.NotSet: + post_parameters["dismiss_stale_reviews"] = dismiss_stale_reviews + if require_code_owner_reviews is not github.GithubObject.NotSet: + post_parameters["require_code_owner_reviews"] = require_code_owner_reviews + headers, data = self._requester.requestJsonAndCheck( + "PATCH", + self.protection_url + "/required_pull_request_reviews", + input=post_parameters + ) + + def remove_required_pull_request_reviews(self): + """ + :calls: `DELETE /repos/:owner/:repo/branches/:branch/protection/required_pull_request_reviews `_ + """ + headers, data = self._requester.requestJsonAndCheck( + "DELETE", + self.protection_url + "/required_pull_request_reviews" + ) + + def get_admin_enforcement(self): + """ + :calls: `GET /repos/:owner/:repo/branches/:branch/protection/enforce_admins `_ + :rtype: bool + """ + headers, data = self._requester.requestJsonAndCheck( + "GET", + self.protection_url + "/enforce_admins" + ) + return data["enabled"] + + def set_admin_enforcement(self): + """ + :calls: `POST /repos/:owner/:repo/branches/:branch/protection/enforce_admins `_ + """ + headers, data = self._requester.requestJsonAndCheck( + "POST", + self.protection_url + "/enforce_admins" + ) + + def remove_admin_enforcement(self): + """ + :calls: `DELETE /repos/:owner/:repo/branches/:branch/protection/enforce_admins `_ + """ + headers, data = self._requester.requestJsonAndCheck( + "DELETE", + self.protection_url + "/enforce_admins" + ) + + def get_user_push_restrictions(self): + """ + :calls: `GET /repos/:owner/:repo/branches/:branch/protection/restrictions/users `_ + :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.NamedUser.NamedUser` + """ + return github.PaginatedList.PaginatedList( + github.NamedUser.NamedUser, + self._requester, + self.protection_url + "/restrictions/users", + None + ) + + def get_team_push_restrictions(self): + """ + :calls: `GET /repos/:owner/:repo/branches/:branch/protection/restrictions/teams `_ + :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Team.Team` + """ + return github.PaginatedList.PaginatedList( + github.Team.Team, + self._requester, + self.protection_url + "/restrictions/teams", + None + ) + + def edit_user_push_restrictions(self, *users): + """ + :calls: `POST /repos/:owner/:repo/branches/:branch/protection/restrictions `_ + """ + assert all(isinstance(element, (str, unicode)) or isinstance(element, (str, unicode)) for element in users), users + + headers, data = self._requester.requestJsonAndCheck( + "POST", + self.protection_url + "/restrictions/users", + input=users + ) + + def edit_team_push_restrictions(self, *teams): + """ + :calls: `POST /repos/:owner/:repo/branches/:branch/protection/restrictions `_ + """ + assert all(isinstance(element, (str, unicode)) or isinstance(element, (str, unicode)) for element in teams), teams + + headers, data = self._requester.requestJsonAndCheck( + "POST", + self.protection_url + "/restrictions/teams", + input=teams + ) + + def remove_push_restrictions(self): + """ + :calls: `DELETE /repos/:owner/:repo/branches/:branch/protection/restrictions `_ + """ + headers, data = self._requester.requestJsonAndCheck( + "DELETE", + self.protection_url + "/restrictions" + ) diff --git a/github/BranchProtection.py b/github/BranchProtection.py new file mode 100644 index 00000000..de5196e1 --- /dev/null +++ b/github/BranchProtection.py @@ -0,0 +1,118 @@ +# -*- coding: utf-8 -*- + +############################ Copyrights and license ############################ +# # +# Copyright 2018 Steve Kowalik # +# # +# This file is part of PyGithub. # +# http://pygithub.readthedocs.io/ # +# # +# PyGithub is free software: you can redistribute it and/or modify it under # +# the terms of the GNU Lesser General Public License as published by the Free # +# Software Foundation, either version 3 of the License, or (at your option) # +# any later version. # +# # +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # +# details. # +# # +# You should have received a copy of the GNU Lesser General Public License # +# along with PyGithub. If not, see . # +# # +################################################################################ + +import github.GithubObject + +import github.NamedUser +import github.RequiredPullRequestReviews +import github.RequiredStatusChecks +import github.Team + + +class BranchProtection(github.GithubObject.CompletableGithubObject): + """ + This class represents Branch Protection. The reference can be found here https://developer.github.com/v3/repos/branches/#get-branch-protection + """ + + def __repr__(self): + return self.get__repr__({"url": self._url.value}) + + @property + def url(self): + """ + :type: string + """ + self._completeIfNotSet(self._url) + return self._url.value + + @property + def required_status_checks(self): + """ + :type: :class:github.RequiredStatusChecks.RequiredStatusChecks + """ + self._completeIfNotSet(self._required_status_checks) + return self._required_status_checks.value + + @property + def enforce_admins(self): + """ + :type: bool + """ + self._completeIfNotSet(self._enforce_admins) + return self._enforce_admins.value + + @property + def required_pull_request_reviews(self): + """ + :type: :class:github.RequiredPullRequestReviews.RequiredPullRequestReviews + """ + self._completeIfNotSet(self._required_pull_request_reviews) + return self._required_pull_request_reviews.value + + def get_user_push_restrictions(self): + """ + :rtype: :class:github.PaginatedList.PaginatedList of github.NamedUser.NamedUser + """ + if self._user_push_restrictions is github.GithubObject.NotSet: + return None + return github.PaginatedList.PaginatedList( + github.NamedUser.NamedUser, + self._requester, + self._user_push_restrictions, + None + ) + + def get_team_push_restrictions(self): + """ + :rtype: :class:github.PaginatedList.PaginatedList of github.Team.Team + """ + if self._team_push_restrictions is github.GithubObject.NotSet: + return None + return github.PaginatedList.PaginatedList( + github.Team.Team, + self._requester, + self._team_push_restrictions, + None + ) + + def _initAttributes(self): + self._url = github.GithubObject.NotSet + self._required_status_checks = github.GithubObject.NotSet + self._enforce_admins = github.GithubObject.NotSet + self._required_pull_request_reviews = github.GithubObject.NotSet + self._user_push_restrictions = github.GithubObject.NotSet + self._team_push_restrictions = github.GithubObject.NotSet + + def _useAttributes(self, attributes): + if "url" in attributes: # pragma no branch + self._url = self._makeStringAttribute(attributes["url"]) + if "required_status_checks" in attributes: # pragma no branch + self._required_status_checks = self._makeClassAttribute(github.RequiredStatusChecks.RequiredStatusChecks, attributes["required_status_checks"]) + if "enforce_admins" in attributes: # pragma no branch + self._enforce_admins = self._makeBoolAttribute(attributes["enforce_admins"]["enabled"]) + if "required_pull_request_reviews" in attributes: # pragma no branch + self._required_pull_request_reviews = self._makeClassAttribute(github.RequiredPullRequestReviews.RequiredPullRequestReviews, attributes["required_pull_request_reviews"]) + if "restrictions" in attributes: # pragma no branch + self._user_push_restrictions = attributes["restrictions"]["users_url"] + self._team_push_restrictions = attributes["restrictions"]["teams_url"] diff --git a/github/Repository.py b/github/Repository.py index 0b3645a9..9baaa65e 100644 --- a/github/Repository.py +++ b/github/Repository.py @@ -2468,37 +2468,6 @@ class Repository(github.GithubObject.CompletableGithubObject): else: return github.Commit.Commit(self._requester, headers, data, completed=True) - def protect_branch(self, branch, enabled, enforcement_level=github.GithubObject.NotSet, contexts=github.GithubObject.NotSet): - """ - :calls: `PATCH /repos/:owner/:repo/branches/:branch `_ - :param branch: string - :param enabled: boolean - :param enforcement_level: string - :param contexts: list of strings - :rtype: None - """ - - assert isinstance(branch, (str, unicode)) - assert isinstance(enabled, bool) - assert enforcement_level is github.GithubObject.NotSet or isinstance(enforcement_level, (str, unicode)), enforcement_level - assert contexts is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) or isinstance(element, (str, unicode)) for element in contexts), contexts - - post_parameters = { - "protection": {} - } - if enabled is not github.GithubObject.NotSet: - post_parameters["protection"]["enabled"] = enabled - if enforcement_level is not github.GithubObject.NotSet: - post_parameters["protection"]["required_status_checks"] = {} - post_parameters["protection"]["required_status_checks"]["enforcement_level"] = enforcement_level - if contexts is not github.GithubObject.NotSet: - post_parameters["protection"]["required_status_checks"]["contexts"] = contexts - headers, data = self._requester.requestJsonAndCheck( - "PATCH", - self.url + "/branches/" + branch, - input=post_parameters - ) - def replace_topics(self, topics): """ :calls: `PUT /repos/:owner/:repo/topics `_ diff --git a/github/RequiredPullRequestReviews.py b/github/RequiredPullRequestReviews.py new file mode 100644 index 00000000..df622a90 --- /dev/null +++ b/github/RequiredPullRequestReviews.py @@ -0,0 +1,96 @@ +# -*- coding: utf-8 -*- + +############################ Copyrights and license ############################ +# # +# Copyright 2018 Steve Kowalik # +# # +# This file is part of PyGithub. # +# http://pygithub.readthedocs.io/ # +# # +# PyGithub is free software: you can redistribute it and/or modify it under # +# the terms of the GNU Lesser General Public License as published by the Free # +# Software Foundation, either version 3 of the License, or (at your option) # +# any later version. # +# # +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # +# details. # +# # +# You should have received a copy of the GNU Lesser General Public License # +# along with PyGithub. If not, see . # +# # +################################################################################ + +import github.GithubObject + +import github.NamedUser +import github.Team + + +class RequiredPullRequestReviews(github.GithubObject.CompletableGithubObject): + """ + This class represents Required Pull Request Reviews. The reference can be found here https://developer.github.com/v3/repos/branches/#get-pull-request-review-enforcement-of-protected-branch + """ + + def __repr__(self): + return self.get__repr__({"url": self._url.value, "dismiss_stale_reviews": self._dismiss_stale_reviews.value, "require_code_owner_reviews": self._require_code_owner_reviews.value}) + + @property + def dismiss_stale_reviews(self): + """ + :type: bool + """ + self._completeIfNotSet(self._dismiss_stale_reviews) + return self._dismiss_stale_reviews.value + + @property + def require_code_owner_reviews(self): + """ + :type: bool + """ + self._completeIfNotSet(self._require_code_owner_reviews) + return self._require_code_owner_reviews.value + + @property + def url(self): + """ + :type: string + """ + self._completeIfNotSet(self._url) + return self._url.value + + @property + def dismissal_users(self): + """ + :type: list of :class:`github.NamedUser.NamedUser` + """ + self._completeIfNotSet(self._users) + return self._users.value + + @property + def dismissal_teams(self): + """ + :type: list of :class:`github.Team.Team` + """ + self._completeIfNotSet(self._teams) + return self._teams.value + + def _initAttributes(self): + self._dismiss_stale_reviews = github.GithubObject.NotSet + self._require_code_owner_reviews = github.GithubObject.NotSet + self._users = github.GithubObject.NotSet + self._teams = github.GithubObject.NotSet + + def _useAttributes(self, attributes): + if "dismissal_restrictions" in attributes: # pragma no branch + if "users" in attributes["dismissal_restrictions"]: + self._users = self._makeListOfClassesAttribute(github.NamedUser.NamedUser, attributes["dismissal_restrictions"]["users"]) + if "teams" in attributes["dismissal_restrictions"]: # pragma no branch + self._teams = self._makeListOfClassesAttribute(github.Team.Team, attributes["dismissal_restrictions"]["teams"]) + if "dismiss_stale_reviews" in attributes: # pragma no branch + self._dismiss_stale_reviews = self._makeBoolAttribute(attributes["dismiss_stale_reviews"]) + if "require_code_owner_reviews" in attributes: # pragma no branch + self._require_code_owner_reviews = self._makeBoolAttribute(attributes["require_code_owner_reviews"]) + if "url" in attributes: # pragma no branch + self._url = self._makeStringAttribute(attributes["url"]) diff --git a/github/RequiredStatusChecks.py b/github/RequiredStatusChecks.py new file mode 100644 index 00000000..e4fba2e1 --- /dev/null +++ b/github/RequiredStatusChecks.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- + +############################ Copyrights and license ############################ +# # +# Copyright 2018 Steve Kowalik # +# # +# This file is part of PyGithub. # +# http://pygithub.readthedocs.io/ # +# # +# PyGithub is free software: you can redistribute it and/or modify it under # +# the terms of the GNU Lesser General Public License as published by the Free # +# Software Foundation, either version 3 of the License, or (at your option) # +# any later version. # +# # +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # +# details. # +# # +# You should have received a copy of the GNU Lesser General Public License # +# along with PyGithub. If not, see . # +# # +################################################################################ + +import github.GithubObject + + +class RequiredStatusChecks(github.GithubObject.CompletableGithubObject): + """ + This class represents Required Status Checks. The reference can be found here https://developer.github.com/v3/repos/branches/#get-required-status-checks-of-protected-branch + """ + + def __repr__(self): + return self.get__repr__({"strict": self._strict.value, "url": self._url.value}) + + @property + def strict(self): + """ + :type: bool + """ + self._completeIfNotSet(self._strict) + return self._strict.value + + @property + def contexts(self): + """ + :type: list of string + """ + self._completeIfNotSet(self._contexts) + return self._contexts.value + + @property + def url(self): + """ + :type: string + """ + self._completeIfNotSet(self._url) + return self._url.value + + def _initAttributes(self): + self._strict = github.GithubObject.NotSet + self._contexts = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + + def _useAttributes(self, attributes): + if "strict" in attributes: # pragma no branch + self._strict = self._makeBoolAttribute(attributes["strict"]) + if "contexts" in attributes: # pragma no branch + self._contexts = self._makeListOfStringsAttribute(attributes["contexts"]) + if "url" in attributes: # pragma no branch + self._url = self._makeStringAttribute(attributes["url"]) diff --git a/github/tests/AllTests.py b/github/tests/AllTests.py index 70f5599e..60b59124 100644 --- a/github/tests/AllTests.py +++ b/github/tests/AllTests.py @@ -39,6 +39,7 @@ from AuthenticatedUser import * from Authentication import * from Authorization import * from Branch import * +from BranchProtection import * from Commit import * from CommitCombinedStatus import * from CommitComment import * @@ -75,6 +76,8 @@ from PullRequestFile import * from RateLimiting import * from Repository import * from RepositoryKey import * +from RequiredPullRequestReviews import * +from RequiredStatusChecks import * from SourceImport import * from Status import * from Tag import * diff --git a/github/tests/Branch.py b/github/tests/Branch.py index dcf901db..d20126ee 100644 --- a/github/tests/Branch.py +++ b/github/tests/Branch.py @@ -31,22 +31,145 @@ import Framework +import github + class Branch(Framework.TestCase): def setUp(self): Framework.TestCase.setUp(self) - self.branch = self.g.get_user().get_repo("PyGithub").get_branches()[0] + self.repo = self.g.get_user().get_repo("PyGithub") + self.branch = self.repo.get_branch("topic/RewriteWithGeneratedCode") + self.protected_branch = self.repo.get_branch("integrations") + self.organization_branch = self.g.get_repo("PyGithub/PyGithub").get_branch("master") def testAttributes(self): self.assertEqual(self.branch.name, "topic/RewriteWithGeneratedCode") self.assertEqual(self.branch.commit.sha, "1292bf0e22c796e91cc3d6e24b544aece8c21f2a") + self.assertEqual(self.branch.protection_url, "https://api.github.com/repos/jacquev6/PyGithub/branches/topic/RewriteWithGeneratedCode/protection") + self.assertFalse(self.branch.protected) # test __repr__() based on this attributes self.assertEqual(self.branch.__repr__(), 'Branch(name="topic/RewriteWithGeneratedCode")') - def testProtectedAttributes(self): - self.branch = self.g.get_user().get_repo("PyGithub").get_protected_branch("master") - self.assertEqual(self.branch.name, "master") - self.assertFalse(self.branch.protected) - self.assertEqual(self.branch.enforcement_level, "off") - self.assertEqual(self.branch.contexts, []) + def testEditProtection(self): + self.protected_branch.edit_protection(strict=True, require_code_owner_reviews=True) + branch_protection = self.protected_branch.get_protection() + self.assertTrue(branch_protection.required_status_checks.strict) + self.assertEqual(branch_protection.required_status_checks.contexts, []) + self.assertTrue(branch_protection.enforce_admins) + self.assertFalse(branch_protection.required_pull_request_reviews.dismiss_stale_reviews) + self.assertTrue(branch_protection.required_pull_request_reviews.require_code_owner_reviews) + + def testEditProtectionDismissalUsersWithUserOwnedBranch(self): + with self.assertRaises(github.GithubException) as raisedexp: + self.protected_branch.edit_protection(dismissal_users=["jacquev6"]) + self.assertEqual(raisedexp.exception.status, 422) + self.assertEqual( + raisedexp.exception.data, { + u'documentation_url': u'https://developer.github.com/v3/repos/branches/#update-branch-protection', + u'message': u'Validation Failed', + u'errors': [u'Only organization repositories can have users and team restrictions'] + } + ) + + def testEditProtectionPushRestrictionsWithUserOwnedBranch(self): + with self.assertRaises(github.GithubException) as raisedexp: + self.protected_branch.edit_protection(user_push_restrictions=["jacquev6"], team_push_restrictions=[]) + self.assertEqual(raisedexp.exception.status, 422) + self.assertEqual( + raisedexp.exception.data, { + u'documentation_url': u'https://developer.github.com/v3/repos/branches/#update-branch-protection', + u'message': u'Validation Failed', + u'errors': [u'Only organization repositories can have users and team restrictions'] + } + ) + + def testEditProtectionPushRestrictionsAndDismissalUser(self): + self.organization_branch.edit_protection(dismissal_users=["jacquev6"], user_push_restrictions=["jacquev6"]) + branch_protection = self.organization_branch.get_protection() + self.assertListKeyEqual(branch_protection.required_pull_request_reviews.dismissal_users, lambda u: u.login, ["jacquev6"]) + self.assertListKeyEqual(branch_protection.required_pull_request_reviews.dismissal_teams, lambda u: u.slug, []) + self.assertListKeyEqual(branch_protection.get_user_push_restrictions(), lambda u: u.login, ["jacquev6"]) + self.assertListKeyEqual(branch_protection.get_team_push_restrictions(), lambda u: u.slug, []) + + def testRemoveProtection(self): + self.assertTrue(self.protected_branch.protected) + self.protected_branch.remove_protection() + protected_branch = self.repo.get_branch("integrations") + self.assertFalse(protected_branch.protected) + with self.assertRaises(github.GithubException) as raisedexp: + protected_branch.get_protection() + self.assertEqual(raisedexp.exception.status, 404) + self.assertEqual( + raisedexp.exception.data, { + u'documentation_url': u'https://developer.github.com/v3/repos/branches/#get-branch-protection', + u'message': u'Branch not protected' + } + ) + + def testEditRequiredStatusChecks(self): + self.protected_branch.edit_required_status_checks(strict=True) + required_status_checks = self.protected_branch.get_required_status_checks() + self.assertTrue(required_status_checks.strict) + self.assertEqual(required_status_checks.contexts, ["foo/bar"]) + + def testRemoveRequiredStatusChecks(self): + self.protected_branch.remove_required_status_checks() + with self.assertRaises(github.GithubException) as raisedexp: + self.protected_branch.get_required_status_checks() + self.assertEqual(raisedexp.exception.status, 404) + self.assertEqual( + raisedexp.exception.data, { + u'documentation_url': u'https://developer.github.com/v3/repos/branches/#get-required-status-checks-of-protected-branch', + u'message': u'Required status checks not enabled' + } + ) + + def testEditRequiredPullRequestReviews(self): + self.protected_branch.edit_required_pull_request_reviews(dismiss_stale_reviews=True) + required_pull_request_reviews = self.protected_branch.get_required_pull_request_reviews() + self.assertTrue(required_pull_request_reviews.dismiss_stale_reviews) + self.assertTrue(required_pull_request_reviews.require_code_owner_reviews) + + def testEditRequiredPullRequestReviewsWithUserBranchAndDismissalUsers(self): + with self.assertRaises(github.GithubException) as raisedexp: + self.protected_branch.edit_required_pull_request_reviews(dismissal_users=["jacquev6"]) + self.assertEqual(raisedexp.exception.status, 422) + self.assertEqual( + raisedexp.exception.data, { + u'documentation_url': u'https://developer.github.com/v3/repos/branches/#update-pull-request-review-enforcement-of-protected-branch', + u'message': u'Dismissal restrictions are supported only for repositories owned by an organization.' + } + ) + + def testRemoveRequiredPullRequestReviews(self): + self.protected_branch.remove_required_pull_request_reviews() + required_pull_request_reviews = self.protected_branch.get_required_pull_request_reviews() + self.assertFalse(required_pull_request_reviews.dismiss_stale_reviews) + self.assertFalse(required_pull_request_reviews.require_code_owner_reviews) + + def testAdminEnforcement(self): + self.protected_branch.remove_admin_enforcement() + self.assertFalse(self.protected_branch.get_admin_enforcement()) + self.protected_branch.set_admin_enforcement() + self.assertTrue(self.protected_branch.get_admin_enforcement()) + + def testEditUserPushRestrictions(self): + self.organization_branch.edit_user_push_restrictions("sfdye") + self.assertListKeyEqual(self.organization_branch.get_user_push_restrictions(), lambda u: u.login, ["jacquev6", "sfdye"]) + + def testEditTeamPushRestrictions(self): + self.organization_branch.edit_team_push_restrictions("pygithub-owners") + self.assertListKeyEqual(self.organization_branch.get_team_push_restrictions(), lambda t: t.slug, ["pygithub-owners"]) + + def testRemovePushRestrictions(self): + self.organization_branch.remove_push_restrictions() + with self.assertRaises(github.GithubException) as raisedexp: + list(self.organization_branch.get_user_push_restrictions()) + self.assertEqual(raisedexp.exception.status, 404) + self.assertEqual( + raisedexp.exception.data, { + u'documentation_url': u'https://developer.github.com/v3/repos/branches/#list-team-restrictions-of-protected-branch', + u'message': u'Push restrictions not enabled' + } + ) diff --git a/github/tests/BranchProtection.py b/github/tests/BranchProtection.py new file mode 100644 index 00000000..19a655d4 --- /dev/null +++ b/github/tests/BranchProtection.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- + +############################ Copyrights and license ############################ +# # +# Copyright 2018 Steve Kowalik # +# # +# This file is part of PyGithub. # +# http://pygithub.readthedocs.io/ # +# # +# PyGithub is free software: you can redistribute it and/or modify it under # +# the terms of the GNU Lesser General Public License as published by the Free # +# Software Foundation, either version 3 of the License, or (at your option) # +# any later version. # +# # +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # +# details. # +# # +# You should have received a copy of the GNU Lesser General Public License # +# along with PyGithub. If not, see . # +# # +################################################################################ + +import Framework + + +class BranchProtection(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.branch_protection = self.g.get_user().get_repo("PyGithub").get_branch("integrations").get_protection() + + def testAttributes(self): + self.assertTrue(self.branch_protection.required_status_checks.strict) + self.assertEqual(self.branch_protection.required_status_checks.contexts, ["foo/bar"]) + self.assertEqual(self.branch_protection.url, "https://api.github.com/repos/jacquev6/PyGithub/branches/integrations/protection") + self.assertEqual(self.branch_protection.__repr__(), 'BranchProtection(url="https://api.github.com/repos/jacquev6/PyGithub/branches/integrations/protection")') diff --git a/github/tests/ReplayData/Branch.setUp.txt b/github/tests/ReplayData/Branch.setUp.txt index 42a4fbca..91c9687c 100644 --- a/github/tests/ReplayData/Branch.setUp.txt +++ b/github/tests/ReplayData/Branch.setUp.txt @@ -24,10 +24,32 @@ https GET api.github.com None -/repos/jacquev6/PyGithub/branches +/repos/jacquev6/PyGithub/branches/topic/RewriteWithGeneratedCode {'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} None 200 -[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '769'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"2dada6dafd332016bcdf06e42487e520"'), ('date', 'Thu, 10 May 2012 13:56:55 GMT'), ('content-type', 'application/json; charset=utf-8')] -[{"name":"topic/RewriteWithGeneratedCode","commit":{"sha":"1292bf0e22c796e91cc3d6e24b544aece8c21f2a","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a"}},{"name":"master","commit":{"sha":"4303c5b90e2216d927155e9609436ccb8984c495","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/4303c5b90e2216d927155e9609436ccb8984c495"}},{"name":"topic/DependencyGraph","commit":{"sha":"05157f11f29a3ac057e35d2487880c5d08bd69af","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/05157f11f29a3ac057e35d2487880c5d08bd69af"}},{"name":"develop","commit":{"sha":"4303c5b90e2216d927155e9609436ccb8984c495","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/4303c5b90e2216d927155e9609436ccb8984c495"}}] +[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '330'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"2dada6dafd332016bcdf06e42487e520"'), ('date', 'Thu, 10 May 2012 13:56:55 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"name":"topic/RewriteWithGeneratedCode","commit":{"sha":"1292bf0e22c796e91cc3d6e24b544aece8c21f2a","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a"},"protected":false,"protection_url":"https://api.github.com/repos/jacquev6/PyGithub/branches/topic/RewriteWithGeneratedCode/protection"} + +https +GET +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '395'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"46245273100a0cfb1e8339a2cfb122da"'), ('date', 'Mon, 07 May 2018 12:40:05 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"name":"integrations","commit":{"sha":"d60943db8c9ae6ca1f9400d378a757e6f281dbde","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/d60943db8c9ae6ca1f9400d378a757e6f281dbde"},"protected":true,"protection":{"enabled":true,"required_status_checks":{"contexts":["foo/bar"]},"enforce_admins":true},"protection_url":"https://api.github.com/repos/jacquev6/PyGithub/branches/integrations/protection"} + +https +GET +api.github.com +None +/repos/PyGithub/PyGithub/branches/master +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '395'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"46245273100a0cfb1e8339a2cfb122da"'), ('date', 'Sun, 13 May 2018 15:15:25 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"name":"master","commit":{"sha":"d60943db8c9ae6ca1f9400d378a757e6f281dbde","url":"https://api.github.com/repos/PyGithub/PyGithub/commits/d60943db8c9ae6ca1f9400d378a757e6f281dbde"},"protected":true,"protection":{"enabled":true},"protection_url":"https://api.github.com/repos/PyGithub/PyGithub/branches/master/protection"} diff --git a/github/tests/ReplayData/Branch.testAdminEnforcement.txt b/github/tests/ReplayData/Branch.testAdminEnforcement.txt new file mode 100644 index 00000000..b43a4865 --- /dev/null +++ b/github/tests/ReplayData/Branch.testAdminEnforcement.txt @@ -0,0 +1,44 @@ +https +DELETE +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations/protection/enforce_admins +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +204 +[('status', '204 No Content'), ('x-ratelimit-remaining', '4994'), ('content-length', '330'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"2dada6dafd332016bcdf06e42487e520"'), ('date', 'Thu, 10 May 2012 13:56:55 GMT'), ('content-type', 'application/json; charset=utf-8')] + + +https +GET +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations/protection/enforce_admins +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-oauth-scopes', 'public_repo, repo:status'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('x-accepted-oauth-scopes', ''), ('etag', 'W/"5ebb2cbbb268262fba4eade23df2ed85"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('referrer-policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('status', '200 OK'), ('x-ratelimit-remaining', '4975'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('transfer-encoding', 'chunked'), ('x-github-request-id', '935C:2DD6:186AD1F:1F9B1CD:5AF58E17'), ('date', 'Fri, 11 May 2018 12:35:41 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('content-encoding', 'gzip'), ('x-runtime-rack', '0.035550'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1526042267')] +{"url":"https://api.github.com/repos/jacquev6/PyGithub/branches/add-pr-review-request/protection/enforce_admins","enabled":false} + +https +POST +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations/protection/enforce_admins +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-oauth-scopes', 'public_repo, repo:status'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('x-accepted-oauth-scopes', ''), ('etag', 'W/"5ebb2cbbb268262fba4eade23df2ed85"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('referrer-policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('status', '200 OK'), ('x-ratelimit-remaining', '4975'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('transfer-encoding', 'chunked'), ('x-github-request-id', '935C:2DD6:186AD1F:1F9B1CD:5AF58E17'), ('date', 'Fri, 11 May 2018 12:35:51 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('content-encoding', 'gzip'), ('x-runtime-rack', '0.035550'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1526042267')] +'' + +https +GET +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations/protection/enforce_admins +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-oauth-scopes', 'public_repo, repo:status'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('x-accepted-oauth-scopes', ''), ('etag', 'W/"7e30c47ab395fea0aa2cb8f9c487c7be"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('referrer-policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('status', '200 OK'), ('x-ratelimit-remaining', '4998'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('transfer-encoding', 'chunked'), ('x-github-request-id', '92CC:2DD0:1360C19:194AF93:5AF58EA4'), ('date', 'Fri, 11 May 2018 12:38:01 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('content-encoding', 'gzip'), ('x-runtime-rack', '0.038876'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1526045876')] +{"url":"https://api.github.com/repos/jacquev6/PyGithub/branches/add-pr-review-request/protection/enforce_admins","enabled":true} + diff --git a/github/tests/ReplayData/Branch.testEditProtection.txt b/github/tests/ReplayData/Branch.testEditProtection.txt new file mode 100644 index 00000000..48597c0b --- /dev/null +++ b/github/tests/ReplayData/Branch.testEditProtection.txt @@ -0,0 +1,22 @@ +https +PUT +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations/protection +{'Authorization': 'Basic login_and_password_removed', 'Content-Type': 'application/json', 'User-Agent': 'PyGithub/Python'} +{"restrictions": null, "required_pull_request_reviews": {"require_code_owner_reviews": true}, "required_status_checks": {"contexts": [], "strict": true}, "enforce_admins": null} +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '0'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"e0dc2dfc56971f4a36de1216356ea98b"'), ('date', 'Sat, 05 May 2018 06:05:54 GMT'), ('content-type', 'application/json; charset=utf-8')] +'' + +https +GET +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations/protection +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '0'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"81ba94a48ad867b26d48c023ac584f43"'), ('date', 'Mon, 07 May 2018 13:42:41 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"url":"https://api.github.com/repos/jacquev6/PyGithub/branches/integrations/protection","required_pull_request_reviews":{"url":"https://api.github.com/repos/jacquev6/PyGithub/branches/integrations/protection/required_pull_request_reviews","dismiss_stale_reviews":false,"require_code_owner_reviews":true},"required_status_checks":{"url":"https://api.github.com/repos/jacquev6/PyGithub/branches/integrations/protection/required_status_checks","strict":true,"contexts":[],"contexts_url":"https://api.github.com/repos/jacquev6/PyGithub/branches/integrations/protection/required_status_checks/contexts"},"enforce_admins":{"url":"https://api.github.com/repos/jacquev6/PyGithub/branches/integrations/protection/enforce_admins","enabled":true}} + diff --git a/github/tests/ReplayData/Branch.testEditProtectionDismissalUsersWithUserOwnedBranch.txt b/github/tests/ReplayData/Branch.testEditProtectionDismissalUsersWithUserOwnedBranch.txt new file mode 100644 index 00000000..4c138edf --- /dev/null +++ b/github/tests/ReplayData/Branch.testEditProtectionDismissalUsersWithUserOwnedBranch.txt @@ -0,0 +1,11 @@ +https +PUT +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations/protection +{'Authorization': 'Basic login_and_password_removed', 'Content-Type': 'application/json', 'User-Agent': 'PyGithub/Python'} +{"restrictions": null, "required_pull_request_reviews": {"dismissal_restrictions": {"users": ["jacquev6"]}}, "required_status_checks": null, "enforce_admins": null} +422 +[('status', '422 Unprocessable Entity'), ('x-ratelimit-remaining', '4994'), ('content-length', '0'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"e0dc2dfc56971f4a36de1216356ea98b"'), ('date', 'Sun, 13 May 2018 10:42:14 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"documentation_url":"https://developer.github.com/v3/repos/branches/#update-branch-protection","message":"Validation Failed","errors":["Only organization repositories can have users and team restrictions"]} + diff --git a/github/tests/ReplayData/Branch.testEditProtectionPushRestrictionsAndDismissalUser.txt b/github/tests/ReplayData/Branch.testEditProtectionPushRestrictionsAndDismissalUser.txt new file mode 100644 index 00000000..3027deb5 --- /dev/null +++ b/github/tests/ReplayData/Branch.testEditProtectionPushRestrictionsAndDismissalUser.txt @@ -0,0 +1,44 @@ +https +PUT +api.github.com +None +/repos/PyGithub/PyGithub/branches/master/protection +{'Authorization': 'Basic login_and_password_removed', 'Content-Type': 'application/json', 'User-Agent': 'PyGithub/Python'} +{"restrictions": {"teams": [], "users": ["jacquev6"]}, "required_pull_request_reviews": {"dismissal_restrictions": {"users": ["jacquev6"]}}, "required_status_checks": null, "enforce_admins": null} +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '0'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"e0dc2dfc56971f4a36de1216356ea98b"'), ('date', 'Sun, 13 May 2018 13:21:24 GMT'), ('content-type', 'application/json; charset=utf-8')] +'' + +https +GET +api.github.com +None +/repos/PyGithub/PyGithub/branches/master/protection +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('x-runtime-rack', '0.049160'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-oauth-scopes', 'public_repo, repo:status'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('x-accepted-oauth-scopes', ''), ('etag', 'W/"a4ef2f2bcfdf33fadd5c8fa6867ebc3a"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('referrer-policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('status', '200 OK'), ('x-ratelimit-remaining', '4986'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('transfer-encoding', 'chunked'), ('x-github-request-id', '860C:2DC5:28789D:34E3E8:5AF7FF18'), ('date', 'Sun, 13 May 2018 09:02:17 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('content-encoding', 'gzip'), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1526204223')] +{"url":"https://api.github.com/repos/PyGithub/PyGithub/branches/master/protection","restrictions":{"url":"https://api.github.com/repos/PyGithub/PyGithub/branches/master/protection/restrictions","users_url":"https://api.github.com/repos/PyGithub/PyGithub/branches/master/protection/restrictions/users","teams":[],"teams_url":"https://api.github.com/repos/PyGithub/PyGithub/branches/master/protection/restrictions/teams","users":[{"owned_private_repos":5,"collaborators":0,"type":"User","hireable":false,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","public_gists":1,"company":"Criteo","bio":"","url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","private_gists":5,"plan":{"collaborators":1,"private_repos":5,"name":"micro","space":614400},"public_repos":11,"followers":13,"login":"jacquev6","blog":"http://vincent-jacques.net","email":"vincent@vincent-jacques.net","disk_usage":16852,"html_url":"https://github.com/jacquev6","name":"VincentJacques","total_private_repos":5,"created_at":"2010-07-09T06:10:06Z","location":"Paris,France","id":327146,"following":24}]},"required_pull_request_reviews":{"url":"https://api.github.com/repos/PyGithub/PyGithub/branches/master/protection/required_pull_request_reviews","dismiss_stale_reviews":false,"require_code_owner_reviews":false,"dismissal_restrictions":{"url":"https://api.github.com/repos/PyGithub/PyGithub/branches/master/protection/dismissal_restrictions","users_url":"https://api.github.com/repos/PyGithub/PyGithub/branches/master/protection/dismissal_restrictions/users","teams":[],"teams_url":"https://api.github.com/repos/PyGithub/PyGithub/branches/master/protection/dismissal_restrictions/teams","users":[{"owned_private_repos":5,"collaborators":0,"type":"User","hireable":false,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","public_gists":1,"company":"Criteo","bio":"","url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","private_gists":5,"plan":{"collaborators":1,"private_repos":5,"name":"micro","space":614400},"public_repos":11,"followers":13,"login":"jacquev6","blog":"http://vincent-jacques.net","email":"vincent@vincent-jacques.net","disk_usage":16852,"html_url":"https://github.com/jacquev6","name":"VincentJacques","total_private_repos":5,"created_at":"2010-07-09T06:10:06Z","location":"Paris,France","id":327146,"following":24}]}},"enforce_admins":{"url":"https://api.github.com/repos/PyGithub/PyGithub/branches/master/protection/enforce_admins","enabled":false}} + +https +GET +api.github.com +None +/repos/PyGithub/PyGithub/branches/master/protection/restrictions/users +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('x-runtime-rack', '0.049160'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-oauth-scopes', 'public_repo, repo:status'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('x-accepted-oauth-scopes', ''), ('etag', 'W/"a4ef2f2bcfdf33fadd5c8fa6867ebc3a"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('referrer-policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('status', '200 OK'), ('x-ratelimit-remaining', '4986'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('transfer-encoding', 'chunked'), ('x-github-request-id', '860C:2DC5:28789D:34E3E8:5AF7FF18'), ('date', 'Sun, 13 May 2018 09:02:17 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('content-encoding', 'gzip'), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1526204223')] +[{"owned_private_repos":5,"collaborators":0,"type":"User","hireable":false,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","public_gists":1,"company":"Criteo","bio":"","url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","private_gists":5,"plan":{"collaborators":1,"private_repos":5,"name":"micro","space":614400},"public_repos":11,"followers":13,"login":"jacquev6","blog":"http://vincent-jacques.net","email":"vincent@vincent-jacques.net","disk_usage":16852,"html_url":"https://github.com/jacquev6","name":"VincentJacques","total_private_repos":5,"created_at":"2010-07-09T06:10:06Z","location":"Paris,France","id":327146,"following":24}] + +https +GET +api.github.com +None +/repos/PyGithub/PyGithub/branches/master/protection/restrictions/teams +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('x-runtime-rack', '0.049160'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-oauth-scopes', 'public_repo, repo:status'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('x-accepted-oauth-scopes', ''), ('etag', 'W/"a4ef2f2bcfdf33fadd5c8fa6867ebc3a"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('referrer-policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('status', '200 OK'), ('x-ratelimit-remaining', '4986'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('transfer-encoding', 'chunked'), ('x-github-request-id', '860C:2DC5:28789D:34E3E8:5AF7FF18'), ('date', 'Sun, 13 May 2018 09:02:17 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('content-encoding', 'gzip'), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1526204223')] +[] + diff --git a/github/tests/ReplayData/Branch.testEditProtectionPushRestrictionsWithUserOwnedBranch.txt b/github/tests/ReplayData/Branch.testEditProtectionPushRestrictionsWithUserOwnedBranch.txt new file mode 100644 index 00000000..7a88ff9a --- /dev/null +++ b/github/tests/ReplayData/Branch.testEditProtectionPushRestrictionsWithUserOwnedBranch.txt @@ -0,0 +1,11 @@ +https +PUT +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations/protection +{'Authorization': 'Basic login_and_password_removed', 'Content-Type': 'application/json', 'User-Agent': 'PyGithub/Python'} +{"restrictions": {"users": ["jacquev6"], "teams": []}, "required_pull_request_reviews": null, "required_status_checks": null, "enforce_admins": null} +422 +[('status', '422 Unprocessable Entity'), ('x-ratelimit-remaining', '4994'), ('content-length', '0'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"e0dc2dfc56971f4a36de1216356ea98b"'), ('date', 'Sat, 05 May 2018 06:05:54 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"documentation_url":"https://developer.github.com/v3/repos/branches/#update-branch-protection","message":"Validation Failed","errors":["Only organization repositories can have users and team restrictions"]} + diff --git a/github/tests/ReplayData/Branch.testEditRequiredPullRequestReviews.txt b/github/tests/ReplayData/Branch.testEditRequiredPullRequestReviews.txt new file mode 100644 index 00000000..875396d9 --- /dev/null +++ b/github/tests/ReplayData/Branch.testEditRequiredPullRequestReviews.txt @@ -0,0 +1,22 @@ +https +PATCH +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations/protection/required_pull_request_reviews +{'Authorization': 'Basic login_and_password_removed', 'Content-Type': 'application/json', 'User-Agent': 'PyGithub/Python'} +{"dismiss_stale_reviews":true} +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '0'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"81ba94a48ad867b26d48c023ac584f43"'), ('date', 'Mon, 07 May 2018 13:42:41 GMT'), ('content-type', 'application/json; charset=utf-8')] +'' + +https +GET +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations/protection/required_pull_request_reviews +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('x-runtime-rack', '0.041627'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-oauth-scopes', 'public_repo, repo:status'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('x-accepted-oauth-scopes', ''), ('etag', 'W/"3488d056130a553f9c03f03ed12d07db"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('referrer-policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('status', '200 OK'), ('x-ratelimit-remaining', '4988'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('transfer-encoding', 'chunked'), ('x-github-request-id', '8C96:2DD0:1347823:192926E:5AF58689'), ('date', 'Fri, 11 May 2018 12:03:36 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('content-encoding', 'gzip'), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1526042267')] +{"url":"https://api.github.com/repos/jacquev6/PyGithub/branches/integrations/protection/required_pull_request_reviews","dismiss_stale_reviews":true,"require_code_owner_reviews":true} + diff --git a/github/tests/ReplayData/Branch.testEditRequiredPullRequestReviewsWithUserBranchAndDismissalUsers.txt b/github/tests/ReplayData/Branch.testEditRequiredPullRequestReviewsWithUserBranchAndDismissalUsers.txt new file mode 100644 index 00000000..211789d1 --- /dev/null +++ b/github/tests/ReplayData/Branch.testEditRequiredPullRequestReviewsWithUserBranchAndDismissalUsers.txt @@ -0,0 +1,10 @@ +https +PATCH +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations/protection/required_pull_request_reviews +{'Authorization': 'Basic login_and_password_removed', 'Content-Type': 'application/json', 'User-Agent': 'PyGithub/Python'} +{"dismissal_restrictions":{"users":["jacquev6"]}} +422 +[('status', '422 Unprocessable Entity'), ('content-length', '227'), ('x-content-type-options', 'nosniff'), ('content-security-policy', "default-src 'none'"), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', 'AE1E5031:A39B:2D392574:568E6BC1'), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('x-ratelimit-remaining', '4991'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-xss-protection', '1; mode=block'), ('access-control-allow-credentials', 'true'), ('date', 'Mon, 07 May 2018 12:46:55 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-frame-options', 'deny'), ('x-ratelimit-reset', '1452177625')] +{"documentation_url":"https://developer.github.com/v3/repos/branches/#update-pull-request-review-enforcement-of-protected-branch","message":"Dismissal restrictions are supported only for repositories owned by an organization."} diff --git a/github/tests/ReplayData/Branch.testEditRequiredStatusChecks.txt b/github/tests/ReplayData/Branch.testEditRequiredStatusChecks.txt new file mode 100644 index 00000000..40b74f7e --- /dev/null +++ b/github/tests/ReplayData/Branch.testEditRequiredStatusChecks.txt @@ -0,0 +1,21 @@ +https +PATCH +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations/protection/required_status_checks +{'Authorization': 'Basic login_and_password_removed', 'Content-Type': 'application/json', 'User-Agent': 'PyGithub/Python'} +{"strict":true} +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '0'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"81ba94a48ad867b26d48c023ac584f43"'), ('date', 'Mon, 07 May 2018 13:42:41 GMT'), ('content-type', 'application/json; charset=utf-8')] +'' + +https +GET +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations/protection/required_status_checks +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('x-runtime-rack', '0.033407'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP'), ('x-oauth-scopes', 'public_repo, repo:status'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('x-accepted-oauth-scopes', ''), ('etag', 'W/"f972722557f6bbc814f109abae4df24e"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('referrer-policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('status', '200 OK'), ('x-ratelimit-remaining', '4995'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('transfer-encoding', 'chunked'), ('x-github-request-id', '9946:55F2:20CF9A0:423578E:5AF580B7'), ('date', 'Fri, 11 May 2018 11:38:40 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('content-encoding', 'gzip'), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1526042267')] +{"url":"https://api.github.com/repos/jacquev6/PyGithub/branches/integrations/protection/required_status_checks","strict":true,"contexts":["foo/bar"],"contexts_url":"https://api.github.com/repos/jacquev6/PyGithub/branches/integrations/protection/required_status_checks/contexts"} diff --git a/github/tests/ReplayData/Branch.testEditTeamPushRestrictions.txt b/github/tests/ReplayData/Branch.testEditTeamPushRestrictions.txt new file mode 100644 index 00000000..073996eb --- /dev/null +++ b/github/tests/ReplayData/Branch.testEditTeamPushRestrictions.txt @@ -0,0 +1,21 @@ +https +POST +api.github.com +None +/repos/PyGithub/PyGithub/branches/master/protection/restrictions/teams +{'Authorization': 'Basic login_and_password_removed', 'Content-Type': 'application/json', 'User-Agent': 'PyGithub/Python'} +["pygithub-owners"] +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '0'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"81ba94a48ad867b26d48c023ac584f43"'), ('date', 'Sun, 13 May 2018 11:21:07 GMT'), ('content-type', 'application/json; charset=utf-8')] +'' + +https +GET +api.github.com +None +/repos/PyGithub/PyGithub/branches/master/protection/restrictions/teams +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('x-runtime-rack', '0.033407'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP'), ('x-oauth-scopes', 'public_repo, repo:status'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('x-accepted-oauth-scopes', ''), ('etag', 'W/"f972722557f6bbc814f109abae4df24e"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('referrer-policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('status', '200 OK'), ('x-ratelimit-remaining', '4995'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('transfer-encoding', 'chunked'), ('x-github-request-id', '9946:55F2:20CF9A0:423578E:5AF580B7'), ('date', 'Fri, 13 May 2018 11:22:40 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('content-encoding', 'gzip'), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1526042267')] +[{"name":"pygithub-owners","id":585225,"slug":"pygithub-owners","description":"","privacy":"closed","url":"https://api.github.com/teams/585225","members_url":"https://api.github.com/teams/585225/members{/member}","repositories_url":"https://api.github.com/teams/585225/repos","permission":"pull"}] diff --git a/github/tests/ReplayData/Branch.testEditUserPushRestrictions.txt b/github/tests/ReplayData/Branch.testEditUserPushRestrictions.txt new file mode 100644 index 00000000..2fdcc0f8 --- /dev/null +++ b/github/tests/ReplayData/Branch.testEditUserPushRestrictions.txt @@ -0,0 +1,21 @@ +https +POST +api.github.com +None +/repos/PyGithub/PyGithub/branches/master/protection/restrictions/users +{'Authorization': 'Basic login_and_password_removed', 'Content-Type': 'application/json', 'User-Agent': 'PyGithub/Python'} +["sfdye"] +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '0'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"81ba94a48ad867b26d48c023ac584f43"'), ('date', 'Sun, 13 May 2018 11:06:07 GMT'), ('content-type', 'application/json; charset=utf-8')] +'' + +https +GET +api.github.com +None +/repos/PyGithub/PyGithub/branches/master/protection/restrictions/users +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('x-runtime-rack', '0.033407'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP'), ('x-oauth-scopes', 'public_repo, repo:status'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('x-accepted-oauth-scopes', ''), ('etag', 'W/"f972722557f6bbc814f109abae4df24e"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('referrer-policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('status', '200 OK'), ('x-ratelimit-remaining', '4995'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('transfer-encoding', 'chunked'), ('x-github-request-id', '9946:55F2:20CF9A0:423578E:5AF580B7'), ('date', 'Fri, 13 May 2018 11:07:40 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('content-encoding', 'gzip'), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1526042267')] +[{"owned_private_repos":5,"collaborators":0,"type":"User","hireable":false,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","public_gists":1,"company":"Criteo","bio":"","url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","private_gists":5,"plan":{"collaborators":1,"private_repos":5,"name":"micro","space":614400},"public_repos":11,"followers":13,"login":"jacquev6","blog":"http://vincent-jacques.net","email":"vincent@vincent-jacques.net","disk_usage":16852,"html_url":"https://github.com/jacquev6","name":"Vincent Jacques","total_private_repos":5,"created_at":"2010-07-09T06:10:06Z","location":"Paris, France","id":327146,"following":24},{"login":"sfdye","id":343369,"avatar_url":"https://avatars2.githubusercontent.com/u/343369?v=4","gravatar_id":"","url":"https://api.github.com/users/sfdye","html_url":"https://github.com/sfdye","followers_url":"https://api.github.com/users/sfdye/followers","following_url":"https://api.github.com/users/sfdye/following{/other_user}","gists_url":"https://api.github.com/users/sfdye/gists{/gist_id}","starred_url":"https://api.github.com/users/sfdye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sfdye/subscriptions","organizations_url":"https://api.github.com/users/sfdye/orgs","repos_url":"https://api.github.com/users/sfdye/repos","events_url":"https://api.github.com/users/sfdye/events{/privacy}","received_events_url":"https://api.github.com/users/sfdye/received_events","type":"User","site_admin":false}] diff --git a/github/tests/ReplayData/Branch.testRemoveProtection.txt b/github/tests/ReplayData/Branch.testRemoveProtection.txt new file mode 100644 index 00000000..948f57e7 --- /dev/null +++ b/github/tests/ReplayData/Branch.testRemoveProtection.txt @@ -0,0 +1,32 @@ +https +DELETE +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations/protection +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +204 +[('status', '204 No Content'), ('x-ratelimit-remaining', '4994'), ('content-length', '330'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"2dada6dafd332016bcdf06e42487e520"'), ('date', 'Thu, 10 May 2012 13:56:55 GMT'), ('content-type', 'application/json; charset=utf-8')] + + +https +GET +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '395'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"46245273100a0cfb1e8339a2cfb122da"'), ('date', 'Mon, 07 May 2018 12:40:05 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"name":"integrations","commit":{"sha":"d60943db8c9ae6ca1f9400d378a757e6f281dbde","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/d60943db8c9ae6ca1f9400d378a757e6f281dbde"},"protected":false,"protection_url":"https://api.github.com/repos/jacquev6/PyGithub/branches/integrations/protection"} + +https +GET +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations/protection +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +404 +[('status', '404 Not Found'), ('content-length', '126'), ('x-content-type-options', 'nosniff'), ('content-security-policy', "default-src 'none'"), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', 'AE1E5031:A39B:2D392574:568E6BC1'), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('x-ratelimit-remaining', '4991'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-xss-protection', '1; mode=block'), ('access-control-allow-credentials', 'true'), ('date', 'Mon, 07 May 2018 12:46:55 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-frame-options', 'deny'), ('x-ratelimit-reset', '1452177625')] +{"documentation_url":"https://developer.github.com/v3/repos/branches/#get-branch-protection","message":"Branch not protected"} diff --git a/github/tests/ReplayData/Branch.testRemovePushRestrictions.txt b/github/tests/ReplayData/Branch.testRemovePushRestrictions.txt new file mode 100644 index 00000000..866fe872 --- /dev/null +++ b/github/tests/ReplayData/Branch.testRemovePushRestrictions.txt @@ -0,0 +1,22 @@ +https +DELETE +api.github.com +None +/repos/PyGithub/PyGithub/branches/master/protection/restrictions +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +204 +[('status', '204 No Content'), ('x-ratelimit-remaining', '4994'), ('content-length', '330'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"2dada6dafd332016bcdf06e42487e520"'), ('date', 'Sun, 13 May 2012 10:46:19 GMT'), ('content-type', 'application/json; charset=utf-8')] + + +https +GET +api.github.com +None +/repos/PyGithub/PyGithub/branches/master/protection/restrictions/users +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +404 +[('status', '404 Not Found'), ('content-length', '126'), ('x-content-type-options', 'nosniff'), ('content-security-policy', "default-src 'none'"), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', 'AE1E5031:A39B:2D392574:568E6BC1'), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('x-ratelimit-remaining', '4991'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-xss-protection', '1; mode=block'), ('access-control-allow-credentials', 'true'), ('date', 'Sun, 13 May 2018 10:52:10 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-frame-options', 'deny'), ('x-ratelimit-reset', '1452177625')] +{"documentation_url":"https://developer.github.com/v3/repos/branches/#list-team-restrictions-of-protected-branch","message":"Push restrictions not enabled"} + diff --git a/github/tests/ReplayData/Branch.testRemoveRequiredPullRequestReviews.txt b/github/tests/ReplayData/Branch.testRemoveRequiredPullRequestReviews.txt new file mode 100644 index 00000000..857c3eb3 --- /dev/null +++ b/github/tests/ReplayData/Branch.testRemoveRequiredPullRequestReviews.txt @@ -0,0 +1,21 @@ +https +DELETE +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations/protection/required_pull_request_reviews +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +204 +[('status', '204 No Content'), ('x-ratelimit-remaining', '4994'), ('content-length', '330'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"2dada6dafd332016bcdf06e42487e520"'), ('date', 'Thu, 10 May 2012 13:56:55 GMT'), ('content-type', 'application/json; charset=utf-8')] + + +https +GET +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations/protection/required_pull_request_reviews +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('x-runtime-rack', '0.056567'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-oauth-scopes', 'public_repo, repo:status'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('x-accepted-oauth-scopes', ''), ('etag', 'W/"6686cddc9495f58aa23d6956c10cc1a6"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('referrer-policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('status', '200 OK'), ('x-ratelimit-remaining', '4980'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('transfer-encoding', 'chunked'), ('x-github-request-id', '8DC0:2DD0:134EC8E:193336D:5AF588B1'), ('date', 'Fri, 11 May 2018 12:12:39 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('content-encoding', 'gzip'), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1526042267')] +{"url":"https://api.github.com/repos/jacquev6/PyGithub/branches/integrations/protection/required_pull_request_reviews","dismiss_stale_reviews":false,"require_code_owner_reviews":false} diff --git a/github/tests/ReplayData/Branch.testRemoveRequiredStatusChecks.txt b/github/tests/ReplayData/Branch.testRemoveRequiredStatusChecks.txt new file mode 100644 index 00000000..ab723c2a --- /dev/null +++ b/github/tests/ReplayData/Branch.testRemoveRequiredStatusChecks.txt @@ -0,0 +1,22 @@ +https +DELETE +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations/protection/required_status_checks +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +204 +[('status', '204 No Content'), ('x-ratelimit-remaining', '4994'), ('content-length', '330'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"2dada6dafd332016bcdf06e42487e520"'), ('date', 'Thu, 10 May 2012 13:56:55 GMT'), ('content-type', 'application/json; charset=utf-8')] + + +https +GET +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations/protection/required_status_checks +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +404 +[('status', '404 Not Found'), ('content-length', '126'), ('x-content-type-options', 'nosniff'), ('content-security-policy', "default-src 'none'"), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', 'AE1E5031:A39B:2D392574:568E6BC1'), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('x-ratelimit-remaining', '4991'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-xss-protection', '1; mode=block'), ('access-control-allow-credentials', 'true'), ('date', 'Mon, 07 May 2018 12:46:55 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-frame-options', 'deny'), ('x-ratelimit-reset', '1452177625')] +{"documentation_url":"https://developer.github.com/v3/repos/branches/#get-required-status-checks-of-protected-branch","message":"Required status checks not enabled"} + diff --git a/github/tests/ReplayData/BranchProtection.setUp.txt b/github/tests/ReplayData/BranchProtection.setUp.txt new file mode 100644 index 00000000..eac4884e --- /dev/null +++ b/github/tests/ReplayData/BranchProtection.setUp.txt @@ -0,0 +1,43 @@ +https +GET +api.github.com +None +/user +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4967'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"27524c635501121933f4f78c95b1945a"'), ('date', 'Fri, 18 May 2012 20:12:19 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"owned_private_repos":5,"collaborators":0,"type":"User","hireable":false,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","public_gists":1,"company":"Criteo","bio":"","url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","private_gists":5,"plan":{"collaborators":1,"private_repos":5,"name":"micro","space":614400},"public_repos":11,"followers":13,"login":"jacquev6","blog":"http://vincent-jacques.net","email":"vincent@vincent-jacques.net","disk_usage":16852,"html_url":"https://github.com/jacquev6","name":"Vincent Jacques","total_private_repos":5,"created_at":"2010-07-09T06:10:06Z","location":"Paris, France","id":327146,"following":24} + +https +GET +api.github.com +None +/repos/jacquev6/PyGithub +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4966'), ('content-length', '1097'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"c5eec74d4b76b80283636a8efe1a132c"'), ('date', 'Fri, 18 May 2012 20:12:20 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"svn_url":"https://github.com/jacquev6/PyGithub","has_wiki":false,"has_issues":true,"updated_at":"2012-05-18T05:29:54Z","forks":2,"homepage":"http://vincent-jacques.net/PyGithub","git_url":"git://github.com/jacquev6/PyGithub.git","url":"https://api.github.com/repos/jacquev6/PyGithub","clone_url":"https://github.com/jacquev6/PyGithub.git","open_issues":17,"fork":false,"ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-18T05:18:16Z","size":304,"private":false,"has_downloads":true,"watchers":13,"html_url":"https://github.com/jacquev6/PyGithub","owner":{"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"name":"PyGithub","permissions":{"pull":true,"admin":true,"push":true},"mirror_url":null,"language":"Python","description":"Python library implementing the full Github API v3","created_at":"2012-02-25T12:53:47Z","id":3544490} + +https +GET +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '330'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"2dada6dafd332016bcdf06e42487e520"'), ('date', 'Thu, 10 May 2012 13:56:55 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"name":"integrations","commit":{"sha":"d60943db8c9ae6ca1f9400d378a757e6f281dbde","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/d60943db8c9ae6ca1f9400d378a757e6f281dbde"},"protected":true,"protection":{"enabled":true,"required_status_checks":{"strict":true,"contexts":["foo/bar"]}},"protection_url":"https://api.github.com/repos/jacquev6/PyGithub/branches/integrations/protection"} + +https +GET +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations/protection +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('x-runtime-rack', '0.050971'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP'), ('x-oauth-scopes', 'public_repo, repo:status'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('x-accepted-oauth-scopes', ''), ('etag', 'W/"e0dc2dfc56971f4a36de1216356ea98b"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('referrer-policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('status', '200 OK'), ('x-ratelimit-remaining', '4993'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('transfer-encoding', 'chunked'), ('x-github-request-id', 'E962:55F3:1A4A1F1:404B411:5AF928BE'), ('date', 'Mon, 14 May 2018 06:12:48 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('content-encoding', 'gzip'), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1526281649')] +{"url": "https://api.github.com/repos/jacquev6/PyGithub/branches/integrations/protection", "required_pull_request_reviews": {"url": "https://api.github.com/repos/jacquev6/PyGithub/branches/add-pr-review-request/protection/required_pull_request_reviews", "dismiss_stale_reviews": true, "require_code_owner_reviews": false}, "required_status_checks": {"url": "https://api.github.com/repos/jacquev6/PyGithub/branches/add-pr-review-request/protection/required_status_checks", "strict": true, "contexts": ["foo/bar"], "contexts_url": "https://api.github.com/repos/jacquev6/PyGithub/branches/add-pr-review-request/protection/required_status_checks/contexts"}, "enforce_admins": {"url": "https://api.github.com/repos/jacquev6/PyGithub/branches/add-pr-review-request/protection/enforce_admins", "enabled": true}} diff --git a/github/tests/ReplayData/Repository.testChangeBranchProtectionContexts.txt b/github/tests/ReplayData/Repository.testChangeBranchProtectionContexts.txt deleted file mode 100644 index 1fdb6927..00000000 --- a/github/tests/ReplayData/Repository.testChangeBranchProtectionContexts.txt +++ /dev/null @@ -1,66 +0,0 @@ -https -PATCH -api.github.com -None -/repos/jacquev6/PyGithub/branches/master -{'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} -{"protection": {"enabled": true, "required_status_checks": {"enforcement_level": "everyone", "contexts": ["test"]}}} -200 -[('content-length', '3599'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', '76d9828c7e4f1d910f7ba069e90ce976'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('etag', '"23247e636875225f1e2d6b49e3ed8fb5"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4983'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '417D879D:1D25A:7429E1A:568D31F4'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Wed, 06 Jan 2016 15:25:40 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1452096288')] -{"name":"master","commit":{"sha":"a39c1e8b9ab601419277eefb4fbb586ded0af146","commit":{"author":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"committer":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"message":"Merge pull request #365 from PyGithub/nhomar-travis-button\n\nAdd travis button on README.","tree":{"sha":"33b533e02e45deccc832bc39813710764fb2a9d4","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/33b533e02e45deccc832bc39813710764fb2a9d4"},"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","comment_count":0},"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","html_url":"https://github.com/jacquev6/PyGithub/commit/a39c1e8b9ab601419277eefb4fbb586ded0af146","comments_url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146/comments","author":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"committer":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"parents":[{"sha":"45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","html_url":"https://github.com/jacquev6/PyGithub/commit/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5"},{"sha":"a83649b68f1bb978c254f4cf1efcae88dc2608d7","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a83649b68f1bb978c254f4cf1efcae88dc2608d7","html_url":"https://github.com/jacquev6/PyGithub/commit/a83649b68f1bb978c254f4cf1efcae88dc2608d7"}]},"_links":{"self":"https://api.github.com/repos/jacquev6/PyGithub/branches/master","html":"https://github.com/jacquev6/PyGithub/tree/master"},"protection":{"enabled":true,"required_status_checks":{"enforcement_level":"everyone","contexts":["test"]}}} - -https -GET -api.github.com -None -/repos/jacquev6/PyGithub/branches/master -{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} -None -200 -[('content-length', '3599'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', 'bae57931a6fe678a3dffe9be8e7819c8'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('etag', '"23247e636875225f1e2d6b49e3ed8fb5"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4982'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '417D879D:1D262:27FA573A:568D31F4'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Wed, 06 Jan 2016 15:25:40 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1452096288')] -{"name":"master","commit":{"sha":"a39c1e8b9ab601419277eefb4fbb586ded0af146","commit":{"author":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"committer":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"message":"Merge pull request #365 from PyGithub/nhomar-travis-button\n\nAdd travis button on README.","tree":{"sha":"33b533e02e45deccc832bc39813710764fb2a9d4","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/33b533e02e45deccc832bc39813710764fb2a9d4"},"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","comment_count":0},"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","html_url":"https://github.com/jacquev6/PyGithub/commit/a39c1e8b9ab601419277eefb4fbb586ded0af146","comments_url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146/comments","author":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"committer":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"parents":[{"sha":"45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","html_url":"https://github.com/jacquev6/PyGithub/commit/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5"},{"sha":"a83649b68f1bb978c254f4cf1efcae88dc2608d7","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a83649b68f1bb978c254f4cf1efcae88dc2608d7","html_url":"https://github.com/jacquev6/PyGithub/commit/a83649b68f1bb978c254f4cf1efcae88dc2608d7"}]},"_links":{"self":"https://api.github.com/repos/jacquev6/PyGithub/branches/master","html":"https://github.com/jacquev6/PyGithub/tree/master"},"protection":{"enabled":true,"required_status_checks":{"enforcement_level":"everyone","contexts":["test"]}}} - -https -PATCH -api.github.com -None -/repos/jacquev6/PyGithub/branches/master -{'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} -{"protection": {"enabled": true, "required_status_checks": {"enforcement_level": "everyone", "contexts": ["test", "default"]}}} -200 -[('content-length', '3609'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', '318e55760cf7cdb40e61175a4d36cd32'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('etag', '"db7b04fd5e1b51731388d165caa9c4aa"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4981'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '417D879D:1D262:27FA5773:568D31F4'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Wed, 06 Jan 2016 15:25:41 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1452096288')] -{"name":"master","commit":{"sha":"a39c1e8b9ab601419277eefb4fbb586ded0af146","commit":{"author":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"committer":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"message":"Merge pull request #365 from PyGithub/nhomar-travis-button\n\nAdd travis button on README.","tree":{"sha":"33b533e02e45deccc832bc39813710764fb2a9d4","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/33b533e02e45deccc832bc39813710764fb2a9d4"},"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","comment_count":0},"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","html_url":"https://github.com/jacquev6/PyGithub/commit/a39c1e8b9ab601419277eefb4fbb586ded0af146","comments_url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146/comments","author":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"committer":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"parents":[{"sha":"45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","html_url":"https://github.com/jacquev6/PyGithub/commit/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5"},{"sha":"a83649b68f1bb978c254f4cf1efcae88dc2608d7","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a83649b68f1bb978c254f4cf1efcae88dc2608d7","html_url":"https://github.com/jacquev6/PyGithub/commit/a83649b68f1bb978c254f4cf1efcae88dc2608d7"}]},"_links":{"self":"https://api.github.com/repos/jacquev6/PyGithub/branches/master","html":"https://github.com/jacquev6/PyGithub/tree/master"},"protection":{"enabled":true,"required_status_checks":{"enforcement_level":"everyone","contexts":["default","test"]}}} - -https -GET -api.github.com -None -/repos/jacquev6/PyGithub/branches/master -{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} -None -200 -[('content-length', '3609'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', 'a241e1a8264a6ace03db946c85b92db3'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('etag', '"db7b04fd5e1b51731388d165caa9c4aa"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4980'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '417D879D:1D260:22667B15:568D31F5'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Wed, 06 Jan 2016 15:25:41 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1452096288')] -{"name":"master","commit":{"sha":"a39c1e8b9ab601419277eefb4fbb586ded0af146","commit":{"author":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"committer":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"message":"Merge pull request #365 from PyGithub/nhomar-travis-button\n\nAdd travis button on README.","tree":{"sha":"33b533e02e45deccc832bc39813710764fb2a9d4","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/33b533e02e45deccc832bc39813710764fb2a9d4"},"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","comment_count":0},"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","html_url":"https://github.com/jacquev6/PyGithub/commit/a39c1e8b9ab601419277eefb4fbb586ded0af146","comments_url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146/comments","author":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"committer":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"parents":[{"sha":"45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","html_url":"https://github.com/jacquev6/PyGithub/commit/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5"},{"sha":"a83649b68f1bb978c254f4cf1efcae88dc2608d7","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a83649b68f1bb978c254f4cf1efcae88dc2608d7","html_url":"https://github.com/jacquev6/PyGithub/commit/a83649b68f1bb978c254f4cf1efcae88dc2608d7"}]},"_links":{"self":"https://api.github.com/repos/jacquev6/PyGithub/branches/master","html":"https://github.com/jacquev6/PyGithub/tree/master"},"protection":{"enabled":true,"required_status_checks":{"enforcement_level":"everyone","contexts":["default","test"]}}} - -https -PATCH -api.github.com -None -/repos/jacquev6/PyGithub/branches/master -{'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} -{"protection": {"enabled": true, "required_status_checks": {"enforcement_level": "everyone", "contexts": ["default"]}}} -200 -[('content-length', '3602'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', '593010132f82159af0ded24b4932e109'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('etag', '"9ec429649fdda2858153edc42ff3f579"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4979'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '417D879D:1D25F:1A8AB79A:568D31F5'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Wed, 06 Jan 2016 15:25:41 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1452096288')] -{"name":"master","commit":{"sha":"a39c1e8b9ab601419277eefb4fbb586ded0af146","commit":{"author":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"committer":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"message":"Merge pull request #365 from PyGithub/nhomar-travis-button\n\nAdd travis button on README.","tree":{"sha":"33b533e02e45deccc832bc39813710764fb2a9d4","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/33b533e02e45deccc832bc39813710764fb2a9d4"},"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","comment_count":0},"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","html_url":"https://github.com/jacquev6/PyGithub/commit/a39c1e8b9ab601419277eefb4fbb586ded0af146","comments_url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146/comments","author":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"committer":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"parents":[{"sha":"45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","html_url":"https://github.com/jacquev6/PyGithub/commit/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5"},{"sha":"a83649b68f1bb978c254f4cf1efcae88dc2608d7","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a83649b68f1bb978c254f4cf1efcae88dc2608d7","html_url":"https://github.com/jacquev6/PyGithub/commit/a83649b68f1bb978c254f4cf1efcae88dc2608d7"}]},"_links":{"self":"https://api.github.com/repos/jacquev6/PyGithub/branches/master","html":"https://github.com/jacquev6/PyGithub/tree/master"},"protection":{"enabled":true,"required_status_checks":{"enforcement_level":"everyone","contexts":["default"]}}} - -https -GET -api.github.com -None -/repos/jacquev6/PyGithub/branches/master -{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} -None -200 -[('content-length', '3602'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', 'ef96c2e493b28ffea49b891b085ed2dd'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('etag', '"9ec429649fdda2858153edc42ff3f579"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4978'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '417D879D:1D262:27FA5800:568D31F5'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Wed, 06 Jan 2016 15:25:41 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1452096288')] -{"name":"master","commit":{"sha":"a39c1e8b9ab601419277eefb4fbb586ded0af146","commit":{"author":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"committer":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"message":"Merge pull request #365 from PyGithub/nhomar-travis-button\n\nAdd travis button on README.","tree":{"sha":"33b533e02e45deccc832bc39813710764fb2a9d4","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/33b533e02e45deccc832bc39813710764fb2a9d4"},"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","comment_count":0},"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","html_url":"https://github.com/jacquev6/PyGithub/commit/a39c1e8b9ab601419277eefb4fbb586ded0af146","comments_url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146/comments","author":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"committer":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"parents":[{"sha":"45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","html_url":"https://github.com/jacquev6/PyGithub/commit/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5"},{"sha":"a83649b68f1bb978c254f4cf1efcae88dc2608d7","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a83649b68f1bb978c254f4cf1efcae88dc2608d7","html_url":"https://github.com/jacquev6/PyGithub/commit/a83649b68f1bb978c254f4cf1efcae88dc2608d7"}]},"_links":{"self":"https://api.github.com/repos/jacquev6/PyGithub/branches/master","html":"https://github.com/jacquev6/PyGithub/tree/master"},"protection":{"enabled":true,"required_status_checks":{"enforcement_level":"everyone","contexts":["default"]}}} - diff --git a/github/tests/ReplayData/Repository.testChangeBranchProtectionEnforcementLevel.txt b/github/tests/ReplayData/Repository.testChangeBranchProtectionEnforcementLevel.txt deleted file mode 100644 index f615aec2..00000000 --- a/github/tests/ReplayData/Repository.testChangeBranchProtectionEnforcementLevel.txt +++ /dev/null @@ -1,44 +0,0 @@ -https -PATCH -api.github.com -None -/repos/jacquev6/PyGithub/branches/master -{'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} -{"protection": {"enabled": true, "required_status_checks": {"enforcement_level": "everyone", "contexts": ["test"]}}} -200 -[('content-length', '3599'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', 'dc1ce2bfb41810a06c705e83b388572d'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('etag', '"23247e636875225f1e2d6b49e3ed8fb5"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4950'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '417D879D:1D25F:1A90BAC8:568D38A5'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Wed, 06 Jan 2016 15:54:13 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1452096288')] -{"name":"master","commit":{"sha":"a39c1e8b9ab601419277eefb4fbb586ded0af146","commit":{"author":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"committer":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"message":"Merge pull request #365 from PyGithub/nhomar-travis-button\n\nAdd travis button on README.","tree":{"sha":"33b533e02e45deccc832bc39813710764fb2a9d4","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/33b533e02e45deccc832bc39813710764fb2a9d4"},"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","comment_count":0},"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","html_url":"https://github.com/jacquev6/PyGithub/commit/a39c1e8b9ab601419277eefb4fbb586ded0af146","comments_url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146/comments","author":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"committer":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"parents":[{"sha":"45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","html_url":"https://github.com/jacquev6/PyGithub/commit/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5"},{"sha":"a83649b68f1bb978c254f4cf1efcae88dc2608d7","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a83649b68f1bb978c254f4cf1efcae88dc2608d7","html_url":"https://github.com/jacquev6/PyGithub/commit/a83649b68f1bb978c254f4cf1efcae88dc2608d7"}]},"_links":{"self":"https://api.github.com/repos/jacquev6/PyGithub/branches/master","html":"https://github.com/jacquev6/PyGithub/tree/master"},"protection":{"enabled":true,"required_status_checks":{"enforcement_level":"everyone","contexts":["test"]}}} - -https -GET -api.github.com -None -/repos/jacquev6/PyGithub/branches/master -{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} -None -200 -[('content-length', '3599'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', '2c18a09f3ac5e4dd1e004af7c5a94769'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('etag', '"23247e636875225f1e2d6b49e3ed8fb5"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4949'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '417D879D:1D261:29009CF7:568D38A5'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Wed, 06 Jan 2016 15:54:13 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1452096288')] -{"name":"master","commit":{"sha":"a39c1e8b9ab601419277eefb4fbb586ded0af146","commit":{"author":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"committer":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"message":"Merge pull request #365 from PyGithub/nhomar-travis-button\n\nAdd travis button on README.","tree":{"sha":"33b533e02e45deccc832bc39813710764fb2a9d4","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/33b533e02e45deccc832bc39813710764fb2a9d4"},"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","comment_count":0},"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","html_url":"https://github.com/jacquev6/PyGithub/commit/a39c1e8b9ab601419277eefb4fbb586ded0af146","comments_url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146/comments","author":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"committer":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"parents":[{"sha":"45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","html_url":"https://github.com/jacquev6/PyGithub/commit/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5"},{"sha":"a83649b68f1bb978c254f4cf1efcae88dc2608d7","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a83649b68f1bb978c254f4cf1efcae88dc2608d7","html_url":"https://github.com/jacquev6/PyGithub/commit/a83649b68f1bb978c254f4cf1efcae88dc2608d7"}]},"_links":{"self":"https://api.github.com/repos/jacquev6/PyGithub/branches/master","html":"https://github.com/jacquev6/PyGithub/tree/master"},"protection":{"enabled":true,"required_status_checks":{"enforcement_level":"everyone","contexts":["test"]}}} - -https -PATCH -api.github.com -None -/repos/jacquev6/PyGithub/branches/master -{'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} -{"protection": {"enabled": true, "required_status_checks": {"enforcement_level": "non_admins", "contexts": ["test"]}}} -200 -[('content-length', '3601'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', '52437fedc85beec8da3449496900fb9a'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('etag', '"33854f0fd77af9f49acf152bf0715de3"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4948'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '417D879D:1D25F:1A90BB33:568D38A5'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Wed, 06 Jan 2016 15:54:14 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1452096288')] -{"name":"master","commit":{"sha":"a39c1e8b9ab601419277eefb4fbb586ded0af146","commit":{"author":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"committer":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"message":"Merge pull request #365 from PyGithub/nhomar-travis-button\n\nAdd travis button on README.","tree":{"sha":"33b533e02e45deccc832bc39813710764fb2a9d4","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/33b533e02e45deccc832bc39813710764fb2a9d4"},"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","comment_count":0},"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","html_url":"https://github.com/jacquev6/PyGithub/commit/a39c1e8b9ab601419277eefb4fbb586ded0af146","comments_url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146/comments","author":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"committer":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"parents":[{"sha":"45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","html_url":"https://github.com/jacquev6/PyGithub/commit/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5"},{"sha":"a83649b68f1bb978c254f4cf1efcae88dc2608d7","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a83649b68f1bb978c254f4cf1efcae88dc2608d7","html_url":"https://github.com/jacquev6/PyGithub/commit/a83649b68f1bb978c254f4cf1efcae88dc2608d7"}]},"_links":{"self":"https://api.github.com/repos/jacquev6/PyGithub/branches/master","html":"https://github.com/jacquev6/PyGithub/tree/master"},"protection":{"enabled":true,"required_status_checks":{"enforcement_level":"non_admins","contexts":["test"]}}} - -https -GET -api.github.com -None -/repos/jacquev6/PyGithub/branches/master -{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} -None -200 -[('content-length', '3601'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', '13d09b732ebe76f892093130dc088652'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('etag', '"33854f0fd77af9f49acf152bf0715de3"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4947'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '417D879D:1D260:226E126E:568D38A7'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Wed, 06 Jan 2016 15:54:15 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1452096288')] -{"name":"master","commit":{"sha":"a39c1e8b9ab601419277eefb4fbb586ded0af146","commit":{"author":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"committer":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"message":"Merge pull request #365 from PyGithub/nhomar-travis-button\n\nAdd travis button on README.","tree":{"sha":"33b533e02e45deccc832bc39813710764fb2a9d4","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/33b533e02e45deccc832bc39813710764fb2a9d4"},"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","comment_count":0},"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","html_url":"https://github.com/jacquev6/PyGithub/commit/a39c1e8b9ab601419277eefb4fbb586ded0af146","comments_url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146/comments","author":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"committer":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"parents":[{"sha":"45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","html_url":"https://github.com/jacquev6/PyGithub/commit/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5"},{"sha":"a83649b68f1bb978c254f4cf1efcae88dc2608d7","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a83649b68f1bb978c254f4cf1efcae88dc2608d7","html_url":"https://github.com/jacquev6/PyGithub/commit/a83649b68f1bb978c254f4cf1efcae88dc2608d7"}]},"_links":{"self":"https://api.github.com/repos/jacquev6/PyGithub/branches/master","html":"https://github.com/jacquev6/PyGithub/tree/master"},"protection":{"enabled":true,"required_status_checks":{"enforcement_level":"non_admins","contexts":["test"]}}} - diff --git a/github/tests/ReplayData/Repository.testProtectBranch.txt b/github/tests/ReplayData/Repository.testProtectBranch.txt deleted file mode 100644 index 2c8deb4e..00000000 --- a/github/tests/ReplayData/Repository.testProtectBranch.txt +++ /dev/null @@ -1,22 +0,0 @@ -https -PATCH -api.github.com -None -/repos/jacquev6/PyGithub/branches/master -{'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} -{"protection": {"enabled": true, "required_status_checks": {"enforcement_level": "everyone", "contexts": ["test"]}}} -200 -[('content-length', '3599'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', '13d09b732ebe76f892093130dc088652'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('etag', '"23247e636875225f1e2d6b49e3ed8fb5"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4997'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '417D879D:14B62:29334564:568D2D11'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Wed, 06 Jan 2016 15:04:49 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1452096288')] -{"name":"master","commit":{"sha":"a39c1e8b9ab601419277eefb4fbb586ded0af146","commit":{"author":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"committer":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"message":"Merge pull request #365 from PyGithub/nhomar-travis-button\n\nAdd travis button on README.","tree":{"sha":"33b533e02e45deccc832bc39813710764fb2a9d4","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/33b533e02e45deccc832bc39813710764fb2a9d4"},"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","comment_count":0},"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","html_url":"https://github.com/jacquev6/PyGithub/commit/a39c1e8b9ab601419277eefb4fbb586ded0af146","comments_url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146/comments","author":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"committer":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"parents":[{"sha":"45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","html_url":"https://github.com/jacquev6/PyGithub/commit/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5"},{"sha":"a83649b68f1bb978c254f4cf1efcae88dc2608d7","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a83649b68f1bb978c254f4cf1efcae88dc2608d7","html_url":"https://github.com/jacquev6/PyGithub/commit/a83649b68f1bb978c254f4cf1efcae88dc2608d7"}]},"_links":{"self":"https://api.github.com/repos/jacquev6/PyGithub/branches/master","html":"https://github.com/jacquev6/PyGithub/tree/master"},"protection":{"enabled":true,"required_status_checks":{"enforcement_level":"everyone","contexts":["test"]}}} - -https -GET -api.github.com -None -/repos/jacquev6/PyGithub/branches/master -{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} -None -200 -[('content-length', '3599'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', 'a474937f3b2fa272558fa6dc951018ad'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('etag', '"23247e636875225f1e2d6b49e3ed8fb5"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4996'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '417D879D:14B62:293345B4:568D2D11'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Wed, 06 Jan 2016 15:04:49 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1452096288')] -{"name":"master","commit":{"sha":"a39c1e8b9ab601419277eefb4fbb586ded0af146","commit":{"author":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"committer":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"message":"Merge pull request #365 from PyGithub/nhomar-travis-button\n\nAdd travis button on README.","tree":{"sha":"33b533e02e45deccc832bc39813710764fb2a9d4","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/33b533e02e45deccc832bc39813710764fb2a9d4"},"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","comment_count":0},"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","html_url":"https://github.com/jacquev6/PyGithub/commit/a39c1e8b9ab601419277eefb4fbb586ded0af146","comments_url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146/comments","author":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"committer":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"parents":[{"sha":"45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","html_url":"https://github.com/jacquev6/PyGithub/commit/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5"},{"sha":"a83649b68f1bb978c254f4cf1efcae88dc2608d7","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a83649b68f1bb978c254f4cf1efcae88dc2608d7","html_url":"https://github.com/jacquev6/PyGithub/commit/a83649b68f1bb978c254f4cf1efcae88dc2608d7"}]},"_links":{"self":"https://api.github.com/repos/jacquev6/PyGithub/branches/master","html":"https://github.com/jacquev6/PyGithub/tree/master"},"protection":{"enabled":true,"required_status_checks":{"enforcement_level":"everyone","contexts":["test"]}}} - diff --git a/github/tests/ReplayData/Repository.testRaiseErrorWithBranchProtectionWithInvalidEnforcementLevel.txt b/github/tests/ReplayData/Repository.testRaiseErrorWithBranchProtectionWithInvalidEnforcementLevel.txt deleted file mode 100644 index 2e2898aa..00000000 --- a/github/tests/ReplayData/Repository.testRaiseErrorWithBranchProtectionWithInvalidEnforcementLevel.txt +++ /dev/null @@ -1,11 +0,0 @@ -https -PATCH -api.github.com -None -/repos/jacquev6/PyGithub/branches/master -{'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} -{"protection": {"enabled": true, "required_status_checks": {"enforcement_level": "", "contexts": ["test"]}}} -422 -[('status', '422 Unprocessable Entity'), ('content-length', '331'), ('x-content-type-options', 'nosniff'), ('content-security-policy', "default-src 'none'"), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', 'AE1E5031:134EF:B336C18:568E6F16'), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('x-ratelimit-remaining', '4958'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-xss-protection', '1; mode=block'), ('access-control-allow-credentials', 'true'), ('date', 'Thu, 07 Jan 2016 13:58:47 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-frame-options', 'deny'), ('x-ratelimit-reset', '1452177625')] -{"message":"Validation Failed","errors":[{"resource":"ProtectedBranch","code":"custom","field":"required_status_checks_enforcement_level","message":"required_status_checks_enforcement_level enforcement level '%s' is not valid"}],"documentation_url":"https://developer.github.com/v3/repos/#enabling-and-disabling-branch-protection"} - diff --git a/github/tests/ReplayData/Repository.testRaiseErrorWithBranchProtectionWithOutContext.txt b/github/tests/ReplayData/Repository.testRaiseErrorWithBranchProtectionWithOutContext.txt deleted file mode 100644 index c2f5aefe..00000000 --- a/github/tests/ReplayData/Repository.testRaiseErrorWithBranchProtectionWithOutContext.txt +++ /dev/null @@ -1,11 +0,0 @@ -https -PATCH -api.github.com -None -/repos/jacquev6/PyGithub/branches/master -{'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} -{"protection": {"enabled": true, "required_status_checks": {"enforcement_level": "everyone"}}} -422 -[('status', '422 Unprocessable Entity'), ('content-length', '117'), ('x-content-type-options', 'nosniff'), ('content-security-policy', "default-src 'none'"), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', 'AE1E5031:1D259:685F04B:568E6DC2'), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('x-ratelimit-remaining', '4969'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-xss-protection', '1; mode=block'), ('access-control-allow-credentials', 'true'), ('date', 'Thu, 07 Jan 2016 13:53:06 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-frame-options', 'deny'), ('x-ratelimit-reset', '1452177625')] -{"message":"Invalid request.\n\n\"contexts\" wasn't supplied.","documentation_url":"https://developer.github.com/v3"} - diff --git a/github/tests/ReplayData/Repository.testRaiseErrorWithOutBranch.txt b/github/tests/ReplayData/Repository.testRaiseErrorWithOutBranch.txt deleted file mode 100644 index 99b3f0bb..00000000 --- a/github/tests/ReplayData/Repository.testRaiseErrorWithOutBranch.txt +++ /dev/null @@ -1,11 +0,0 @@ -https -PATCH -api.github.com -None -/repos/jacquev6/PyGithub/branches/ -{'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} -{"protection": {"enabled": true, "required_status_checks": {"enforcement_level": "everyone", "contexts": ["test"]}}} -404 -[('status', '404 Not Found'), ('content-length', '102'), ('x-content-type-options', 'nosniff'), ('content-security-policy', "default-src 'none'"), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', 'AE1E5031:A39B:2D392574:568E6BC1'), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('x-ratelimit-remaining', '4991'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-xss-protection', '1; mode=block'), ('access-control-allow-credentials', 'true'), ('date', 'Thu, 07 Jan 2016 13:44:34 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-frame-options', 'deny'), ('x-ratelimit-reset', '1452177625')] -{"message":"Branch not found","documentation_url":"https://developer.github.com/v3/repos/#get-branch"} - diff --git a/github/tests/ReplayData/Repository.testRemoveBranchProtection.txt b/github/tests/ReplayData/Repository.testRemoveBranchProtection.txt deleted file mode 100644 index 01b380e3..00000000 --- a/github/tests/ReplayData/Repository.testRemoveBranchProtection.txt +++ /dev/null @@ -1,22 +0,0 @@ -https -PATCH -api.github.com -None -/repos/jacquev6/PyGithub/branches/master -{'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} -{"protection": {"enabled": false}} -200 -[('content-length', '3589'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', 'a7f8a126c9ed3f1c4715a34c0ddc7290'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('etag', '"62bfcfb47e26986d4c1a6db0bcf43cb6"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4993'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '417D879D:14B5A:E23F8D0:568D3163'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Wed, 06 Jan 2016 15:23:15 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1452096288')] -{"name":"master","commit":{"sha":"a39c1e8b9ab601419277eefb4fbb586ded0af146","commit":{"author":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"committer":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"message":"Merge pull request #365 from PyGithub/nhomar-travis-button\n\nAdd travis button on README.","tree":{"sha":"33b533e02e45deccc832bc39813710764fb2a9d4","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/33b533e02e45deccc832bc39813710764fb2a9d4"},"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","comment_count":0},"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","html_url":"https://github.com/jacquev6/PyGithub/commit/a39c1e8b9ab601419277eefb4fbb586ded0af146","comments_url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146/comments","author":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"committer":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"parents":[{"sha":"45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","html_url":"https://github.com/jacquev6/PyGithub/commit/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5"},{"sha":"a83649b68f1bb978c254f4cf1efcae88dc2608d7","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a83649b68f1bb978c254f4cf1efcae88dc2608d7","html_url":"https://github.com/jacquev6/PyGithub/commit/a83649b68f1bb978c254f4cf1efcae88dc2608d7"}]},"_links":{"self":"https://api.github.com/repos/jacquev6/PyGithub/branches/master","html":"https://github.com/jacquev6/PyGithub/tree/master"},"protection":{"enabled":false,"required_status_checks":{"enforcement_level":"off","contexts":[]}}} - -https -GET -api.github.com -None -/repos/jacquev6/PyGithub/branches/master -{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} -None -200 -[('content-length', '3589'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', 'c6c65e5196703428e7641f7d1e9bc353'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('etag', '"62bfcfb47e26986d4c1a6db0bcf43cb6"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4992'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '417D879D:14B61:22B7F0CB:568D3164'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Wed, 06 Jan 2016 15:23:16 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1452096288')] -{"name":"master","commit":{"sha":"a39c1e8b9ab601419277eefb4fbb586ded0af146","commit":{"author":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"committer":{"name":"Jimmy Zelinskie","email":"jimmyzelinskie@gmail.com","date":"2015-12-16T06:29:19Z"},"message":"Merge pull request #365 from PyGithub/nhomar-travis-button\n\nAdd travis button on README.","tree":{"sha":"33b533e02e45deccc832bc39813710764fb2a9d4","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/33b533e02e45deccc832bc39813710764fb2a9d4"},"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","comment_count":0},"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146","html_url":"https://github.com/jacquev6/PyGithub/commit/a39c1e8b9ab601419277eefb4fbb586ded0af146","comments_url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a39c1e8b9ab601419277eefb4fbb586ded0af146/comments","author":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"committer":{"login":"jzelinskie","id":343539,"avatar_url":"https://avatars.githubusercontent.com/u/343539?v=3","gravatar_id":"","url":"https://api.github.com/users/jzelinskie","html_url":"https://github.com/jzelinskie","followers_url":"https://api.github.com/users/jzelinskie/followers","following_url":"https://api.github.com/users/jzelinskie/following{/other_user}","gists_url":"https://api.github.com/users/jzelinskie/gists{/gist_id}","starred_url":"https://api.github.com/users/jzelinskie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzelinskie/subscriptions","organizations_url":"https://api.github.com/users/jzelinskie/orgs","repos_url":"https://api.github.com/users/jzelinskie/repos","events_url":"https://api.github.com/users/jzelinskie/events{/privacy}","received_events_url":"https://api.github.com/users/jzelinskie/received_events","type":"User","site_admin":false},"parents":[{"sha":"45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5","html_url":"https://github.com/jacquev6/PyGithub/commit/45c7f072e4732f89a9e756a27a4306f2f6dbd9c5"},{"sha":"a83649b68f1bb978c254f4cf1efcae88dc2608d7","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a83649b68f1bb978c254f4cf1efcae88dc2608d7","html_url":"https://github.com/jacquev6/PyGithub/commit/a83649b68f1bb978c254f4cf1efcae88dc2608d7"}]},"_links":{"self":"https://api.github.com/repos/jacquev6/PyGithub/branches/master","html":"https://github.com/jacquev6/PyGithub/tree/master"},"protection":{"enabled":false,"required_status_checks":{"enforcement_level":"off","contexts":[]}}} - diff --git a/github/tests/ReplayData/RequiredPullRequestReviews.setUp.txt b/github/tests/ReplayData/RequiredPullRequestReviews.setUp.txt new file mode 100644 index 00000000..533d3551 --- /dev/null +++ b/github/tests/ReplayData/RequiredPullRequestReviews.setUp.txt @@ -0,0 +1,44 @@ +https +GET +api.github.com +None +/user +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4967'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"27524c635501121933f4f78c95b1945a"'), ('date', 'Fri, 18 May 2012 20:12:19 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"owned_private_repos":5,"collaborators":0,"type":"User","hireable":false,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","public_gists":1,"company":"Criteo","bio":"","url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","private_gists":5,"plan":{"collaborators":1,"private_repos":5,"name":"micro","space":614400},"public_repos":11,"followers":13,"login":"jacquev6","blog":"http://vincent-jacques.net","email":"vincent@vincent-jacques.net","disk_usage":16852,"html_url":"https://github.com/jacquev6","name":"Vincent Jacques","total_private_repos":5,"created_at":"2010-07-09T06:10:06Z","location":"Paris, France","id":327146,"following":24} + +https +GET +api.github.com +None +/repos/jacquev6/PyGithub +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4966'), ('content-length', '1097'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"c5eec74d4b76b80283636a8efe1a132c"'), ('date', 'Fri, 18 May 2012 20:12:20 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"svn_url":"https://github.com/jacquev6/PyGithub","has_wiki":false,"has_issues":true,"updated_at":"2012-05-18T05:29:54Z","forks":2,"homepage":"http://vincent-jacques.net/PyGithub","git_url":"git://github.com/jacquev6/PyGithub.git","url":"https://api.github.com/repos/jacquev6/PyGithub","clone_url":"https://github.com/jacquev6/PyGithub.git","open_issues":17,"fork":false,"ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-18T05:18:16Z","size":304,"private":false,"has_downloads":true,"watchers":13,"html_url":"https://github.com/jacquev6/PyGithub","owner":{"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"name":"PyGithub","permissions":{"pull":true,"admin":true,"push":true},"mirror_url":null,"language":"Python","description":"Python library implementing the full Github API v3","created_at":"2012-02-25T12:53:47Z","id":3544490} + +https +GET +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '330'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"2dada6dafd332016bcdf06e42487e520"'), ('date', 'Thu, 10 May 2012 13:56:55 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"name":"integrations","commit":{"sha":"d60943db8c9ae6ca1f9400d378a757e6f281dbde","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/d60943db8c9ae6ca1f9400d378a757e6f281dbde"},"protected":true,"protection":{"enabled":true,"required_status_checks":{"strict":true,"contexts":["foo/bar"]}},"protection_url":"https://api.github.com/repos/jacquev6/PyGithub/branches/integrations/protection"} + +https +GET +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations/protection/required_pull_request_reviews +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('status', '200 OK'), ('x-runtime-rack', '0.049518'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-oauth-scopes', 'public_repo, repo:status'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('x-accepted-oauth-scopes', ''), ('etag', 'W/"f972722557f6bbc814f109abae4df24e"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('referrer-policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('x-ratelimit-remaining', '4996'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('transfer-encoding', 'chunked'), ('x-github-request-id', 'C9A0:2DCE:4A1B5C:60E4A6:5AF302A0'), ('date', 'Wed, 09 May 2018 14:16:17 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('content-encoding', 'gzip'), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1525878932')] +{"url":"https://api.github.com/repos/jacquev6/PyGithub/branches/integrations/protection/required_pull_request_reviews","dismiss_stale_reviews":true,"require_code_owner_reviews":true} + diff --git a/github/tests/ReplayData/RequiredPullRequestReviews.testOrganizationOwnedTeam.txt b/github/tests/ReplayData/RequiredPullRequestReviews.testOrganizationOwnedTeam.txt new file mode 100644 index 00000000..c4c2a88a --- /dev/null +++ b/github/tests/ReplayData/RequiredPullRequestReviews.testOrganizationOwnedTeam.txt @@ -0,0 +1,21 @@ +https +GET +api.github.com +None +/repos/PyGithub/PyGithub/branches/integrations +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '330'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"2dada6dafd332016bcdf06e42487e520"'), ('date', 'Thu, 10 May 2012 13:56:55 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"name":"integrations","commit":{"sha":"d60943db8c9ae6ca1f9400d378a757e6f281dbde","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/d60943db8c9ae6ca1f9400d378a757e6f281dbde"},"protected":true,"protection":{"enabled":true,"required_status_checks":{"strict":true,"contexts":["foo/bar"]}},"protection_url":"https://api.github.com/repos/PyGithub/PyGithub/branches/integrations/protection"} + +https +GET +api.github.com +None +/repos/PyGithub/PyGithub/branches/integrations/protection/required_pull_request_reviews +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('status', '200 OK'), ('x-runtime-rack', '0.049518'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-oauth-scopes', 'public_repo, repo:status'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('x-accepted-oauth-scopes', ''), ('etag', 'W/"f972722557f6bbc814f109abae4df24e"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('referrer-policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('x-ratelimit-remaining', '4996'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('transfer-encoding', 'chunked'), ('x-github-request-id', 'C9A0:2DCE:4A1B5C:60E4A6:5AF302A0'), ('date', 'Wed, 09 May 2018 14:16:17 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('content-encoding', 'gzip'), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1525878932')] +{"url":"https://api.github.com/repos/PyGithub/PyGithub/branches/integrations/protection/required_pull_request_reviews","dismiss_stale_reviews":true,"require_code_owner_reviews":true,"dismissal_restrictions":{"url":"https://api.github.com/repos/PyGithub/PyGithub/branches/integrations/protection/dismissal_restrictions","users_url":"https://api.github.com/repos/PyGithub/PyGithub/branches/integrations/protection/dismissal_restrictions/users","teams_url":"https://api.github.com/repos/PyGithub/PyGithub/branches/integrations/protection/dismissal_restrictions/teams","users":[{"owned_private_repos":5,"collaborators":0,"type":"User","hireable":false,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","public_gists":1,"company":"Criteo","bio":"","url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","private_gists":5,"plan":{"collaborators":1,"private_repos":5,"name":"micro","space":614400},"public_repos":11,"followers":13,"login":"jacquev6","blog":"http://vincent-jacques.net","email":"vincent@vincent-jacques.net","disk_usage":16852,"html_url":"https://github.com/jacquev6","name":"Vincent Jacques","total_private_repos":5,"created_at":"2010-07-09T06:10:06Z","location":"Paris, France","id":327146,"following":24}],"teams":[{"name":"pygithub-owners","id":585225,"slug":"pygithub-owners","description":"","privacy":"closed","url":"https://api.github.com/teams/585225","members_url":"https://api.github.com/teams/585225/members{/member}","repositories_url":"https://api.github.com/teams/585225/repos","permission":"pull"}]}} diff --git a/github/tests/ReplayData/RequiredStatusChecks.setUp.txt b/github/tests/ReplayData/RequiredStatusChecks.setUp.txt new file mode 100644 index 00000000..031dd229 --- /dev/null +++ b/github/tests/ReplayData/RequiredStatusChecks.setUp.txt @@ -0,0 +1,43 @@ +https +GET +api.github.com +None +/user +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4967'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"27524c635501121933f4f78c95b1945a"'), ('date', 'Fri, 18 May 2012 20:12:19 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"owned_private_repos":5,"collaborators":0,"type":"User","hireable":false,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","public_gists":1,"company":"Criteo","bio":"","url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","private_gists":5,"plan":{"collaborators":1,"private_repos":5,"name":"micro","space":614400},"public_repos":11,"followers":13,"login":"jacquev6","blog":"http://vincent-jacques.net","email":"vincent@vincent-jacques.net","disk_usage":16852,"html_url":"https://github.com/jacquev6","name":"Vincent Jacques","total_private_repos":5,"created_at":"2010-07-09T06:10:06Z","location":"Paris, France","id":327146,"following":24} + +https +GET +api.github.com +None +/repos/jacquev6/PyGithub +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4966'), ('content-length', '1097'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"c5eec74d4b76b80283636a8efe1a132c"'), ('date', 'Fri, 18 May 2012 20:12:20 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"svn_url":"https://github.com/jacquev6/PyGithub","has_wiki":false,"has_issues":true,"updated_at":"2012-05-18T05:29:54Z","forks":2,"homepage":"http://vincent-jacques.net/PyGithub","git_url":"git://github.com/jacquev6/PyGithub.git","url":"https://api.github.com/repos/jacquev6/PyGithub","clone_url":"https://github.com/jacquev6/PyGithub.git","open_issues":17,"fork":false,"ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-18T05:18:16Z","size":304,"private":false,"has_downloads":true,"watchers":13,"html_url":"https://github.com/jacquev6/PyGithub","owner":{"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"name":"PyGithub","permissions":{"pull":true,"admin":true,"push":true},"mirror_url":null,"language":"Python","description":"Python library implementing the full Github API v3","created_at":"2012-02-25T12:53:47Z","id":3544490} + +https +GET +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '330'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"2dada6dafd332016bcdf06e42487e520"'), ('date', 'Thu, 10 May 2012 13:56:55 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"name":"integrations","commit":{"sha":"d60943db8c9ae6ca1f9400d378a757e6f281dbde","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/d60943db8c9ae6ca1f9400d378a757e6f281dbde"},"protected":true,"protection":{"enabled":true,"required_status_checks":{"strict":true,"contexts":["foo/bar"]}},"protection_url":"https://api.github.com/repos/jacquev6/PyGithub/branches/integrations/protection"} + +https +GET +api.github.com +None +/repos/jacquev6/PyGithub/branches/integrations/protection/required_status_checks +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('status', '200 OK'), ('x-runtime-rack', '0.049518'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-oauth-scopes', 'public_repo, repo:status'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('x-accepted-oauth-scopes', ''), ('etag', 'W/"f972722557f6bbc814f109abae4df24e"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('referrer-policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('x-ratelimit-remaining', '4996'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('transfer-encoding', 'chunked'), ('x-github-request-id', 'C9A0:2DCE:4A1B5C:60E4A6:5AF302A0'), ('date', 'Wed, 09 May 2018 14:16:17 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('content-encoding', 'gzip'), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1525878932')] +{"url":"https://api.github.com/repos/jacquev6/PyGithub/branches/integrations/protection/required_status_checks","strict":true,"contexts":["foo/bar"],"contexts_url":"https://api.github.com/repos/jacquev6/PyGithub/branches/integrations/protection/required_status_checks/contexts"} diff --git a/github/tests/Repository.py b/github/tests/Repository.py index a2adf767..a1b5a988 100644 --- a/github/tests/Repository.py +++ b/github/tests/Repository.py @@ -91,96 +91,6 @@ class Repository(Framework.TestCase): # test __repr__() based on this attributes self.assertEqual(self.repo.__repr__(), 'Repository(full_name="jacquev6/PyGithub")') - def testProtectBranch(self): - self.repo.protect_branch("master", True, "everyone", ["test"]) - branch = self.repo.get_protected_branch("master") - self.assertTrue(branch.protected) - self.assertEqual(branch.enforcement_level, "everyone") - self.assertEqual(branch.contexts, ["test"]) - - def testRemoveBranchProtection(self): - self.repo.protect_branch("master", False) - branch = self.repo.get_protected_branch("master") - self.assertFalse(branch.protected) - self.assertEqual(branch.enforcement_level, "off") - self.assertEqual(branch.contexts, []) - - def testChangeBranchProtectionContexts(self): - self.repo.protect_branch("master", True, "everyone", ["test"]) - branch = self.repo.get_protected_branch("master") - self.assertTrue(branch.protected) - self.assertEqual(branch.enforcement_level, "everyone") - self.assertEqual(branch.contexts, ["test"]) - self.repo.protect_branch("master", True, "everyone", ["test", "default"]) - branch = self.repo.get_protected_branch("master") - self.assertEqual(branch.contexts, ["default", "test"]) - self.repo.protect_branch("master", True, "everyone", ["default"]) - branch = self.repo.get_protected_branch("master") - self.assertEqual(branch.contexts, ["default"]) - - def testRaiseErrorWithOutBranch(self): - raised = False - try: - self.repo.protect_branch("", True, "everyone", ["test"]) - except github.GithubException, exception: - raised = True - self.assertEqual(exception.status, 404) - self.assertEqual( - exception.data, { - u'documentation_url': u'https://developer.github.com/v3/repos/#get-branch', - u'message': u'Branch not found' - } - ) - self.assertTrue(raised) - - def testRaiseErrorWithBranchProtectionWithOutContext(self): - raised = False - try: - self.repo.protect_branch("master", True, "everyone") - except github.GithubException, exception: - raised = True - self.assertEqual(exception.status, 422) - self.assertEqual( - exception.data, { - u'documentation_url': u'https://developer.github.com/v3', - u'message': u'Invalid request.\n\n"contexts" wasn\'t supplied.' - } - ) - self.assertTrue(raised) - - def testRaiseErrorWithBranchProtectionWithInvalidEnforcementLevel(self): - raised = False - try: - self.repo.protect_branch("master", True, "", ["test"]) - except github.GithubException, exception: - raised = True - self.assertEqual(exception.status, 422) - self.assertEqual( - exception.data, { - u'documentation_url': - u'https://developer.github.com/v3/repos/#enabling-and-disabling-branch-protection', - u'message': u'Validation Failed', - u'errors': [ - { - u'field': u'required_status_checks_enforcement_level', - u'message': u"required_status_checks_enforcement_level enforcement level '%s' is not valid", - u'code': u'custom', - u'resource': u'ProtectedBranch' - } - ] - } - ) - self.assertTrue(raised) - - def testChangeBranchProtectionEnforcementLevel(self): - self.repo.protect_branch("master", True, "everyone", ["test"]) - branch = self.repo.get_protected_branch("master") - self.assertTrue(branch.protected) - self.assertEqual(branch.enforcement_level, "everyone") - self.repo.protect_branch("master", True, "non_admins", ["test"]) - branch = self.repo.get_protected_branch("master") - self.assertEqual(branch.enforcement_level, "non_admins") - def testEditWithoutArguments(self): self.repo.edit("PyGithub") diff --git a/github/tests/RequiredPullRequestReviews.py b/github/tests/RequiredPullRequestReviews.py new file mode 100644 index 00000000..e8c95d6b --- /dev/null +++ b/github/tests/RequiredPullRequestReviews.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- + +############################ Copyrights and license ############################ +# # +# Copyright 2018 Steve Kowalik # +# # +# This file is part of PyGithub. # +# http://pygithub.readthedocs.io/ # +# # +# PyGithub is free software: you can redistribute it and/or modify it under # +# the terms of the GNU Lesser General Public License as published by the Free # +# Software Foundation, either version 3 of the License, or (at your option) # +# any later version. # +# # +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # +# details. # +# # +# You should have received a copy of the GNU Lesser General Public License # +# along with PyGithub. If not, see . # +# # +################################################################################ + +import Framework + +import github + + +class RequiredPullRequestReviews(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.required_pull_request_reviews = self.g.get_user().get_repo("PyGithub").get_branch("integrations").get_required_pull_request_reviews() + + def testAttributes(self): + self.assertTrue(self.required_pull_request_reviews.dismiss_stale_reviews) + self.assertTrue(self.required_pull_request_reviews.require_code_owner_reviews) + self.assertEqual(self.required_pull_request_reviews.url, "https://api.github.com/repos/jacquev6/PyGithub/branches/integrations/protection/required_pull_request_reviews") + self.assertIs(self.required_pull_request_reviews.dismissal_users, None) + self.assertIs(self.required_pull_request_reviews.dismissal_teams, None) + self.assertEqual(self.required_pull_request_reviews.__repr__(), 'RequiredPullRequestReviews(url="https://api.github.com/repos/jacquev6/PyGithub/branches/integrations/protection/required_pull_request_reviews", require_code_owner_reviews=True, dismiss_stale_reviews=True)') + + def testOrganizationOwnedTeam(self): + required_pull_request_reviews = self.g.get_repo("PyGithub/PyGithub").get_branch("integrations").get_required_pull_request_reviews() + self.assertListKeyEqual(required_pull_request_reviews.dismissal_users, lambda u: u.login, ["jacquev6"]) + self.assertListKeyEqual(required_pull_request_reviews.dismissal_teams, lambda t: t.slug, ["pygithub-owners"]) diff --git a/github/tests/RequiredStatusChecks.py b/github/tests/RequiredStatusChecks.py new file mode 100644 index 00000000..64e7aa9c --- /dev/null +++ b/github/tests/RequiredStatusChecks.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- + +############################ Copyrights and license ############################ +# # +# Copyright 2018 Steve Kowalik # +# # +# This file is part of PyGithub. # +# http://pygithub.readthedocs.io/ # +# # +# PyGithub is free software: you can redistribute it and/or modify it under # +# the terms of the GNU Lesser General Public License as published by the Free # +# Software Foundation, either version 3 of the License, or (at your option) # +# any later version. # +# # +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # +# details. # +# # +# You should have received a copy of the GNU Lesser General Public License # +# along with PyGithub. If not, see . # +# # +################################################################################ + +import Framework + +import github + + +class RequiredStatusChecks(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.required_status_checks = self.g.get_user().get_repo("PyGithub").get_branch("integrations").get_required_status_checks() + + def testAttributes(self): + self.assertTrue(self.required_status_checks.strict) + self.assertEqual(self.required_status_checks.contexts, ["foo/bar"]) + self.assertEqual(self.required_status_checks.url, "https://api.github.com/repos/jacquev6/PyGithub/branches/integrations/protection/required_status_checks") + self.assertEqual(self.required_status_checks.__repr__(), 'RequiredStatusChecks(url="https://api.github.com/repos/jacquev6/PyGithub/branches/integrations/protection/required_status_checks", strict=True)')