diff --git a/libsaas/services/github/forks.py b/libsaas/services/github/forks.py index f6621a0..27c3ba5 100644 --- a/libsaas/services/github/forks.py +++ b/libsaas/services/github/forks.py @@ -32,11 +32,17 @@ def update(self, *args, **kwargs): raise base.MethodNotSupported() @base.apimethod - def create(self): + def create(self, organization=None): """ Fork this repo. + + :var organization: Specify the organization you would + like to fork to. If left as `None` repo will fork + to current user. + :vartype organization: str """ - request = http.Request('POST', self.get_url()) + params = base.get_params(('organization',), locals()) + request = http.Request('POST', self.get_url(), params) return request, parsers.parse_json diff --git a/test/test_github.py b/test/test_github.py index aff0474..ec77d20 100644 --- a/test/test_github.py +++ b/test/test_github.py @@ -424,6 +424,9 @@ def test_forks(self): self.service.repo('myuser', 'myrepo').forks().create() self.expect('POST', '/repos/myuser/myrepo/forks') + self.service.repo('myuser', 'myrepo').forks().create(organization='myorg') + self.expect('POST', '/repos/myuser/myrepo/forks', json.dumps({'organization': 'myorg'})) + def test_users(self): self.service.user().get() self.expect('GET', '/user')