Support for create_fork (#1306)

* Support for create_fork

http://developer.github.com/v3/repos/forks

* Add test case for create_fork

* Add param doc and fix extra line

* Specify the organization to increase line coverage

* Update test data

* Add type assert for organization param
This commit is contained in:
Tim Gates
2019-11-28 21:44:00 +11:00
committed by Steve Kowalik
parent e40768e03b
commit 2ad51f352e
3 changed files with 31 additions and 0 deletions
+17
View File
@@ -1867,6 +1867,23 @@ class Repository(github.GithubObject.CompletableGithubObject):
None
)
def create_fork(self, organization=github.GithubObject.NotSet):
"""
:calls: `POST /repos/:owner/:repo/forks <http://developer.github.com/v3/repos/forks>`_
:param organization: string or "none" or "*"
:rtype: :class:`github.Repository.Repository`
"""
assert organization is github.GithubObject.NotSet or isinstance(organization, (str, six.text_type)), organization
post_parameters = {}
if organization is not None:
post_parameters["organization"] = organization
headers, data = self._requester.requestJsonAndCheck(
"POST",
self.url + "/forks",
input=post_parameters,
)
return Repository(self._requester, headers, data, completed=True)
def get_git_blob(self, sha):
"""
:calls: `GET /repos/:owner/:repo/git/blobs/:sha <http://developer.github.com/v3/git/blobs>`_