diff --git a/github/MainClass.py b/github/MainClass.py
index 579b1d83a6..5b626ad265 100644
--- a/github/MainClass.py
+++ b/github/MainClass.py
@@ -598,19 +598,15 @@ def search_commits(
"""
assert isinstance(query, str), query
url_parameters = dict()
- if (
- sort is not github.GithubObject.NotSet
- ): # pragma no branch (Should be covered)
+ if sort is not github.GithubObject.NotSet:
assert sort in ("author-date", "committer-date"), sort
url_parameters["sort"] = sort
- if (
- order is not github.GithubObject.NotSet
- ): # pragma no branch (Should be covered)
+ if order is not github.GithubObject.NotSet:
assert order in ("asc", "desc"), order
url_parameters["order"] = order
query_chunks = []
- if query: # pragma no branch (Should be covered)
+ if query:
query_chunks.append(query)
for qualifier, value in qualifiers.items():
diff --git a/github/PullRequestReview.py b/github/PullRequestReview.py
index 34eed25afd..bd70f68f2b 100644
--- a/github/PullRequestReview.py
+++ b/github/PullRequestReview.py
@@ -105,6 +105,15 @@ def dismiss(self, message):
input=post_parameters,
)
+ def delete(self):
+ """
+ :calls: `DELETE /repos/:owner/:repo/pulls/:number/reviews/:review_id `_
+ :rtype: None
+ """
+ headers, data = self._requester.requestJsonAndCheck(
+ "DELETE", f"{self.pull_request_url}/reviews/{self.id}"
+ )
+
def _initAttributes(self):
self._id = github.GithubObject.NotSet
self._user = github.GithubObject.NotSet
diff --git a/github/PullRequestReview.pyi b/github/PullRequestReview.pyi
index 269da086ce..e67bcc22ed 100644
--- a/github/PullRequestReview.pyi
+++ b/github/PullRequestReview.pyi
@@ -13,6 +13,7 @@ class PullRequestReview(CompletableGithubObject):
@property
def commit_id(self) -> str: ...
def dismiss(self, message: str) -> None: ...
+ def delete(self) -> None: ...
@property
def html_url(self) -> str: ...
@property
diff --git a/github/Repository.py b/github/Repository.py
index f1af79073e..1f7effa17f 100644
--- a/github/Repository.py
+++ b/github/Repository.py
@@ -1548,6 +1548,27 @@ def get_branch(self, branch):
)
return github.Branch.Branch(self._requester, headers, data, completed=True)
+ def rename_branch(self, branch, new_name):
+ """
+ :calls: `POST /repos/{owner}/{repo}/branches/{branch}/rename `
+ :param branch: :class:`github.Branch.Branch` or string
+ :param new_name: string
+ :rtype: bool
+
+ NOTE: This method does not return the branch since it may take some
+ time to fully complete server-side.
+ """
+ is_branch = isinstance(branch, github.Branch.Branch)
+ assert isinstance(branch, str) or is_branch, branch
+ assert isinstance(new_name, str), new_name
+ if is_branch:
+ branch = branch.name
+ parameters = {"new_name": new_name}
+ status, _, _ = self._requester.requestJson(
+ "POST", f"{self.url}/branches/{branch}/rename", input=parameters
+ )
+ return status == 201
+
def get_branches(self):
"""
:calls: `GET /repos/{owner}/{repo}/branches `_
diff --git a/github/Repository.pyi b/github/Repository.pyi
index fd876a363a..eb0dffdd14 100644
--- a/github/Repository.pyi
+++ b/github/Repository.pyi
@@ -307,6 +307,9 @@ class Repository(CompletableGithubObject):
) -> str: ...
def get_assignees(self) -> PaginatedList[NamedUser]: ...
def get_branch(self, branch: str) -> Branch: ...
+ def rename_branch(
+ self, branch: Union[str, Branch], new_name: str
+ ) -> bool: ...
def get_branches(self) -> PaginatedList[Branch]: ...
def get_check_run(self, check_run_id: int) -> CheckRun: ...
def get_check_suite(self, check_suite_id: int) -> CheckSuite: ...
diff --git a/tests/PullRequestReview.py b/tests/PullRequestReview.py
index a2e317cc46..2594c7d8ed 100644
--- a/tests/PullRequestReview.py
+++ b/tests/PullRequestReview.py
@@ -32,6 +32,7 @@
class PullRequestReview(Framework.TestCase):
def setUp(self):
super().setUp()
+
self.repo = self.g.get_repo("PyGithub/PyGithub", lazy=True)
self.pull = self.repo.get_pull(538)
diff --git a/tests/PullRequestReview1856.py b/tests/PullRequestReview1856.py
new file mode 100644
index 0000000000..4343bac016
--- /dev/null
+++ b/tests/PullRequestReview1856.py
@@ -0,0 +1,14 @@
+from . import Framework
+
+
+class PullRequestReview1856(Framework.TestCase):
+ def setUp(self):
+ super().setUp()
+ pumpkin_repo = self.g.get_repo("CS481-Team-Pumpkin/PyGithub", lazy=True)
+ self.pumpkin_pull = pumpkin_repo.get_pull(4)
+ self.pullreview = self.pumpkin_pull.get_review(631460061)
+
+ def testDelete(self):
+ self.pullreview.delete()
+ reviews = self.pumpkin_pull.get_reviews()
+ self.assertEqual(list(reviews), [])
diff --git a/tests/ReplayData/PullRequestReview1856.setUp.txt b/tests/ReplayData/PullRequestReview1856.setUp.txt
new file mode 100644
index 0000000000..70ffa8a9c3
--- /dev/null
+++ b/tests/ReplayData/PullRequestReview1856.setUp.txt
@@ -0,0 +1,22 @@
+https
+GET
+api.github.com
+None
+/repos/CS481-Team-Pumpkin/PyGithub/pulls/4
+{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
+None
+200
+[('Server', 'GitHub.com'), ('Date', 'Thu, 08 Apr 2021 14:27:12 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, X-Requested-With'), ('ETag', 'W/"8639f2457cf97f5885ced460b20f8f7d17d5c09930e448de42e75b78426cd8e8"'), ('Last-Modified', 'Thu, 08 Apr 2021 14:23:05 GMT'), ('X-OAuth-Scopes', 'admin:org, repo'), ('X-Accepted-OAuth-Scopes', ''), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4993'), ('X-RateLimit-Reset', '1617895279'), ('X-RateLimit-Used', '7'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '0'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'EB48:109EA:37F217:38E505:606F12C0')]
+{"url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/pulls/4","id":611598215,"node_id":"MDExOlB1bGxSZXF1ZXN0NjExNTk4MjE1","html_url":"https://github.com/CS481-Team-Pumpkin/PyGithub/pull/4","diff_url":"https://github.com/CS481-Team-Pumpkin/PyGithub/pull/4.diff","patch_url":"https://github.com/CS481-Team-Pumpkin/PyGithub/pull/4.patch","issue_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/issues/4","number":4,"state":"open","locked":false,"title":"Test commit","user":{"login":"bagashvilit","id":46755932,"node_id":"MDQ6VXNlcjQ2NzU1OTMy","avatar_url":"https://avatars.githubusercontent.com/u/46755932?v=4","gravatar_id":"","url":"https://api.github.com/users/bagashvilit","html_url":"https://github.com/bagashvilit","followers_url":"https://api.github.com/users/bagashvilit/followers","following_url":"https://api.github.com/users/bagashvilit/following{/other_user}","gists_url":"https://api.github.com/users/bagashvilit/gists{/gist_id}","starred_url":"https://api.github.com/users/bagashvilit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bagashvilit/subscriptions","organizations_url":"https://api.github.com/users/bagashvilit/orgs","repos_url":"https://api.github.com/users/bagashvilit/repos","events_url":"https://api.github.com/users/bagashvilit/events{/privacy}","received_events_url":"https://api.github.com/users/bagashvilit/received_events","type":"User","site_admin":false},"body":"","created_at":"2021-04-08T14:16:39Z","updated_at":"2021-04-08T14:23:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"07c3d56fa500c0f03a403136ba62cbbec6f148b0","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"draft":false,"commits_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/pulls/4/commits","review_comments_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/pulls/4/comments","review_comment_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/issues/4/comments","statuses_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/statuses/a99c92b2ba68464a1a05d7fa8ef55e3a98803e5f","head":{"label":"CS481-Team-Pumpkin:test_delete_pending_review","ref":"test_delete_pending_review","sha":"a99c92b2ba68464a1a05d7fa8ef55e3a98803e5f","user":{"login":"CS481-Team-Pumpkin","id":80543978,"node_id":"MDEyOk9yZ2FuaXphdGlvbjgwNTQzOTc4","avatar_url":"https://avatars.githubusercontent.com/u/80543978?v=4","gravatar_id":"","url":"https://api.github.com/users/CS481-Team-Pumpkin","html_url":"https://github.com/CS481-Team-Pumpkin","followers_url":"https://api.github.com/users/CS481-Team-Pumpkin/followers","following_url":"https://api.github.com/users/CS481-Team-Pumpkin/following{/other_user}","gists_url":"https://api.github.com/users/CS481-Team-Pumpkin/gists{/gist_id}","starred_url":"https://api.github.com/users/CS481-Team-Pumpkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CS481-Team-Pumpkin/subscriptions","organizations_url":"https://api.github.com/users/CS481-Team-Pumpkin/orgs","repos_url":"https://api.github.com/users/CS481-Team-Pumpkin/repos","events_url":"https://api.github.com/users/CS481-Team-Pumpkin/events{/privacy}","received_events_url":"https://api.github.com/users/CS481-Team-Pumpkin/received_events","type":"Organization","site_admin":false},"repo":{"id":347169081,"node_id":"MDEwOlJlcG9zaXRvcnkzNDcxNjkwODE=","name":"PyGithub","full_name":"CS481-Team-Pumpkin/PyGithub","private":false,"owner":{"login":"CS481-Team-Pumpkin","id":80543978,"node_id":"MDEyOk9yZ2FuaXphdGlvbjgwNTQzOTc4","avatar_url":"https://avatars.githubusercontent.com/u/80543978?v=4","gravatar_id":"","url":"https://api.github.com/users/CS481-Team-Pumpkin","html_url":"https://github.com/CS481-Team-Pumpkin","followers_url":"https://api.github.com/users/CS481-Team-Pumpkin/followers","following_url":"https://api.github.com/users/CS481-Team-Pumpkin/following{/other_user}","gists_url":"https://api.github.com/users/CS481-Team-Pumpkin/gists{/gist_id}","starred_url":"https://api.github.com/users/CS481-Team-Pumpkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CS481-Team-Pumpkin/subscriptions","organizations_url":"https://api.github.com/users/CS481-Team-Pumpkin/orgs","repos_url":"https://api.github.com/users/CS481-Team-Pumpkin/repos","events_url":"https://api.github.com/users/CS481-Team-Pumpkin/events{/privacy}","received_events_url":"https://api.github.com/users/CS481-Team-Pumpkin/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/CS481-Team-Pumpkin/PyGithub","description":"Typed interactions with the GitHub API v3","fork":true,"url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub","forks_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/forks","keys_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/teams","hooks_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/hooks","issue_events_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/issues/events{/number}","events_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/events","assignees_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/assignees{/user}","branches_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/branches{/branch}","tags_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/tags","blobs_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/git/refs{/sha}","trees_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/statuses/{sha}","languages_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/languages","stargazers_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/stargazers","contributors_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/contributors","subscribers_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/subscribers","subscription_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/subscription","commits_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/commits{/sha}","git_commits_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/git/commits{/sha}","comments_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/comments{/number}","issue_comment_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/issues/comments{/number}","contents_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/contents/{+path}","compare_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/merges","archive_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/downloads","issues_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/issues{/number}","pulls_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/pulls{/number}","milestones_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/milestones{/number}","notifications_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/labels{/name}","releases_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/releases{/id}","deployments_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/deployments","created_at":"2021-03-12T18:58:51Z","updated_at":"2021-04-02T17:52:24Z","pushed_at":"2021-04-08T14:16:39Z","git_url":"git://github.com/CS481-Team-Pumpkin/PyGithub.git","ssh_url":"git@github.com:CS481-Team-Pumpkin/PyGithub.git","clone_url":"https://github.com/CS481-Team-Pumpkin/PyGithub.git","svn_url":"https://github.com/CS481-Team-Pumpkin/PyGithub","homepage":"https://pygithub.readthedocs.io/","size":13338,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":3,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0","node_id":"MDc6TGljZW5zZTEy"},"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"CS481-Team-Pumpkin:master","ref":"master","sha":"7f0a239bc797a071e512b763dfd3e4339191dc18","user":{"login":"CS481-Team-Pumpkin","id":80543978,"node_id":"MDEyOk9yZ2FuaXphdGlvbjgwNTQzOTc4","avatar_url":"https://avatars.githubusercontent.com/u/80543978?v=4","gravatar_id":"","url":"https://api.github.com/users/CS481-Team-Pumpkin","html_url":"https://github.com/CS481-Team-Pumpkin","followers_url":"https://api.github.com/users/CS481-Team-Pumpkin/followers","following_url":"https://api.github.com/users/CS481-Team-Pumpkin/following{/other_user}","gists_url":"https://api.github.com/users/CS481-Team-Pumpkin/gists{/gist_id}","starred_url":"https://api.github.com/users/CS481-Team-Pumpkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CS481-Team-Pumpkin/subscriptions","organizations_url":"https://api.github.com/users/CS481-Team-Pumpkin/orgs","repos_url":"https://api.github.com/users/CS481-Team-Pumpkin/repos","events_url":"https://api.github.com/users/CS481-Team-Pumpkin/events{/privacy}","received_events_url":"https://api.github.com/users/CS481-Team-Pumpkin/received_events","type":"Organization","site_admin":false},"repo":{"id":347169081,"node_id":"MDEwOlJlcG9zaXRvcnkzNDcxNjkwODE=","name":"PyGithub","full_name":"CS481-Team-Pumpkin/PyGithub","private":false,"owner":{"login":"CS481-Team-Pumpkin","id":80543978,"node_id":"MDEyOk9yZ2FuaXphdGlvbjgwNTQzOTc4","avatar_url":"https://avatars.githubusercontent.com/u/80543978?v=4","gravatar_id":"","url":"https://api.github.com/users/CS481-Team-Pumpkin","html_url":"https://github.com/CS481-Team-Pumpkin","followers_url":"https://api.github.com/users/CS481-Team-Pumpkin/followers","following_url":"https://api.github.com/users/CS481-Team-Pumpkin/following{/other_user}","gists_url":"https://api.github.com/users/CS481-Team-Pumpkin/gists{/gist_id}","starred_url":"https://api.github.com/users/CS481-Team-Pumpkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CS481-Team-Pumpkin/subscriptions","organizations_url":"https://api.github.com/users/CS481-Team-Pumpkin/orgs","repos_url":"https://api.github.com/users/CS481-Team-Pumpkin/repos","events_url":"https://api.github.com/users/CS481-Team-Pumpkin/events{/privacy}","received_events_url":"https://api.github.com/users/CS481-Team-Pumpkin/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/CS481-Team-Pumpkin/PyGithub","description":"Typed interactions with the GitHub API v3","fork":true,"url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub","forks_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/forks","keys_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/teams","hooks_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/hooks","issue_events_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/issues/events{/number}","events_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/events","assignees_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/assignees{/user}","branches_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/branches{/branch}","tags_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/tags","blobs_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/git/refs{/sha}","trees_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/statuses/{sha}","languages_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/languages","stargazers_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/stargazers","contributors_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/contributors","subscribers_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/subscribers","subscription_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/subscription","commits_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/commits{/sha}","git_commits_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/git/commits{/sha}","comments_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/comments{/number}","issue_comment_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/issues/comments{/number}","contents_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/contents/{+path}","compare_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/merges","archive_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/downloads","issues_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/issues{/number}","pulls_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/pulls{/number}","milestones_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/milestones{/number}","notifications_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/labels{/name}","releases_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/releases{/id}","deployments_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/deployments","created_at":"2021-03-12T18:58:51Z","updated_at":"2021-04-02T17:52:24Z","pushed_at":"2021-04-08T14:16:39Z","git_url":"git://github.com/CS481-Team-Pumpkin/PyGithub.git","ssh_url":"git@github.com:CS481-Team-Pumpkin/PyGithub.git","clone_url":"https://github.com/CS481-Team-Pumpkin/PyGithub.git","svn_url":"https://github.com/CS481-Team-Pumpkin/PyGithub","homepage":"https://pygithub.readthedocs.io/","size":13338,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":3,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0","node_id":"MDc6TGljZW5zZTEy"},"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/pulls/4"},"html":{"href":"https://github.com/CS481-Team-Pumpkin/PyGithub/pull/4"},"issue":{"href":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/issues/4"},"comments":{"href":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/statuses/a99c92b2ba68464a1a05d7fa8ef55e3a98803e5f"}},"author_association":"MEMBER","auto_merge":null,"active_lock_reason":null,"merged":false,"mergeable":true,"rebaseable":true,"mergeable_state":"clean","merged_by":null,"comments":0,"review_comments":1,"maintainer_can_modify":false,"commits":1,"additions":1,"deletions":0,"changed_files":1}
+
+https
+GET
+api.github.com
+None
+/repos/CS481-Team-Pumpkin/PyGithub/pulls/4/reviews/631460061
+{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
+None
+200
+[('Server', 'GitHub.com'), ('Date', 'Thu, 08 Apr 2021 14:27:13 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, X-Requested-With'), ('ETag', 'W/"2cb2134a474a60fa86391e682a41332b9ce4e92e41b9e7d2039ce2e6c64ae80e"'), ('X-OAuth-Scopes', 'admin:org, repo'), ('X-Accepted-OAuth-Scopes', ''), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4992'), ('X-RateLimit-Reset', '1617895279'), ('X-RateLimit-Used', '8'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '0'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'EB4A:950E:125F8E:13037F:606F12C0')]
+{"id":631460061,"node_id":"MDE3OlB1bGxSZXF1ZXN0UmV2aWV3NjMxNDYwMDYx","user":{"login":"bagashvilit","id":46755932,"node_id":"MDQ6VXNlcjQ2NzU1OTMy","avatar_url":"https://avatars.githubusercontent.com/u/46755932?v=4","gravatar_id":"","url":"https://api.github.com/users/bagashvilit","html_url":"https://github.com/bagashvilit","followers_url":"https://api.github.com/users/bagashvilit/followers","following_url":"https://api.github.com/users/bagashvilit/following{/other_user}","gists_url":"https://api.github.com/users/bagashvilit/gists{/gist_id}","starred_url":"https://api.github.com/users/bagashvilit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bagashvilit/subscriptions","organizations_url":"https://api.github.com/users/bagashvilit/orgs","repos_url":"https://api.github.com/users/bagashvilit/repos","events_url":"https://api.github.com/users/bagashvilit/events{/privacy}","received_events_url":"https://api.github.com/users/bagashvilit/received_events","type":"User","site_admin":false},"body":"","state":"PENDING","html_url":"https://github.com/CS481-Team-Pumpkin/PyGithub/pull/4#pullrequestreview-631460061","pull_request_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/pulls/4","author_association":"MEMBER","_links":{"html":{"href":"https://github.com/CS481-Team-Pumpkin/PyGithub/pull/4#pullrequestreview-631460061"},"pull_request":{"href":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/pulls/4"}},"commit_id":"a99c92b2ba68464a1a05d7fa8ef55e3a98803e5f"}
+
diff --git a/tests/ReplayData/PullRequestReview1856.testDelete.txt b/tests/ReplayData/PullRequestReview1856.testDelete.txt
new file mode 100644
index 0000000000..47bb025c03
--- /dev/null
+++ b/tests/ReplayData/PullRequestReview1856.testDelete.txt
@@ -0,0 +1,22 @@
+https
+DELETE
+api.github.com
+None
+/repos/CS481-Team-Pumpkin/PyGithub/pulls/4/reviews/631460061
+{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
+None
+200
+[('Server', 'GitHub.com'), ('Date', 'Thu, 08 Apr 2021 14:27:14 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, X-Requested-With'), ('ETag', 'W/"2cb2134a474a60fa86391e682a41332b9ce4e92e41b9e7d2039ce2e6c64ae80e"'), ('X-OAuth-Scopes', 'admin:org, repo'), ('X-Accepted-OAuth-Scopes', 'public_repo, repo'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4991'), ('X-RateLimit-Reset', '1617895279'), ('X-RateLimit-Used', '9'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '0'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'EB4C:74D7:85110:8A249:606F12C1')]
+{"id":631460061,"node_id":"MDE3OlB1bGxSZXF1ZXN0UmV2aWV3NjMxNDYwMDYx","user":{"login":"bagashvilit","id":46755932,"node_id":"MDQ6VXNlcjQ2NzU1OTMy","avatar_url":"https://avatars.githubusercontent.com/u/46755932?v=4","gravatar_id":"","url":"https://api.github.com/users/bagashvilit","html_url":"https://github.com/bagashvilit","followers_url":"https://api.github.com/users/bagashvilit/followers","following_url":"https://api.github.com/users/bagashvilit/following{/other_user}","gists_url":"https://api.github.com/users/bagashvilit/gists{/gist_id}","starred_url":"https://api.github.com/users/bagashvilit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bagashvilit/subscriptions","organizations_url":"https://api.github.com/users/bagashvilit/orgs","repos_url":"https://api.github.com/users/bagashvilit/repos","events_url":"https://api.github.com/users/bagashvilit/events{/privacy}","received_events_url":"https://api.github.com/users/bagashvilit/received_events","type":"User","site_admin":false},"body":"","state":"PENDING","html_url":"https://github.com/CS481-Team-Pumpkin/PyGithub/pull/4#pullrequestreview-631460061","pull_request_url":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/pulls/4","author_association":"MEMBER","_links":{"html":{"href":"https://github.com/CS481-Team-Pumpkin/PyGithub/pull/4#pullrequestreview-631460061"},"pull_request":{"href":"https://api.github.com/repos/CS481-Team-Pumpkin/PyGithub/pulls/4"}},"commit_id":"a99c92b2ba68464a1a05d7fa8ef55e3a98803e5f"}
+
+https
+GET
+api.github.com
+None
+/repos/CS481-Team-Pumpkin/PyGithub/pulls/4/reviews
+{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
+None
+200
+[('Server', 'GitHub.com'), ('Date', 'Thu, 08 Apr 2021 14:27:14 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Content-Length', '2'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, X-Requested-With'), ('ETag', '"82184cd6a599c0bb646629f3cbc867fb158314f97d57df6e35f0e910ed328f22"'), ('X-OAuth-Scopes', 'admin:org, repo'), ('X-Accepted-OAuth-Scopes', ''), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4990'), ('X-RateLimit-Reset', '1617895279'), ('X-RateLimit-Used', '10'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '0'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('X-GitHub-Request-Id', 'EB4E:109E6:83D8B:8CA9B:606F12C2')]
+[]
+
diff --git a/tests/ReplayData/Repository.testRenameBranchObject.txt b/tests/ReplayData/Repository.testRenameBranchObject.txt
new file mode 100644
index 0000000000..23abea565e
--- /dev/null
+++ b/tests/ReplayData/Repository.testRenameBranchObject.txt
@@ -0,0 +1,22 @@
+https
+GET
+api.github.com
+None
+/repos/jacquev6/PyGithub/branches/neat-new-feature
+{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
+None
+200
+[('Server', 'GitHub.com'), ('Date', 'Sat, 23 Oct 2021 04:32:06 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, X-Requested-With'), ('ETag', 'W/"7b4b9377dbba34db4d606bcfaadf8997f690d2fb7afc15982857269ba17e8a90"'), ('X-OAuth-Scopes', 'admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete:packages, delete_repo, gist, notifications, repo, user, workflow, write:discussion, write:packages'), ('X-Accepted-OAuth-Scopes', ''), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4998'), ('X-RateLimit-Reset', '1634967125'), ('X-RateLimit-Used', '2'), ('X-RateLimit-Resource', 'core'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '0'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', '82FE:7C71:69CE0C:7107D9:61739046')]
+{"name":"neat-new-feature","commit":{"sha":"dbfbf7f07b81d616d4da032bcfa7ca90dcd79575","node_id":"C_kwDOB7W4ZNoAKGRiZmJmN2YwN2I4MWQ2MTZkNGRhMDMyYmNmYTdjYTkwZGNkNzk1NzU","commit":{"author":{"name":"Steve Kowalik","email":"steven@wedontsleep.org","date":"2021-10-21T04:06:06Z"},"committer":{"name":"Steve Kowalik","email":"steven@wedontsleep.org","date":"2021-10-21T04:06:06Z"},"message":"WIP: branch rename","tree":{"sha":"81e30fe50ff2b1c8e8cb819d181b3a285e9a9c94","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/81e30fe50ff2b1c8e8cb819d181b3a285e9a9c94"},"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/dbfbf7f07b81d616d4da032bcfa7ca90dcd79575","comment_count":0,"verification":{"verified":false,"reason":"unsigned","signature":null,"payload":null}},"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/dbfbf7f07b81d616d4da032bcfa7ca90dcd79575","html_url":"https://github.com/jacquev6/PyGithub/commit/dbfbf7f07b81d616d4da032bcfa7ca90dcd79575","comments_url":"https://api.github.com/repos/jacquev6/PyGithub/commits/dbfbf7f07b81d616d4da032bcfa7ca90dcd79575/comments","author":{"login":"jacquev6","id":15225059,"node_id":"MDQ6VXNlcjE1MjI1MDU5","avatar_url":"https://avatars.githubusercontent.com/u/15225059?v=4","gravatar_id":"","url":"https://api.github.com/users/jacquev6","html_url":"https://github.com/jacquev6","followers_url":"https://api.github.com/users/jacquev6/followers","following_url":"https://api.github.com/users/jacquev6/following{/other_user}","gists_url":"https://api.github.com/users/jacquev6/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquev6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquev6/subscriptions","organizations_url":"https://api.github.com/users/jacquev6/orgs","repos_url":"https://api.github.com/users/jacquev6/repos","events_url":"https://api.github.com/users/jacquev6/events{/privacy}","received_events_url":"https://api.github.com/users/jacquev6/received_events","type":"User","site_admin":false},"committer":{"login":"jacquev6","id":15225059,"node_id":"MDQ6VXNlcjE1MjI1MDU5","avatar_url":"https://avatars.githubusercontent.com/u/15225059?v=4","gravatar_id":"","url":"https://api.github.com/users/jacquev6","html_url":"https://github.com/jacquev6","followers_url":"https://api.github.com/users/jacquev6/followers","following_url":"https://api.github.com/users/jacquev6/following{/other_user}","gists_url":"https://api.github.com/users/jacquev6/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquev6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquev6/subscriptions","organizations_url":"https://api.github.com/users/jacquev6/orgs","repos_url":"https://api.github.com/users/jacquev6/repos","events_url":"https://api.github.com/users/jacquev6/events{/privacy}","received_events_url":"https://api.github.com/users/jacquev6/received_events","type":"User","site_admin":false},"parents":[{"sha":"93b92cd2fce560080dc66aef3b94427623046c5d","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/93b92cd2fce560080dc66aef3b94427623046c5d","html_url":"https://github.com/jacquev6/PyGithub/commit/93b92cd2fce560080dc66aef3b94427623046c5d"}]},"_links":{"self":"https://api.github.com/repos/jacquev6/PyGithub/branches/neat-new-feature","html":"https://github.com/jacquev6/PyGithub/tree/neat-new-feature"},"protected":false,"protection":{"enabled":false,"required_status_checks":{"enforcement_level":"off","contexts":[]}},"protection_url":"https://api.github.com/repos/jacquev6/PyGithub/branches/neat-new-feature/protection"}
+
+https
+POST
+api.github.com
+None
+/repos/jacquev6/PyGithub/branches/neat-new-feature/rename
+{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python', 'Content-Type': 'application/json'}
+{"new_name": "terrible-idea"}
+201
+[('Server', 'GitHub.com'), ('Date', 'Sat, 23 Oct 2021 04:32:07 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Content-Length', '3748'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, X-Requested-With'), ('ETag', '"21b924f024389f2dad56ec7b61664d88fa432e59b6068797da15b3b1718799a1"'), ('X-OAuth-Scopes', 'admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete:packages, delete_repo, gist, notifications, repo, user, workflow, write:discussion, write:packages'), ('X-Accepted-OAuth-Scopes', ''), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4996'), ('X-RateLimit-Reset', '1634967125'), ('X-RateLimit-Used', '4'), ('X-RateLimit-Resource', 'core'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '0'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('X-GitHub-Request-Id', '8302:7C71:69CE3F:710812:61739046')]
+{"name":"terrible-idea","commit":{"sha":"dbfbf7f07b81d616d4da032bcfa7ca90dcd79575","node_id":"C_kwDOB7W4ZNoAKGRiZmJmN2YwN2I4MWQ2MTZkNGRhMDMyYmNmYTdjYTkwZGNkNzk1NzU","commit":{"author":{"name":"Steve Kowalik","email":"steven@wedontsleep.org","date":"2021-10-21T04:06:06Z"},"committer":{"name":"Steve Kowalik","email":"steven@wedontsleep.org","date":"2021-10-21T04:06:06Z"},"message":"WIP: branch rename","tree":{"sha":"81e30fe50ff2b1c8e8cb819d181b3a285e9a9c94","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/81e30fe50ff2b1c8e8cb819d181b3a285e9a9c94"},"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/dbfbf7f07b81d616d4da032bcfa7ca90dcd79575","comment_count":0,"verification":{"verified":false,"reason":"unsigned","signature":null,"payload":null}},"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/dbfbf7f07b81d616d4da032bcfa7ca90dcd79575","html_url":"https://github.com/jacquev6/PyGithub/commit/dbfbf7f07b81d616d4da032bcfa7ca90dcd79575","comments_url":"https://api.github.com/repos/jacquev6/PyGithub/commits/dbfbf7f07b81d616d4da032bcfa7ca90dcd79575/comments","author":{"login":"jacquev6","id":15225059,"node_id":"MDQ6VXNlcjE1MjI1MDU5","avatar_url":"https://avatars.githubusercontent.com/u/15225059?v=4","gravatar_id":"","url":"https://api.github.com/users/jacquev6","html_url":"https://github.com/jacquev6","followers_url":"https://api.github.com/users/jacquev6/followers","following_url":"https://api.github.com/users/jacquev6/following{/other_user}","gists_url":"https://api.github.com/users/jacquev6/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquev6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquev6/subscriptions","organizations_url":"https://api.github.com/users/jacquev6/orgs","repos_url":"https://api.github.com/users/jacquev6/repos","events_url":"https://api.github.com/users/jacquev6/events{/privacy}","received_events_url":"https://api.github.com/users/jacquev6/received_events","type":"User","site_admin":false},"committer":{"login":"jacquev6","id":15225059,"node_id":"MDQ6VXNlcjE1MjI1MDU5","avatar_url":"https://avatars.githubusercontent.com/u/15225059?v=4","gravatar_id":"","url":"https://api.github.com/users/jacquev6","html_url":"https://github.com/jacquev6","followers_url":"https://api.github.com/users/jacquev6/followers","following_url":"https://api.github.com/users/jacquev6/following{/other_user}","gists_url":"https://api.github.com/users/jacquev6/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquev6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquev6/subscriptions","organizations_url":"https://api.github.com/users/jacquev6/orgs","repos_url":"https://api.github.com/users/jacquev6/repos","events_url":"https://api.github.com/users/jacquev6/events{/privacy}","received_events_url":"https://api.github.com/users/jacquev6/received_events","type":"User","site_admin":false},"parents":[{"sha":"93b92cd2fce560080dc66aef3b94427623046c5d","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/93b92cd2fce560080dc66aef3b94427623046c5d","html_url":"https://github.com/jacquev6/PyGithub/commit/93b92cd2fce560080dc66aef3b94427623046c5d"}]},"_links":{"self":"https://api.github.com/repos/jacquev6/PyGithub/branches/terrible-idea","html":"https://github.com/jacquev6/PyGithub/tree/terrible-idea"},"protected":false,"protection":{"enabled":false,"required_status_checks":{"enforcement_level":"off","contexts":[]}},"protection_url":"https://api.github.com/repos/jacquev6/PyGithub/branches/terrible-idea/protection"}
+
diff --git a/tests/ReplayData/Repository.testRenameBranchString.txt b/tests/ReplayData/Repository.testRenameBranchString.txt
new file mode 100644
index 0000000000..193c642eda
--- /dev/null
+++ b/tests/ReplayData/Repository.testRenameBranchString.txt
@@ -0,0 +1,11 @@
+https
+POST
+api.github.com
+None
+/repos/jacquev6/PyGithub/branches/neat-new-feature/rename
+{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python', 'Content-Type': 'application/json'}
+{"new_name": "terrible-idea"}
+201
+[('Server', 'GitHub.com'), ('Date', 'Sat, 23 Oct 2021 04:32:07 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Content-Length', '3748'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, X-Requested-With'), ('ETag', '"21b924f024389f2dad56ec7b61664d88fa432e59b6068797da15b3b1718799a1"'), ('X-OAuth-Scopes', 'admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete:packages, delete_repo, gist, notifications, repo, user, workflow, write:discussion, write:packages'), ('X-Accepted-OAuth-Scopes', ''), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4996'), ('X-RateLimit-Reset', '1634967125'), ('X-RateLimit-Used', '4'), ('X-RateLimit-Resource', 'core'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '0'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('X-GitHub-Request-Id', '8302:7C71:69CE3F:710812:61739046')]
+{"name":"terrible-idea","commit":{"sha":"dbfbf7f07b81d616d4da032bcfa7ca90dcd79575","node_id":"C_kwDOB7W4ZNoAKGRiZmJmN2YwN2I4MWQ2MTZkNGRhMDMyYmNmYTdjYTkwZGNkNzk1NzU","commit":{"author":{"name":"Steve Kowalik","email":"steven@wedontsleep.org","date":"2021-10-21T04:06:06Z"},"committer":{"name":"Steve Kowalik","email":"steven@wedontsleep.org","date":"2021-10-21T04:06:06Z"},"message":"WIP: branch rename","tree":{"sha":"81e30fe50ff2b1c8e8cb819d181b3a285e9a9c94","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/81e30fe50ff2b1c8e8cb819d181b3a285e9a9c94"},"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/dbfbf7f07b81d616d4da032bcfa7ca90dcd79575","comment_count":0,"verification":{"verified":false,"reason":"unsigned","signature":null,"payload":null}},"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/dbfbf7f07b81d616d4da032bcfa7ca90dcd79575","html_url":"https://github.com/jacquev6/PyGithub/commit/dbfbf7f07b81d616d4da032bcfa7ca90dcd79575","comments_url":"https://api.github.com/repos/jacquev6/PyGithub/commits/dbfbf7f07b81d616d4da032bcfa7ca90dcd79575/comments","author":{"login":"jacquev6","id":15225059,"node_id":"MDQ6VXNlcjE1MjI1MDU5","avatar_url":"https://avatars.githubusercontent.com/u/15225059?v=4","gravatar_id":"","url":"https://api.github.com/users/jacquev6","html_url":"https://github.com/jacquev6","followers_url":"https://api.github.com/users/jacquev6/followers","following_url":"https://api.github.com/users/jacquev6/following{/other_user}","gists_url":"https://api.github.com/users/jacquev6/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquev6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquev6/subscriptions","organizations_url":"https://api.github.com/users/jacquev6/orgs","repos_url":"https://api.github.com/users/jacquev6/repos","events_url":"https://api.github.com/users/jacquev6/events{/privacy}","received_events_url":"https://api.github.com/users/jacquev6/received_events","type":"User","site_admin":false},"committer":{"login":"jacquev6","id":15225059,"node_id":"MDQ6VXNlcjE1MjI1MDU5","avatar_url":"https://avatars.githubusercontent.com/u/15225059?v=4","gravatar_id":"","url":"https://api.github.com/users/jacquev6","html_url":"https://github.com/jacquev6","followers_url":"https://api.github.com/users/jacquev6/followers","following_url":"https://api.github.com/users/jacquev6/following{/other_user}","gists_url":"https://api.github.com/users/jacquev6/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquev6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquev6/subscriptions","organizations_url":"https://api.github.com/users/jacquev6/orgs","repos_url":"https://api.github.com/users/jacquev6/repos","events_url":"https://api.github.com/users/jacquev6/events{/privacy}","received_events_url":"https://api.github.com/users/jacquev6/received_events","type":"User","site_admin":false},"parents":[{"sha":"93b92cd2fce560080dc66aef3b94427623046c5d","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/93b92cd2fce560080dc66aef3b94427623046c5d","html_url":"https://github.com/jacquev6/PyGithub/commit/93b92cd2fce560080dc66aef3b94427623046c5d"}]},"_links":{"self":"https://api.github.com/repos/jacquev6/PyGithub/branches/terrible-idea","html":"https://github.com/jacquev6/PyGithub/tree/terrible-idea"},"protected":false,"protection":{"enabled":false,"required_status_checks":{"enforcement_level":"off","contexts":[]}},"protection_url":"https://api.github.com/repos/jacquev6/PyGithub/branches/terrible-idea/protection"}
+
diff --git a/tests/ReplayData/Search.testSearchCommits.txt b/tests/ReplayData/Search.testSearchCommits.txt
new file mode 100644
index 0000000000..357d2fcd15
--- /dev/null
+++ b/tests/ReplayData/Search.testSearchCommits.txt
@@ -0,0 +1,11 @@
+https
+GET
+api.github.com
+None
+/search/commits?sort=author-date&order=asc&q=hash%3A1265747e992ba7d34a469b6b2f527809f8bf7067+merge%3Afalse&per_page=1
+{'Accept': 'application/vnd.github.cloak-preview', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
+None
+200
+[('Server', 'GitHub.com'), ('Date', 'Thu, 21 Oct 2021 04:54:24 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Cache-Control', 'no-cache'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, X-Requested-With'), ('X-OAuth-Scopes', 'admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete:packages, delete_repo, gist, notifications, repo, user, workflow, write:discussion, write:packages'), ('X-Accepted-OAuth-Scopes', ''), ('X-GitHub-Media-Type', 'github.v3; param=cloak-preview'), ('Link', '; rel="next", ; rel="last"'), ('X-RateLimit-Limit', '30'), ('X-RateLimit-Remaining', '28'), ('X-RateLimit-Reset', '1634792071'), ('X-RateLimit-Used', '2'), ('X-RateLimit-Resource', 'search'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '0'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'DB8E:3107:5AE85E:63CFBA:6170F280')]
+{"total_count":2,"incomplete_results":false,"items":[{"url":"https://api.github.com/repos/PyGithub/PyGithub/commits/1265747e992ba7d34a469b6b2f527809f8bf7067","sha":"1265747e992ba7d34a469b6b2f527809f8bf7067","node_id":"MDY6Q29tbWl0MzU0NDQ5MDoxMjY1NzQ3ZTk5MmJhN2QzNGE0NjliNmIyZjUyNzgwOWY4YmY3MDY3","html_url":"https://github.com/PyGithub/PyGithub/commit/1265747e992ba7d34a469b6b2f527809f8bf7067","comments_url":"https://api.github.com/repos/PyGithub/PyGithub/commits/1265747e992ba7d34a469b6b2f527809f8bf7067/comments","commit":{"url":"https://api.github.com/repos/PyGithub/PyGithub/git/commits/1265747e992ba7d34a469b6b2f527809f8bf7067","author":{"date":"2021-06-02T15:00:00.000+10:00","name":"Steve Kowalik","email":"steven@wedontsleep.org"},"committer":{"date":"2021-06-02T15:00:00.000+10:00","name":"GitHub","email":"noreply@github.com"},"message":"Do not transform requestHeaders when logging (#1965)\n\nRequester.__log() sanitizes the headers of the request so that\r\nauthentication details are not logged, but this has the side effect of\r\nmeaning that future requests that use the same Requester object will\r\nfail. Usually, this is perfectly fine, since almost every method will\r\nonly make one request -- where this falls down is when we make another\r\nafter a redirect. Make a copy of the requestHeaders, and sanitize those.\r\n\r\nFixes #1959","tree":{"url":"https://api.github.com/repos/PyGithub/PyGithub/git/trees/6e5b9e20c26a6b3ba8c5481a8e2896bb72a91bbb","sha":"6e5b9e20c26a6b3ba8c5481a8e2896bb72a91bbb"},"comment_count":0},"author":{"login":"s-t-e-v-e-n-k","id":15225059,"node_id":"MDQ6VXNlcjE1MjI1MDU5","avatar_url":"https://avatars.githubusercontent.com/u/15225059?v=4","gravatar_id":"","url":"https://api.github.com/users/s-t-e-v-e-n-k","html_url":"https://github.com/s-t-e-v-e-n-k","followers_url":"https://api.github.com/users/s-t-e-v-e-n-k/followers","following_url":"https://api.github.com/users/s-t-e-v-e-n-k/following{/other_user}","gists_url":"https://api.github.com/users/s-t-e-v-e-n-k/gists{/gist_id}","starred_url":"https://api.github.com/users/s-t-e-v-e-n-k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s-t-e-v-e-n-k/subscriptions","organizations_url":"https://api.github.com/users/s-t-e-v-e-n-k/orgs","repos_url":"https://api.github.com/users/s-t-e-v-e-n-k/repos","events_url":"https://api.github.com/users/s-t-e-v-e-n-k/events{/privacy}","received_events_url":"https://api.github.com/users/s-t-e-v-e-n-k/received_events","type":"User","site_admin":false},"committer":{"login":"web-flow","id":19864447,"node_id":"MDQ6VXNlcjE5ODY0NDQ3","avatar_url":"https://avatars.githubusercontent.com/u/19864447?v=4","gravatar_id":"","url":"https://api.github.com/users/web-flow","html_url":"https://github.com/web-flow","followers_url":"https://api.github.com/users/web-flow/followers","following_url":"https://api.github.com/users/web-flow/following{/other_user}","gists_url":"https://api.github.com/users/web-flow/gists{/gist_id}","starred_url":"https://api.github.com/users/web-flow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/web-flow/subscriptions","organizations_url":"https://api.github.com/users/web-flow/orgs","repos_url":"https://api.github.com/users/web-flow/repos","events_url":"https://api.github.com/users/web-flow/events{/privacy}","received_events_url":"https://api.github.com/users/web-flow/received_events","type":"User","site_admin":false},"parents":[{"url":"https://api.github.com/repos/PyGithub/PyGithub/commits/ed7d0fe94f063d228a7dd95b7df5ae1bedb0707a","html_url":"https://github.com/PyGithub/PyGithub/commit/ed7d0fe94f063d228a7dd95b7df5ae1bedb0707a","sha":"ed7d0fe94f063d228a7dd95b7df5ae1bedb0707a"}],"repository":{"id":3544490,"node_id":"MDEwOlJlcG9zaXRvcnkzNTQ0NDkw","name":"PyGithub","full_name":"PyGithub/PyGithub","private":false,"owner":{"login":"PyGithub","id":11288996,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMjg4OTk2","avatar_url":"https://avatars.githubusercontent.com/u/11288996?v=4","gravatar_id":"","url":"https://api.github.com/users/PyGithub","html_url":"https://github.com/PyGithub","followers_url":"https://api.github.com/users/PyGithub/followers","following_url":"https://api.github.com/users/PyGithub/following{/other_user}","gists_url":"https://api.github.com/users/PyGithub/gists{/gist_id}","starred_url":"https://api.github.com/users/PyGithub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PyGithub/subscriptions","organizations_url":"https://api.github.com/users/PyGithub/orgs","repos_url":"https://api.github.com/users/PyGithub/repos","events_url":"https://api.github.com/users/PyGithub/events{/privacy}","received_events_url":"https://api.github.com/users/PyGithub/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/PyGithub/PyGithub","description":"Typed interactions with the GitHub API v3","fork":false,"url":"https://api.github.com/repos/PyGithub/PyGithub","forks_url":"https://api.github.com/repos/PyGithub/PyGithub/forks","keys_url":"https://api.github.com/repos/PyGithub/PyGithub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PyGithub/PyGithub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PyGithub/PyGithub/teams","hooks_url":"https://api.github.com/repos/PyGithub/PyGithub/hooks","issue_events_url":"https://api.github.com/repos/PyGithub/PyGithub/issues/events{/number}","events_url":"https://api.github.com/repos/PyGithub/PyGithub/events","assignees_url":"https://api.github.com/repos/PyGithub/PyGithub/assignees{/user}","branches_url":"https://api.github.com/repos/PyGithub/PyGithub/branches{/branch}","tags_url":"https://api.github.com/repos/PyGithub/PyGithub/tags","blobs_url":"https://api.github.com/repos/PyGithub/PyGithub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PyGithub/PyGithub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PyGithub/PyGithub/git/refs{/sha}","trees_url":"https://api.github.com/repos/PyGithub/PyGithub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PyGithub/PyGithub/statuses/{sha}","languages_url":"https://api.github.com/repos/PyGithub/PyGithub/languages","stargazers_url":"https://api.github.com/repos/PyGithub/PyGithub/stargazers","contributors_url":"https://api.github.com/repos/PyGithub/PyGithub/contributors","subscribers_url":"https://api.github.com/repos/PyGithub/PyGithub/subscribers","subscription_url":"https://api.github.com/repos/PyGithub/PyGithub/subscription","commits_url":"https://api.github.com/repos/PyGithub/PyGithub/commits{/sha}","git_commits_url":"https://api.github.com/repos/PyGithub/PyGithub/git/commits{/sha}","comments_url":"https://api.github.com/repos/PyGithub/PyGithub/comments{/number}","issue_comment_url":"https://api.github.com/repos/PyGithub/PyGithub/issues/comments{/number}","contents_url":"https://api.github.com/repos/PyGithub/PyGithub/contents/{+path}","compare_url":"https://api.github.com/repos/PyGithub/PyGithub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PyGithub/PyGithub/merges","archive_url":"https://api.github.com/repos/PyGithub/PyGithub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PyGithub/PyGithub/downloads","issues_url":"https://api.github.com/repos/PyGithub/PyGithub/issues{/number}","pulls_url":"https://api.github.com/repos/PyGithub/PyGithub/pulls{/number}","milestones_url":"https://api.github.com/repos/PyGithub/PyGithub/milestones{/number}","notifications_url":"https://api.github.com/repos/PyGithub/PyGithub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PyGithub/PyGithub/labels{/name}","releases_url":"https://api.github.com/repos/PyGithub/PyGithub/releases{/id}","deployments_url":"https://api.github.com/repos/PyGithub/PyGithub/deployments"},"score":1.0}]}
+
diff --git a/tests/Repository.py b/tests/Repository.py
index cdc78b761b..a7befe38cd 100644
--- a/tests/Repository.py
+++ b/tests/Repository.py
@@ -1324,6 +1324,13 @@ def testGetBranch(self):
branch = self.repo.get_branch("develop")
self.assertEqual(branch.commit.sha, "03058a36164d2a7d946db205f25538434fa27d94")
+ def testRenameBranchObject(self):
+ branch = self.repo.get_branch("neat-new-feature")
+ self.assertTrue(self.repo.rename_branch(branch, "terrible-idea"))
+
+ def testRenameBranchString(self):
+ self.assertTrue(self.repo.rename_branch("neat-new-feature", "terrible-idea"))
+
def testMergeWithoutMessage(self):
commit = self.repo.merge("branchForBase", "branchForHead")
self.assertEqual(
diff --git a/tests/Search.py b/tests/Search.py
index f7e2ffe175..aa6c2b2a46 100644
--- a/tests/Search.py
+++ b/tests/Search.py
@@ -195,6 +195,15 @@ def testPaginateSearchCommits(self):
)
self.assertEqual(commits.totalCount, 3)
+ def testSearchCommits(self):
+ commits = self.g.search_commits(
+ query="hash:1265747e992ba7d34a469b6b2f527809f8bf7067",
+ sort="author-date",
+ order="asc",
+ merge="false",
+ )
+ self.assertEqual(commits.totalCount, 2)
+
def testSearchTopics(self):
topics = self.g.search_topics("python", repositories=">950")
self.assertListKeyBegin(