diff --git a/IntegrationTest.py b/IntegrationTest.py index 4493a263..3a83931b 100644 --- a/IntegrationTest.py +++ b/IntegrationTest.py @@ -242,23 +242,23 @@ class IntegrationTest: com1.edit( body = "Comment edited by PyGithub" ) self.printList( "Comments", c.get_comments(), lambda c: c.body ) - # def testCreateForkForOrganization( self ): - # o = self.g.get_organization( self.cobayeOrganization ) - # r = self.g.get_user().get_repo( "TestPyGithub" ) - # rf = o.create_fork( r ) - # print r.owner.login + "/" + r.name, "->", rf.owner.login + "/" + rf.name + def testCreateForkForOrganization( self ): + o = self.g.get_organization( self.cobayeOrganization ) + r = self.g.get_user().get_repo( "TestPyGithub" ) + rf = o.create_fork( r ) + print r.owner.login + "/" + r.name, "->", rf.owner.login + "/" + rf.name - # def testCreateRepoForOrganization( self ): - # o = self.g.get_organization( self.cobayeOrganization ) - # self.printList( "Repos", o.get_repos(), lambda r: r.name ) - # r = o.create_repo( "CreatedByPyGithub", has_wiki = False ) - # self.printList( "Repos", o.get_repos(), lambda r: r.name ) + def testCreateRepoForOrganization( self ): + o = self.g.get_organization( self.cobayeOrganization ) + self.printList( "Repos", o.get_repos(), lambda r: r.name ) + r = o.create_repo( "CreatedByPyGithub", has_wiki = False ) + self.printList( "Repos", o.get_repos(), lambda r: r.name ) - # def testCreateRepoForUser( self ): - # u = self.g.get_user() - # self.printList( "Repos", u.get_repos(), lambda r: r.name ) - # r = u.create_repo( "CreatedByPyGithub", has_wiki = False ) - # self.printList( "Repos", u.get_repos(), lambda r: r.name ) + def testCreateRepoForUser( self ): + u = self.g.get_user() + self.printList( "Repos", u.get_repos(), lambda r: r.name ) + r = u.create_repo( "CreatedByPyGithub", has_wiki = False ) + self.printList( "Repos", u.get_repos(), lambda r: r.name ) # def testDownloads( self ): # r = self.g.get_user().get_repo( "TestPyGithub" ) diff --git a/JsonDescriptionOfGithubApiV3/description.000.human_readable.json b/JsonDescriptionOfGithubApiV3/description.000.human_readable.json index e8fc8727..8a7d1283 100644 --- a/JsonDescriptionOfGithubApiV3/description.000.human_readable.json +++ b/JsonDescriptionOfGithubApiV3/description.000.human_readable.json @@ -176,7 +176,7 @@ "request": { "verb": "POST", "url": [ - { "type": "constant", "value": "/repos/" }, + { "type": "constant", "value": "https://api.github.com/repos/" }, { "type": "argument", "value": [ "repo", "owner", "login" ] }, { "type": "constant", "value": "/" }, { "type": "argument", "value": [ "repo", "name" ] }, @@ -894,7 +894,18 @@ "type": "Repository", "mandatory_parameters": [ { "name": "repo", "type": "Repository" } - ] + ], + "request": { + "verb": "POST", + "url": [ + { "type": "constant", "value": "https://api.github.com/repos/" }, + { "type": "argument", "value": [ "repo", "owner", "login" ] }, + { "type": "constant", "value": "/" }, + { "type": "argument", "value": [ "repo", "name" ] }, + { "type": "constant", "value": "/forks" } + ], + "information": "status" + } } ] }, diff --git a/JsonDescriptionOfGithubApiV3/description.001.normalized.json b/JsonDescriptionOfGithubApiV3/description.001.normalized.json index 2dcff910..55ebf631 100644 --- a/JsonDescriptionOfGithubApiV3/description.001.normalized.json +++ b/JsonDescriptionOfGithubApiV3/description.001.normalized.json @@ -1353,7 +1353,7 @@ "url": [ { "type": "constant", - "value": "/repos/" + "value": "https://api.github.com/repos/" }, { "type": "argument", @@ -5685,6 +5685,39 @@ "create", "fork" ], + "request": { + "url": [ + { + "type": "constant", + "value": "https://api.github.com/repos/" + }, + { + "type": "argument", + "value": [ + "repo", + "owner", + "login" + ] + }, + { + "type": "constant", + "value": "/" + }, + { + "type": "argument", + "value": [ + "repo", + "name" + ] + }, + { + "type": "constant", + "value": "/forks" + } + ], + "information": "status", + "verb": "POST" + }, "optional_parameters": [], "type": { "simple": false, diff --git a/github/GithubObjects/AuthenticatedUser.py b/github/GithubObjects/AuthenticatedUser.py index c9e9b76e..b16d1051 100644 --- a/github/GithubObjects/AuthenticatedUser.py +++ b/github/GithubObjects/AuthenticatedUser.py @@ -183,7 +183,7 @@ class AuthenticatedUser( object ): def create_fork( self, repo ): status, headers, data = self.__requester.request( "POST", - "/repos/" + repo.owner.login + "/" + repo.name + "/forks", + "https://api.github.com/repos/" + repo.owner.login + "/" + repo.name + "/forks", None, None ) diff --git a/github/GithubObjects/Organization.py b/github/GithubObjects/Organization.py index 8061d6bf..0b879b45 100644 --- a/github/GithubObjects/Organization.py +++ b/github/GithubObjects/Organization.py @@ -144,7 +144,13 @@ class Organization( object ): ) def create_fork( self, repo ): - pass + status, headers, data = self.__requester.request( + "POST", + "https://api.github.com/repos/" + repo.owner.login + "/" + repo.name + "/forks", + None, + None + ) + return Repository.Repository( self.__requester, data, lazy = True ) def create_repo( self, name, description = None, homepage = None, private = None, has_issues = None, has_wiki = None, has_downloads = None, team_id = None ): post_parameters = {