From 1527a836b3682d6c241cb0bb2fc12795a8be83c3 Mon Sep 17 00:00:00 2001 From: Vincent Jacques Date: Fri, 1 Jun 2012 21:16:42 +0100 Subject: [PATCH] Structure more parameters We will HAVE to reduce differences between generated code and code that actualy works... --- .../description.human_readable.json | 38 +++++--- .../description.normalized.json | 86 +++++++++++++------ .../GithubObject.MethodBody.DoRequest.py | 4 +- doc/ReferenceOfClasses.md | 26 +++--- src/github/Commit.py | 4 + src/github/GitTree.py | 4 + src/github/Issue.py | 4 + src/github/Organization.py | 8 +- src/github/PullRequest.py | 4 +- src/github/Repository.py | 40 ++++----- src/github/Team.py | 4 + test/Organization.py | 6 +- test/PullRequest.py | 6 +- ...ization.testCreateRepoWithAllArguments.txt | 5 ++ ...ization.testCreateTeamWithAllArguments.txt | 5 ++ .../PullRequest.testCreateComment.txt | 5 ++ .../Repository.testCreateGitCommit.txt | 5 ++ ...ry.testCreateGitCommitWithAllArguments.txt | 5 ++ ...ository.testCreateGitCommitWithParents.txt | 5 ++ ...pository.testCreateGitTreeWithBaseTree.txt | 5 ++ ...sitory.testCreateIssueWithAllArguments.txt | 15 ++++ .../Repository.testCreatePullFromIssue.txt | 5 ++ .../Repository.testGetIssuesWithArguments.txt | 20 +++++ test/Repository.py | 32 ++++--- 24 files changed, 246 insertions(+), 95 deletions(-) diff --git a/codegen/JsonDescriptionOfGithubApiV3/description.human_readable.json b/codegen/JsonDescriptionOfGithubApiV3/description.human_readable.json index 6c57ad90..2ad51df7 100644 --- a/codegen/JsonDescriptionOfGithubApiV3/description.human_readable.json +++ b/codegen/JsonDescriptionOfGithubApiV3/description.human_readable.json @@ -334,6 +334,9 @@ ] } } + ], + "identity": [ + { "type": "attribute", "value": [ "sha" ] } ] }, { @@ -615,6 +618,9 @@ { "name": "sha", "type": "string" }, { "name": "tree", "type": "list:GitTreeElement" }, { "name": "url", "type": "string" } + ], + "identity": [ + { "type": "attribute", "value": [ "sha" ] } ] }, { @@ -759,6 +765,9 @@ "setList": true, "deleteList": true } + ], + "identity": [ + { "type": "attribute", "value": [ "number" ] } ] }, { @@ -1078,7 +1087,7 @@ { "name": "has_issues", "type": "bool" }, { "name": "has_wiki", "type": "bool" }, { "name": "has_downloads", "type": "bool" }, - { "name": "team_id", "type": "integer" } + { "name": "team_id", "type": "Team" } ] } }, @@ -1092,7 +1101,7 @@ { "name": "name", "type": "string" } ], "optionalParameters": [ - { "name": "repo_names", "type": "list:string" }, + { "name": "repo_names", "type": "list:Repository" }, { "name": "permission", "type": "string" } ] }, @@ -1210,7 +1219,7 @@ "createElement": { "mandatoryParameters": [ { "name": "body", "type": "string" }, - { "name": "commit_id", "type": "string" }, + { "name": "commit_id", "type": "Commit" }, { "name": "path", "type": "string" }, { "name": "position", "type": "integer" } ] @@ -1465,7 +1474,7 @@ "createElement": { "mandatoryParameters": [ { "name": "message", "type": "string" }, - { "name": "tree", "type": "string" }, + { "name": "tree", "type": "GitTree" }, { "name": "parents", "type": "list:GitCommit" } ], "optionalParameters": [ @@ -1536,7 +1545,7 @@ { "name": "tree", "type": "list:InputGitTreeElement" } ], "optionalParameters": [ - { "name": "base_tree", "type": "string" } + { "name": "base_tree", "type": "GitTree" } ] }, "getElement": { @@ -1575,11 +1584,11 @@ "type": "Issue", "getList": { "optionalParameters": [ - { "name": "milestone", "type": "integer" }, + { "name": "milestone", "type": "Milestone" }, { "name": "state", "type": "string" }, - { "name": "assignee", "type": "string" }, - { "name": "mentioned", "type": "string" }, - { "name": "labels", "type": "string" }, + { "name": "assignee", "type": "NamedUser" }, + { "name": "mentioned", "type": "NamedUser" }, + { "name": "labels", "type": "list:Label" }, { "name": "sort", "type": "string" }, { "name": "direction", "type": "string" }, { "name": "since", "type": "string" } @@ -1591,9 +1600,9 @@ ], "optionalParameters": [ { "name": "body", "type": "string" }, - { "name": "assignee", "type": "string" }, - { "name": "milestone", "type": "integer" }, - { "name": "labels", "type": "list:string" } + { "name": "assignee", "type": "NamedUser" }, + { "name": "milestone", "type": "Milestone" }, + { "name": "labels", "type": "list:Label" } ] }, "getElement": { @@ -1696,7 +1705,7 @@ "optionalParameters": [ { "name": "title", "type": "string" }, { "name": "body", "type": "string" }, - { "name": "issue", "type": "integer" }, + { "name": "issue", "type": "Issue" }, { "name": "base", "type": "string" }, { "name": "head", "type": "string" } ] @@ -1834,6 +1843,9 @@ "hasElement": true, "removeElement": true } + ], + "identity": [ + { "type": "attribute", "value": [ "id" ] } ] }, { diff --git a/codegen/JsonDescriptionOfGithubApiV3/description.normalized.json b/codegen/JsonDescriptionOfGithubApiV3/description.normalized.json index f90b5afc..067019d4 100644 --- a/codegen/JsonDescriptionOfGithubApiV3/description.normalized.json +++ b/codegen/JsonDescriptionOfGithubApiV3/description.normalized.json @@ -1691,6 +1691,14 @@ ], "isCompletable": true, "name": "Commit", + "identity": [ + { + "type": "attribute", + "value": [ + "sha" + ] + } + ], "methods": [ { "group": "comments", @@ -3442,6 +3450,14 @@ ], "isCompletable": true, "name": "GitTree", + "identity": [ + { + "type": "attribute", + "value": [ + "sha" + ] + } + ], "methods": [] }, { @@ -3892,6 +3908,14 @@ ], "isCompletable": true, "name": "Issue", + "identity": [ + { + "type": "attribute", + "value": [ + "number" + ] + } + ], "methods": [ { "group": "modification", @@ -6204,9 +6228,9 @@ }, { "type": { - "simple": true, + "simple": false, "cardinality": "scalar", - "name": "integer" + "name": "Team" }, "name": "team_id" } @@ -6344,9 +6368,9 @@ "optionalParameters": [ { "type": { - "simple": true, + "simple": false, "cardinality": "list", - "name": "string" + "name": "Repository" }, "name": "repo_names" }, @@ -6861,9 +6885,9 @@ }, { "type": { - "simple": true, + "simple": false, "cardinality": "scalar", - "name": "string" + "name": "Commit" }, "name": "commit_id" }, @@ -8434,9 +8458,9 @@ }, { "type": { - "simple": true, + "simple": false, "cardinality": "scalar", - "name": "string" + "name": "GitTree" }, "name": "tree" }, @@ -8820,9 +8844,9 @@ "optionalParameters": [ { "type": { - "simple": true, + "simple": false, "cardinality": "scalar", - "name": "string" + "name": "GitTree" }, "name": "base_tree" } @@ -9076,25 +9100,25 @@ }, { "type": { - "simple": true, + "simple": false, "cardinality": "scalar", - "name": "string" + "name": "NamedUser" }, "name": "assignee" }, { "type": { - "simple": true, + "simple": false, "cardinality": "scalar", - "name": "integer" + "name": "Milestone" }, "name": "milestone" }, { "type": { - "simple": true, + "simple": false, "cardinality": "list", - "name": "string" + "name": "Label" }, "name": "labels" } @@ -9178,9 +9202,9 @@ "optionalParameters": [ { "type": { - "simple": true, + "simple": false, "cardinality": "scalar", - "name": "integer" + "name": "Milestone" }, "name": "milestone" }, @@ -9194,25 +9218,25 @@ }, { "type": { - "simple": true, + "simple": false, "cardinality": "scalar", - "name": "string" + "name": "NamedUser" }, "name": "assignee" }, { "type": { - "simple": true, + "simple": false, "cardinality": "scalar", - "name": "string" + "name": "NamedUser" }, "name": "mentioned" }, { "type": { - "simple": true, - "cardinality": "scalar", - "name": "string" + "simple": false, + "cardinality": "list", + "name": "Label" }, "name": "labels" }, @@ -9793,9 +9817,9 @@ }, { "type": { - "simple": true, + "simple": false, "cardinality": "scalar", - "name": "integer" + "name": "Issue" }, "name": "issue" }, @@ -10352,6 +10376,14 @@ ], "isCompletable": true, "name": "Team", + "identity": [ + { + "type": "attribute", + "value": [ + "id" + ] + } + ], "methods": [ { "group": "modification", diff --git a/codegen/templates/GithubObject.MethodBody.DoRequest.py b/codegen/templates/GithubObject.MethodBody.DoRequest.py index 693676fc..ccf3dd23 100644 --- a/codegen/templates/GithubObject.MethodBody.DoRequest.py +++ b/codegen/templates/GithubObject.MethodBody.DoRequest.py @@ -9,7 +9,7 @@ {% if method.mandatoryParameters %} post_parameters = { {% for parameter in method.mandatoryParameters %} - "{{ parameter.name }}": {% if parameter.type.simple %}{{ parameter.name }}{% else %}{% if parameter.type.cardinality == "list" %}[ element._identity for element in {{ parameter.name }} ]{% else %}dict( ( key, value._identity ) for key, value in {{ parameter.name }}.iteritems() ){% endif %}{% endif %}, + "{{ parameter.name }}": {% if parameter.type.simple %}{{ parameter.name }}{% else %}{% if parameter.type.cardinality == "list" %}[ element._identity for element in {{ parameter.name }} ]{% else %}{% if parameter.type.cardinality == "dict" %}dict( ( key, value._identity ) for key, value in {{ parameter.name }}.iteritems() ){% else %}{{ parameter.name }}._identity{% endif %}{% endif %}{% endif %}, {% endfor %} } {% else %} @@ -17,7 +17,7 @@ {% endif %} {% for parameter in method.optionalParameters %} if {{ parameter.name }} is not GithubObject.NotSet: - post_parameters[ "{{ parameter.name }}" ] = {% if parameter.type.simple %}{{ parameter.name }}{% else %}{% if parameter.type.cardinality == "dict" %}dict( ( key, value._identity ) for key, value in {{ parameter.name }}.iteritems() ){% else %}{{ parameter.name }}._identity{% endif %}{% endif %} + post_parameters[ "{{ parameter.name }}" ] = {% if parameter.type.simple %}{{ parameter.name }}{% else %}{% if parameter.type.cardinality == "list" %}[ element._identity for element in {{ parameter.name }} ]{% else %}{% if parameter.type.cardinality == "dict" %}dict( ( key, value._identity ) for key, value in {{ parameter.name }}.iteritems() ){% else %}{{ parameter.name }}._identity{% endif %}{% endif %}{% endif %} {% endfor %} {% endif %} {% else %} diff --git a/doc/ReferenceOfClasses.md b/doc/ReferenceOfClasses.md index e32c1ee6..f87464a5 100644 --- a/doc/ReferenceOfClasses.md +++ b/doc/ReferenceOfClasses.md @@ -854,7 +854,7 @@ Repos * `has_issues`: bool * `has_wiki`: bool * `has_downloads`: bool - * `team_id`: integer + * `team_id`: `Team` * `get_repo( name )`: `Repository` * `name`: string * `get_repos( [type] )`: list of `Repository` @@ -864,7 +864,7 @@ Teams ----- * `create_team( name, [repo_names, permission] )`: `Team` * `name`: string - * `repo_names`: list of string + * `repo_names`: list of `Repository` * `permission`: string * `get_team( id )`: `Team` * `id`: integer @@ -925,7 +925,7 @@ Comments -------- * `create_comment( body, commit_id, path, position )`: `PullRequestComment` * `body`: string - * `commit_id`: string + * `commit_id`: `Commit` * `path`: string * `position`: integer * `get_comment( id )`: `PullRequestComment` @@ -1105,7 +1105,7 @@ Git_commits ----------- * `create_git_commit( message, tree, parents, [author, committer] )`: `GitCommit` * `message`: string - * `tree`: string + * `tree`: `GitTree` * `parents`: list of `GitCommit` * `author`: `InputGitAuthor` * `committer`: `InputGitAuthor` @@ -1136,7 +1136,7 @@ Git_trees --------- * `create_git_tree( tree, [base_tree] )`: `GitTree` * `tree`: list of `InputGitTreeElement` - * `base_tree`: string + * `base_tree`: `GitTree` * `get_git_tree( sha, [recursive] )`: `GitTree` * `sha`: string * `recursive`: bool @@ -1157,17 +1157,17 @@ Issues * `create_issue( title, [body, assignee, milestone, labels] )`: `Issue` * `title`: string * `body`: string - * `assignee`: string - * `milestone`: integer - * `labels`: list of string + * `assignee`: `NamedUser` + * `milestone`: `Milestone` + * `labels`: list of `Label` * `get_issue( number )`: `Issue` * `number`: integer * `get_issues( [milestone, state, assignee, mentioned, labels, sort, direction, since] )`: list of `Issue` - * `milestone`: integer + * `milestone`: `Milestone` * `state`: string - * `assignee`: string - * `mentioned`: string - * `labels`: string + * `assignee`: `NamedUser` + * `mentioned`: `NamedUser` + * `labels`: list of `Label` * `sort`: string * `direction`: string * `since`: string @@ -1230,7 +1230,7 @@ Pulls * `create_pull( < title, body, base, head > or < issue, base, head > )`: `PullRequest` * `title`: string * `body`: string - * `issue`: integer + * `issue`: `Issue` * `base`: string * `head`: string * `get_pull( number )`: `PullRequest` diff --git a/src/github/Commit.py b/src/github/Commit.py index 2f75f11b..2b10c3e6 100644 --- a/src/github/Commit.py +++ b/src/github/Commit.py @@ -90,6 +90,10 @@ class Commit( GithubObject.GithubObject ): data ) + @property + def _identity( self ): + return self.sha + def _initAttributes( self ): self._author = GithubObject.NotSet self._commit = GithubObject.NotSet diff --git a/src/github/GitTree.py b/src/github/GitTree.py index 8e1a51f5..e5f38764 100644 --- a/src/github/GitTree.py +++ b/src/github/GitTree.py @@ -21,6 +21,10 @@ class GitTree( GithubObject.GithubObject ): self._completeIfNotSet( self._url ) return self._NoneIfNotSet( self._url ) + @property + def _identity( self ): + return self.sha + def _initAttributes( self ): self._sha = GithubObject.NotSet self._tree = GithubObject.NotSet diff --git a/src/github/Issue.py b/src/github/Issue.py index d0aa2511..7e29d487 100644 --- a/src/github/Issue.py +++ b/src/github/Issue.py @@ -243,6 +243,10 @@ class Issue( GithubObject.GithubObject ): ) self._checkStatus( status, data ) + @property + def _identity( self ): + return self.number + def _initAttributes( self ): self._assignee = GithubObject.NotSet self._body = GithubObject.NotSet diff --git a/src/github/Organization.py b/src/github/Organization.py index a983f57e..f42b1b3b 100644 --- a/src/github/Organization.py +++ b/src/github/Organization.py @@ -163,7 +163,7 @@ class Organization( GithubObject.GithubObject ): assert has_issues is GithubObject.NotSet or isinstance( has_issues, bool ), has_issues assert has_wiki is GithubObject.NotSet or isinstance( has_wiki, bool ), has_wiki assert has_downloads is GithubObject.NotSet or isinstance( has_downloads, bool ), has_downloads - assert team_id is GithubObject.NotSet or isinstance( team_id, int ), team_id + assert team_id is GithubObject.NotSet or isinstance( team_id, Team.Team ), team_id post_parameters = { "name": name, } @@ -180,7 +180,7 @@ class Organization( GithubObject.GithubObject ): if has_downloads is not GithubObject.NotSet: post_parameters[ "has_downloads" ] = has_downloads if team_id is not GithubObject.NotSet: - post_parameters[ "team_id" ] = team_id + post_parameters[ "team_id" ] = team_id._identity status, headers, data = self._request( "POST", self.url + "/repos", @@ -192,13 +192,13 @@ class Organization( GithubObject.GithubObject ): def create_team( self, name, repo_names = GithubObject.NotSet, permission = GithubObject.NotSet ): assert isinstance( name, ( str, unicode ) ), name - assert repo_names is GithubObject.NotSet or all( isinstance( element, ( str, unicode ) ) for element in repo_names ), repo_names + assert repo_names is GithubObject.NotSet or all( isinstance( element, Repository.Repository ) for element in repo_names ), repo_names assert permission is GithubObject.NotSet or isinstance( permission, ( str, unicode ) ), permission post_parameters = { "name": name, } if repo_names is not GithubObject.NotSet: - post_parameters[ "repo_names" ] = repo_names + post_parameters[ "repo_names" ] = [ element._identity for element in repo_names ] if permission is not GithubObject.NotSet: post_parameters[ "permission" ] = permission status, headers, data = self._request( diff --git a/src/github/PullRequest.py b/src/github/PullRequest.py index eb13d227..5534b010 100644 --- a/src/github/PullRequest.py +++ b/src/github/PullRequest.py @@ -144,12 +144,12 @@ class PullRequest( GithubObject.GithubObject ): def create_comment( self, body, commit_id, path, position ): assert isinstance( body, ( str, unicode ) ), body - assert isinstance( commit_id, ( str, unicode ) ), commit_id + assert isinstance( commit_id, Commit.Commit ), commit_id assert isinstance( path, ( str, unicode ) ), path assert isinstance( position, int ), position post_parameters = { "body": body, - "commit_id": commit_id, + "commit_id": commit_id._identity, "path": path, "position": position, } diff --git a/src/github/Repository.py b/src/github/Repository.py index d11702bc..3e2f33f5 100644 --- a/src/github/Repository.py +++ b/src/github/Repository.py @@ -246,13 +246,13 @@ class Repository( GithubObject.GithubObject ): def create_git_commit( self, message, tree, parents, author = GithubObject.NotSet, committer = GithubObject.NotSet ): assert isinstance( message, ( str, unicode ) ), message - assert isinstance( tree, ( str, unicode ) ), tree + assert isinstance( tree, GitTree.GitTree ), tree assert all( isinstance( element, GitCommit.GitCommit ) for element in parents ), parents assert author is GithubObject.NotSet or isinstance( author, InputGitAuthor.InputGitAuthor ), author assert committer is GithubObject.NotSet or isinstance( committer, InputGitAuthor.InputGitAuthor ), committer post_parameters = { "message": message, - "tree": tree, + "tree": tree._identity, "parents": [ element._identity for element in parents ], } if author is not GithubObject.NotSet: @@ -309,12 +309,12 @@ class Repository( GithubObject.GithubObject ): def create_git_tree( self, tree, base_tree = GithubObject.NotSet ): assert all( isinstance( element, InputGitTreeElement.InputGitTreeElement ) for element in tree ), tree - assert base_tree is GithubObject.NotSet or isinstance( base_tree, ( str, unicode ) ), base_tree + assert base_tree is GithubObject.NotSet or isinstance( base_tree, GitTree.GitTree ), base_tree post_parameters = { "tree": [ element._identity for element in tree ], } if base_tree is not GithubObject.NotSet: - post_parameters[ "base_tree" ] = base_tree + post_parameters[ "base_tree" ] = base_tree._identity status, headers, data = self._request( "POST", self.url + "/git/trees", @@ -349,20 +349,20 @@ class Repository( GithubObject.GithubObject ): def create_issue( self, title, body = GithubObject.NotSet, assignee = GithubObject.NotSet, milestone = GithubObject.NotSet, labels = GithubObject.NotSet ): assert isinstance( title, ( str, unicode ) ), title assert body is GithubObject.NotSet or isinstance( body, ( str, unicode ) ), body - assert assignee is GithubObject.NotSet or isinstance( assignee, ( str, unicode ) ), assignee - assert milestone is GithubObject.NotSet or isinstance( milestone, int ), milestone - assert labels is GithubObject.NotSet or all( isinstance( element, ( str, unicode ) ) for element in labels ), labels + assert assignee is GithubObject.NotSet or isinstance( assignee, NamedUser.NamedUser ), assignee + assert milestone is GithubObject.NotSet or isinstance( milestone, Milestone.Milestone ), milestone + assert labels is GithubObject.NotSet or all( isinstance( element, Label.Label ) for element in labels ), labels post_parameters = { "title": title, } if body is not GithubObject.NotSet: post_parameters[ "body" ] = body if assignee is not GithubObject.NotSet: - post_parameters[ "assignee" ] = assignee + post_parameters[ "assignee" ] = assignee._identity if milestone is not GithubObject.NotSet: - post_parameters[ "milestone" ] = milestone + post_parameters[ "milestone" ] = milestone._identity if labels is not GithubObject.NotSet: - post_parameters[ "labels" ] = labels + post_parameters[ "labels" ] = [ element._identity for element in labels ] status, headers, data = self._request( "POST", self.url + "/issues", @@ -441,10 +441,10 @@ class Repository( GithubObject.GithubObject ): return self.__create_pull( title = title, body = body, base = base, head = head ) def __create_pull_2( self, issue, base, head ): - assert isinstance( issue, int ), issue + assert isinstance( issue, Issue.Issue ), issue assert isinstance( base, ( str, unicode ) ), base assert isinstance( head, ( str, unicode ) ), head - return self.__create_pull( issue = issue, base = base, head = head ) + return self.__create_pull( issue = issue._identity, base = base, head = head ) def __create_pull( self, **kwds ): post_parameters = kwds @@ -761,25 +761,25 @@ class Repository( GithubObject.GithubObject ): return Issue.Issue( self._requester, data, completed = True ) def get_issues( self, milestone = GithubObject.NotSet, state = GithubObject.NotSet, assignee = GithubObject.NotSet, mentioned = GithubObject.NotSet, labels = GithubObject.NotSet, sort = GithubObject.NotSet, direction = GithubObject.NotSet, since = GithubObject.NotSet ): - assert milestone is GithubObject.NotSet or isinstance( milestone, int ), milestone + assert milestone is GithubObject.NotSet or isinstance( milestone, Milestone.Milestone ), milestone assert state is GithubObject.NotSet or isinstance( state, ( str, unicode ) ), state - assert assignee is GithubObject.NotSet or isinstance( assignee, ( str, unicode ) ), assignee - assert mentioned is GithubObject.NotSet or isinstance( mentioned, ( str, unicode ) ), mentioned - assert labels is GithubObject.NotSet or isinstance( labels, ( str, unicode ) ), labels + assert assignee is GithubObject.NotSet or isinstance( assignee, NamedUser.NamedUser ), assignee + assert mentioned is GithubObject.NotSet or isinstance( mentioned, NamedUser.NamedUser ), mentioned + assert labels is GithubObject.NotSet or all( isinstance( element, Label.Label ) for element in labels ), labels assert sort is GithubObject.NotSet or isinstance( sort, ( str, unicode ) ), sort assert direction is GithubObject.NotSet or isinstance( direction, ( str, unicode ) ), direction assert since is GithubObject.NotSet or isinstance( since, ( str, unicode ) ), since url_parameters = dict() if milestone is not GithubObject.NotSet: - url_parameters[ "milestone" ] = milestone + url_parameters[ "milestone" ] = milestone._identity if state is not GithubObject.NotSet: url_parameters[ "state" ] = state if assignee is not GithubObject.NotSet: - url_parameters[ "assignee" ] = assignee + url_parameters[ "assignee" ] = assignee._identity if mentioned is not GithubObject.NotSet: - url_parameters[ "mentioned" ] = mentioned + url_parameters[ "mentioned" ] = mentioned._identity if labels is not GithubObject.NotSet: - url_parameters[ "labels" ] = labels + url_parameters[ "labels" ] = ",".join( label._identity for label in labels ) if sort is not GithubObject.NotSet: url_parameters[ "sort" ] = sort if direction is not GithubObject.NotSet: diff --git a/src/github/Team.py b/src/github/Team.py index 3b9da6e0..8b748d29 100644 --- a/src/github/Team.py +++ b/src/github/Team.py @@ -154,6 +154,10 @@ class Team( GithubObject.GithubObject ): ) self._checkStatus( status, data ) + @property + def _identity( self ): + return self.id + def _initAttributes( self ): self._id = GithubObject.NotSet self._members_count = GithubObject.NotSet diff --git a/test/Organization.py b/test/Organization.py index edd2020a..1df5ef1c 100644 --- a/test/Organization.py +++ b/test/Organization.py @@ -50,7 +50,8 @@ class Organization( Framework.TestCase ): self.assertEqual( team.id, 189850 ) def testCreateTeamWithAllArguments( self ): - team = self.org.create_team( "Team also created by PyGithub", [ "BeaverSoftware/FatherBeaver" ], "push" ) + repo = self.org.get_repo( "FatherBeaver" ) + team = self.org.create_team( "Team also created by PyGithub", [ repo ], "push" ) self.assertEqual( team.id, 189852 ) def testPublicMembers( self ): @@ -90,7 +91,8 @@ class Organization( Framework.TestCase ): self.assertEqual( repo.url, "https://api.github.com/repos/BeaverSoftware/TestPyGithub" ) def testCreateRepoWithAllArguments( self ): - repo = self.org.create_repo( "TestPyGithub2", "Repo created by PyGithub", "http://foobar.com", False, False, False, False, 141496 ) + team = self.org.get_team( 141496 ) + repo = self.org.create_repo( "TestPyGithub2", "Repo created by PyGithub", "http://foobar.com", False, False, False, False, team ) self.assertEqual( repo.url, "https://api.github.com/repos/BeaverSoftware/TestPyGithub2" ) def testCreateFork( self ): diff --git a/test/PullRequest.py b/test/PullRequest.py index 7fccd15d..652bca0f 100644 --- a/test/PullRequest.py +++ b/test/PullRequest.py @@ -3,7 +3,8 @@ import Framework class PullRequest( Framework.TestCase ): def setUp( self ): Framework.TestCase.setUp( self ) - self.pull = self.g.get_user().get_repo( "PyGithub" ).get_pull( 31 ) + self.repo = self.g.get_user().get_repo( "PyGithub" ) + self.pull = self.repo.get_pull( 31 ) def testAttributes( self ): self.assertEqual( self.pull.additions, 511 ) @@ -38,7 +39,8 @@ class PullRequest( Framework.TestCase ): self.assertEqual( self.pull.user.login, "jacquev6" ) def testCreateComment( self ): - comment = self.pull.create_comment( "Comment created by PyGithub", "8a4f306d4b223682dd19410d4a9150636ebe4206", "src/github/Issue.py", 5 ) + commit = self.repo.get_commit( "8a4f306d4b223682dd19410d4a9150636ebe4206" ) + comment = self.pull.create_comment( "Comment created by PyGithub", commit, "src/github/Issue.py", 5 ) self.assertEqual( comment.id, 886298 ) def testGetComments( self ): diff --git a/test/ReplayData/Organization.testCreateRepoWithAllArguments.txt b/test/ReplayData/Organization.testCreateRepoWithAllArguments.txt index f0279d88..00d5971f 100644 --- a/test/ReplayData/Organization.testCreateRepoWithAllArguments.txt +++ b/test/ReplayData/Organization.testCreateRepoWithAllArguments.txt @@ -1,3 +1,8 @@ +GET /teams/141496 {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('x-ratelimit-limit', '5000'), ('content-length', '128'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('etag', '"b93241eaf4384574f38b352b25595e28"'), ('date', 'Fri, 01 Jun 2012 19:35:59 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"repos_count":1,"permission":"push","url":"https://api.github.com/teams/141496","name":"Members","id":141496,"members_count":1} + POST /orgs/BeaverSoftware/repos {'Authorization': 'Basic login_and_password_removed'} {"has_wiki": false, "name": "TestPyGithub2", "has_downloads": false, "private": false, "team_id": 141496, "has_issues": false, "homepage": "http://foobar.com", "description": "Repo created by PyGithub"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4969'), ('content-length', '1501'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"feb513e01eaf8e89967068fe8ed44cc7"'), ('date', 'Sun, 27 May 2012 05:20:43 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/BeaverSoftware/TestPyGithub2')] diff --git a/test/ReplayData/Organization.testCreateTeamWithAllArguments.txt b/test/ReplayData/Organization.testCreateTeamWithAllArguments.txt index 1b88c6eb..75413cb4 100644 --- a/test/ReplayData/Organization.testCreateTeamWithAllArguments.txt +++ b/test/ReplayData/Organization.testCreateTeamWithAllArguments.txt @@ -1,3 +1,8 @@ +GET /repos/BeaverSoftware/FatherBeaver {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4992'), ('content-length', '1431'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"4ecd2c151a469cfa6cd45e6beff1269b"'), ('date', 'Fri, 01 Jun 2012 19:40:56 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"has_downloads":true,"watchers":2,"mirror_url":null,"language":null,"description":"","ssh_url":"git@github.com:BeaverSoftware/FatherBeaver.git","created_at":"2012-02-09T19:32:21Z","url":"https://api.github.com/repos/BeaverSoftware/FatherBeaver","fork":false,"full_name":"BeaverSoftware/FatherBeaver","organization":{"avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","login":"BeaverSoftware","url":"https://api.github.com/users/BeaverSoftware","id":1424031},"permissions":{"admin":true,"pull":true,"push":true},"has_wiki":true,"has_issues":true,"forks":1,"size":0,"svn_url":"https://github.com/BeaverSoftware/FatherBeaver","git_url":"git://github.com/BeaverSoftware/FatherBeaver.git","private":false,"updated_at":"2012-02-16T21:51:15Z","homepage":"","owner":{"avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","login":"BeaverSoftware","url":"https://api.github.com/users/BeaverSoftware","id":1424031},"name":"FatherBeaver","open_issues":0,"html_url":"https://github.com/BeaverSoftware/FatherBeaver","id":3400397,"clone_url":"https://github.com/BeaverSoftware/FatherBeaver.git","pushed_at":null} + POST /orgs/BeaverSoftware/teams {'Authorization': 'Basic login_and_password_removed'} {"repo_names": ["BeaverSoftware/FatherBeaver"], "name": "Team also created by PyGithub", "permission": "push"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4982'), ('content-length', '150'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"6e3fb00de6ca4c112feee3a1438d6f0e"'), ('date', 'Sat, 26 May 2012 21:00:26 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/teams/189852')] diff --git a/test/ReplayData/PullRequest.testCreateComment.txt b/test/ReplayData/PullRequest.testCreateComment.txt index 17db0532..af280a62 100644 --- a/test/ReplayData/PullRequest.testCreateComment.txt +++ b/test/ReplayData/PullRequest.testCreateComment.txt @@ -1,3 +1,8 @@ +GET /repos/jacquev6/PyGithub/commits/8a4f306d4b223682dd19410d4a9150636ebe4206 {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4989'), ('content-length', '19468'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"54236e7f65246e5fdb1122bd461e4a5d"'), ('date', 'Fri, 01 Jun 2012 19:43:25 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","stats":{"additions":131,"total":135,"deletions":4},"files":[{"changes":17,"additions":14,"status":"modified","sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","patch":"@@ -110,7 +110,7 @@ def user( self ):\n return self.__user\n \n def add_to_labels( self, *labels ):\n- post_parameters = labels\n+ post_parameters = [ label.name for label in labels ]\n status, headers, data = self.__requester.request(\n \"POST\",\n str( self.url ) + \"/labels\",\n@@ -131,7 +131,12 @@ def create_comment( self, body ):\n return IssueComment.IssueComment( self.__requester, data, completion = NoCompletion )\n \n def delete_labels( self ):\n- pass\n+ status, headers, data = self.__requester.request(\n+ \"DELETE\",\n+ str( self.url ) + \"/labels\",\n+ None,\n+ None\n+ )\n \n def edit( self, title = DefaultValueForOptionalParameters, body = DefaultValueForOptionalParameters, assignee = DefaultValueForOptionalParameters, state = DefaultValueForOptionalParameters, milestone = DefaultValueForOptionalParameters, labels = DefaultValueForOptionalParameters ):\n post_parameters = {\n@@ -216,7 +221,13 @@ def remove_from_labels( self, label ):\n )\n \n def set_labels( self, *labels ):\n- pass\n+ post_parameters = [ label.name for label in labels ]\n+ status, headers, data = self.__requester.request(\n+ \"PUT\",\n+ str( self.url ) + \"/labels\",\n+ None,\n+ post_parameters\n+ )\n \n def __initAttributes( self ):\n self.__assignee = None","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Issue.py","filename":"src/github/Issue.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Issue.py","deletions":3},{"changes":7,"additions":7,"status":"modified","sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","patch":"@@ -1,6 +1,8 @@\n # WARNING: this file is generated automaticaly.\n # Do not modify it manually, your work would be lost.\n \n+import urllib\n+\n import PaginatedList\n from GithubObject import *\n \n@@ -43,6 +45,11 @@ def edit( self, name, color ):\n )\n self.__useAttributes( data )\n \n+ # @todo Remove '_identity' from the normalized json description\n+ @property\n+ def _identity( self ):\n+ return urllib.quote( self.name )\n+\n def __initAttributes( self ):\n self.__color = None\n self.__name = None","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Label.py","filename":"src/github/Label.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Label.py","deletions":0},{"changes":26,"additions":25,"status":"modified","sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","patch":"@@ -3,7 +3,8 @@\n class Issue( Framework.TestCase ):\r\n def setUp( self ):\r\n Framework.TestCase.setUp( self )\r\n- self.issue = self.g.get_user().get_repo( \"PyGithub\" ).get_issue( 28 )\r\n+ self.repo = self.g.get_user().get_repo( \"PyGithub\" )\r\n+ self.issue = self.repo.get_issue( 28 )\r\n \r\n def testAttributes( self ):\r\n self.assertEqual( self.issue.assignee.login, \"jacquev6\" )\r\n@@ -47,3 +48,26 @@ def testGetComments( self ):\n \r\n def testGetEvents( self ):\r\n self.assertListKeyEqual( self.issue.get_events(), lambda e: e.id, [ 15819975, 15820048 ] )\r\n+\r\n+ def testGetLabels( self ):\r\n+ self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [ \"Bug\", \"Project management\", \"Question\" ] )\r\n+\r\n+ def testAddAndRemoveLabels( self ):\r\n+ bug = self.repo.get_label( \"Bug\" )\r\n+ question = self.repo.get_label( \"Question\" )\r\n+ self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [ \"Bug\", \"Project management\", \"Question\" ] )\r\n+ self.issue.remove_from_labels( bug )\r\n+ self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [ \"Project management\", \"Question\" ] )\r\n+ self.issue.remove_from_labels( question )\r\n+ self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [ \"Project management\" ] )\r\n+ self.issue.add_to_labels( bug, question )\r\n+ self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [ \"Bug\", \"Project management\", \"Question\" ] )\r\n+\r\n+ def testDeleteAndSetLabels( self ):\r\n+ bug = self.repo.get_label( \"Bug\" )\r\n+ question = self.repo.get_label( \"Question\" )\r\n+ self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [ \"Bug\", \"Project management\", \"Question\" ] )\r\n+ self.issue.delete_labels()\r\n+ self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [] )\r\n+ self.issue.set_labels( bug, question )\r\n+ self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [ \"Bug\", \"Question\" ] )\r","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/Issue.py","filename":"test/Issue.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/Issue.py","deletions":1},{"changes":45,"additions":45,"status":"added","sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","patch":"@@ -0,0 +1,45 @@\n+GET /repos/jacquev6/PyGithub/labels/Bug {'Authorization': 'Basic login_and_password_removed'} null\n+200\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4992'), ('content-length', '97'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"569c414d87e8ec43ec269a9e28bc2982\"'), ('date', 'Sun, 27 May 2012 09:04:01 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+{\"color\":\"e10c02\",\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Bug\",\"name\":\"Bug\"}\n+\n+GET /repos/jacquev6/PyGithub/labels/Question {'Authorization': 'Basic login_and_password_removed'} null\n+200\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4991'), ('content-length', '107'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"b659c8dcc1212c71f826547c3cc7ae99\"'), ('date', 'Sun, 27 May 2012 09:04:02 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Question\",\"name\":\"Question\",\"color\":\"02e10c\"}\n+\n+GET /repos/jacquev6/PyGithub/issues/28/labels {'Authorization': 'Basic login_and_password_removed'} null\n+200\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4990'), ('content-length', '335'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"c9f9beccb03030beaf7b80927da6fef6\"'), ('date', 'Sun, 27 May 2012 09:04:03 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+[{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Bug\",\"name\":\"Bug\",\"color\":\"e10c02\"},{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Project+management\",\"name\":\"Project management\",\"color\":\"444444\"},{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Question\",\"name\":\"Question\",\"color\":\"02e10c\"}]\n+\n+DELETE /repos/jacquev6/PyGithub/issues/28/labels/Bug {'Authorization': 'Basic login_and_password_removed'} null\n+200\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4989'), ('content-length', '237'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"46cc70bad88a09b559a5e67089005105\"'), ('date', 'Sun, 27 May 2012 09:04:03 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+[{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Project+management\",\"name\":\"Project management\",\"color\":\"444444\"},{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Question\",\"name\":\"Question\",\"color\":\"02e10c\"}]\n+\n+GET /repos/jacquev6/PyGithub/issues/28/labels {'Authorization': 'Basic login_and_password_removed'} null\n+200\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4988'), ('content-length', '237'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"46cc70bad88a09b559a5e67089005105\"'), ('date', 'Sun, 27 May 2012 09:04:04 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+[{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Project+management\",\"name\":\"Project management\",\"color\":\"444444\"},{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Question\",\"name\":\"Question\",\"color\":\"02e10c\"}]\n+\n+DELETE /repos/jacquev6/PyGithub/issues/28/labels/Question {'Authorization': 'Basic login_and_password_removed'} null\n+200\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4987'), ('content-length', '129'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"5352ae15c8a5a36c6cace63be9367332\"'), ('date', 'Sun, 27 May 2012 09:04:04 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+[{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Project+management\",\"name\":\"Project management\",\"color\":\"444444\"}]\n+\n+GET /repos/jacquev6/PyGithub/issues/28/labels {'Authorization': 'Basic login_and_password_removed'} null\n+200\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4986'), ('content-length', '129'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"5352ae15c8a5a36c6cace63be9367332\"'), ('date', 'Sun, 27 May 2012 09:04:05 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+[{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Project+management\",\"name\":\"Project management\",\"color\":\"444444\"}]\n+\n+POST /repos/jacquev6/PyGithub/issues/28/labels {'Authorization': 'Basic login_and_password_removed'} [\"Bug\", \"Question\"]\n+200\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4985'), ('content-length', '335'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"d135d74d2ea2159d044676a220d41d3a\"'), ('date', 'Sun, 27 May 2012 09:04:06 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+[{\"color\":\"e10c02\",\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Bug\",\"name\":\"Bug\"},{\"color\":\"444444\",\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Project+management\",\"name\":\"Project management\"},{\"color\":\"02e10c\",\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Question\",\"name\":\"Question\"}]\n+\n+GET /repos/jacquev6/PyGithub/issues/28/labels {'Authorization': 'Basic login_and_password_removed'} null\n+200\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4984'), ('content-length', '335'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"c9f9beccb03030beaf7b80927da6fef6\"'), ('date', 'Sun, 27 May 2012 09:04:06 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+[{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Bug\",\"name\":\"Bug\",\"color\":\"e10c02\"},{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Project+management\",\"name\":\"Project management\",\"color\":\"444444\"},{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Question\",\"name\":\"Question\",\"color\":\"02e10c\"}]\n+","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testAddAndRemoveLabels.txt","filename":"test/ReplayData/Issue.testAddAndRemoveLabels.txt","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testAddAndRemoveLabels.txt","deletions":0},{"changes":35,"additions":35,"status":"added","sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","patch":"@@ -0,0 +1,35 @@\n+GET /repos/jacquev6/PyGithub/labels/Bug {'Authorization': 'Basic login_and_password_removed'} null\n+200\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4974'), ('content-length', '97'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"fe2e942523eecb156d100829a6347516\"'), ('date', 'Sun, 27 May 2012 09:06:37 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Bug\",\"name\":\"Bug\",\"color\":\"e10c02\"}\n+\n+GET /repos/jacquev6/PyGithub/labels/Question {'Authorization': 'Basic login_and_password_removed'} null\n+200\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4973'), ('content-length', '107'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"931e58d337b2290717303141eda89cd7\"'), ('date', 'Sun, 27 May 2012 09:06:38 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+{\"color\":\"02e10c\",\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Question\",\"name\":\"Question\"}\n+\n+GET /repos/jacquev6/PyGithub/issues/28/labels {'Authorization': 'Basic login_and_password_removed'} null\n+200\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4972'), ('content-length', '335'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"d135d74d2ea2159d044676a220d41d3a\"'), ('date', 'Sun, 27 May 2012 09:06:39 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+[{\"color\":\"e10c02\",\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Bug\",\"name\":\"Bug\"},{\"color\":\"444444\",\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Project+management\",\"name\":\"Project management\"},{\"color\":\"02e10c\",\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Question\",\"name\":\"Question\"}]\n+\n+DELETE /repos/jacquev6/PyGithub/issues/28/labels {'Authorization': 'Basic login_and_password_removed'} null\n+204\n+[('status', '204 No Content'), ('x-ratelimit-remaining', '4971'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"d41d8cd98f00b204e9800998ecf8427e\"'), ('date', 'Sun, 27 May 2012 09:06:39 GMT')]\n+\n+\n+GET /repos/jacquev6/PyGithub/issues/28/labels {'Authorization': 'Basic login_and_password_removed'} null\n+200\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4970'), ('content-length', '2'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"d751713988987e9331980363e24189ce\"'), ('date', 'Sun, 27 May 2012 09:06:40 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+[]\n+\n+PUT /repos/jacquev6/PyGithub/issues/28/labels {'Authorization': 'Basic login_and_password_removed'} [\"Bug\", \"Question\"]\n+200\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4969'), ('content-length', '207'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"1a56634d9c1050a88592ff55ed8adc62\"'), ('date', 'Sun, 27 May 2012 09:06:40 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+[{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Bug\",\"name\":\"Bug\",\"color\":\"e10c02\"},{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Question\",\"name\":\"Question\",\"color\":\"02e10c\"}]\n+\n+GET /repos/jacquev6/PyGithub/issues/28/labels {'Authorization': 'Basic login_and_password_removed'} null\n+200\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4968'), ('content-length', '207'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"1a56634d9c1050a88592ff55ed8adc62\"'), ('date', 'Sun, 27 May 2012 09:06:41 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+[{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Bug\",\"name\":\"Bug\",\"color\":\"e10c02\"},{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Question\",\"name\":\"Question\",\"color\":\"02e10c\"}]\n+","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testDeleteAndSetLabels.txt","filename":"test/ReplayData/Issue.testDeleteAndSetLabels.txt","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testDeleteAndSetLabels.txt","deletions":0},{"changes":5,"additions":5,"status":"added","sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","patch":"@@ -0,0 +1,5 @@\n+GET /repos/jacquev6/PyGithub/issues/28/labels {'Authorization': 'Basic login_and_password_removed'} null\n+200\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4996'), ('content-length', '335'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"c9f9beccb03030beaf7b80927da6fef6\"'), ('date', 'Sun, 27 May 2012 08:56:31 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+[{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Bug\",\"name\":\"Bug\",\"color\":\"e10c02\"},{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Project+management\",\"name\":\"Project management\",\"color\":\"444444\"},{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Question\",\"name\":\"Question\",\"color\":\"02e10c\"}]\n+","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testGetLabels.txt","filename":"test/ReplayData/Issue.testGetLabels.txt","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testGetLabels.txt","deletions":0}],"parents":[{"sha":"93dcae5cf207de376c91d0599226e7c7563e1d16","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/93dcae5cf207de376c91d0599226e7c7563e1d16"}],"commit":{"tree":{"sha":"fa0251344d6b0b9f69f33c1faf6e3323001b309d","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/fa0251344d6b0b9f69f33c1faf6e3323001b309d"},"message":"Test (and implement) Issue.*_label*\n\nAnd this commit will be used to test PullRequests","url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/8a4f306d4b223682dd19410d4a9150636ebe4206","author":{"email":"vincent@vincent-jacques.net","date":"2012-05-27T02:07:47-07:00","name":"Vincent Jacques"},"committer":{"email":"vincent@vincent-jacques.net","date":"2012-05-27T02:07:47-07:00","name":"Vincent Jacques"}},"author":{"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","url":"https://api.github.com/users/jacquev6","id":327146},"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/8a4f306d4b223682dd19410d4a9150636ebe4206","committer":{"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","url":"https://api.github.com/users/jacquev6","id":327146}} + POST /repos/jacquev6/PyGithub/pulls/31/comments {'Authorization': 'Basic login_and_password_removed'} {"body": "Comment created by PyGithub", "commit_id": "8a4f306d4b223682dd19410d4a9150636ebe4206", "position": 5, "path": "src/github/Issue.py"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4953'), ('content-length', '937'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"7ca841d45253326d61bee20c809872dc"'), ('date', 'Sun, 27 May 2012 09:40:12 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/pulls/comments/886298')] diff --git a/test/ReplayData/Repository.testCreateGitCommit.txt b/test/ReplayData/Repository.testCreateGitCommit.txt index 3058f493..a44ac5cc 100644 --- a/test/ReplayData/Repository.testCreateGitCommit.txt +++ b/test/ReplayData/Repository.testCreateGitCommit.txt @@ -1,3 +1,8 @@ +GET /repos/jacquev6/PyGithub/git/trees/107139a922f33bab6fbeb9f9eb8787e7f19e0528 {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '381'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"f33782d7031ff19c5301bb52068533cf"'), ('date', 'Fri, 01 Jun 2012 20:02:40 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/107139a922f33bab6fbeb9f9eb8787e7f19e0528","sha":"107139a922f33bab6fbeb9f9eb8787e7f19e0528","tree":[{"type":"blob","url":"https://api.github.com/repos/jacquev6/PyGithub/git/blobs/5dd930f591cd5188e9ea7200e308ad355182a1d8","sha":"5dd930f591cd5188e9ea7200e308ad355182a1d8","size":0,"path":"Barbaz.txt","mode":"100644"}]} + POST /repos/jacquev6/PyGithub/git/commits {'Authorization': 'Basic login_and_password_removed'} {"parents": [], "message": "Commit created by PyGithub", "tree": "107139a922f33bab6fbeb9f9eb8787e7f19e0528"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4931'), ('content-length', '601'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"7719e5a3f5b064dc0871853dba33302b"'), ('date', 'Sun, 27 May 2012 05:50:59 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/git/commits/0b820628236ab8bab3890860fc414fa757ca15f4')] diff --git a/test/ReplayData/Repository.testCreateGitCommitWithAllArguments.txt b/test/ReplayData/Repository.testCreateGitCommitWithAllArguments.txt index 93f3aec4..b8923589 100644 --- a/test/ReplayData/Repository.testCreateGitCommitWithAllArguments.txt +++ b/test/ReplayData/Repository.testCreateGitCommitWithAllArguments.txt @@ -1,3 +1,8 @@ +GET /repos/jacquev6/PyGithub/git/trees/107139a922f33bab6fbeb9f9eb8787e7f19e0528 {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '381'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"f33782d7031ff19c5301bb52068533cf"'), ('date', 'Fri, 01 Jun 2012 20:02:40 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/107139a922f33bab6fbeb9f9eb8787e7f19e0528","sha":"107139a922f33bab6fbeb9f9eb8787e7f19e0528","tree":[{"type":"blob","url":"https://api.github.com/repos/jacquev6/PyGithub/git/blobs/5dd930f591cd5188e9ea7200e308ad355182a1d8","sha":"5dd930f591cd5188e9ea7200e308ad355182a1d8","size":0,"path":"Barbaz.txt","mode":"100644"}]} + POST /repos/jacquev6/PyGithub/git/commits {'Authorization': 'Basic login_and_password_removed'} {"parents": [], "message": "Commit created by PyGithub", "tree": "107139a922f33bab6fbeb9f9eb8787e7f19e0528", "committer": {"date": "2008-07-09T16:13:30+12:00", "name": "John Doe", "email": "j.doe@vincent-jacques.net"}, "author": {"date": "2008-07-09T16:13:30+12:00", "name": "John Doe", "email": "j.doe@vincent-jacques.net"}} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4928'), ('content-length', '577'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"660cc851cdd42a2caa7241cd96db0d01"'), ('date', 'Sun, 27 May 2012 05:53:47 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/git/commits/526946197ae9da59c6507cacd13ad6f1cfb686ea')] diff --git a/test/ReplayData/Repository.testCreateGitCommitWithParents.txt b/test/ReplayData/Repository.testCreateGitCommitWithParents.txt index 78f14a58..21c247c8 100644 --- a/test/ReplayData/Repository.testCreateGitCommitWithParents.txt +++ b/test/ReplayData/Repository.testCreateGitCommitWithParents.txt @@ -8,6 +8,11 @@ GET /repos/jacquev6/PyGithub/git/commits/12d427464f8d91c8e981043a86ba8a2a9e7319e [('status', '200 OK'), ('x-ratelimit-remaining', '4966'), ('content-length', '769'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"87d790f22e47dbaa3148ad7872e32dde"'), ('date', 'Fri, 01 Jun 2012 18:39:30 GMT'), ('content-type', 'application/json; charset=utf-8')] {"tree":{"sha":"143dd39e465e5de953d944c9309b961af392da73","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/143dd39e465e5de953d944c9309b961af392da73"},"sha":"12d427464f8d91c8e981043a86ba8a2a9e7319ea","message":"Remove the notion of ImmediateCompletion\n","parents":[{"sha":"7a622975d6a3f0ab80f573f577aa0e3ffb69e2f5","url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/7a622975d6a3f0ab80f573f577aa0e3ffb69e2f5"}],"author":{"email":"vincent@vincent-jacques.net","date":"2012-05-30T09:51:36-07:00","name":"Vincent Jacques"},"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/12d427464f8d91c8e981043a86ba8a2a9e7319ea","committer":{"email":"vincent@vincent-jacques.net","date":"2012-05-30T10:00:37-07:00","name":"Vincent Jacques"}} +GET /repos/jacquev6/PyGithub/git/trees/fae707821159639589bf94f3fb0a7154ec5d441b {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '381'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"f33782d7031ff19c5301bb52068533cf"'), ('date', 'Fri, 01 Jun 2012 20:02:40 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/fae707821159639589bf94f3fb0a7154ec5d441b","sha":"fae707821159639589bf94f3fb0a7154ec5d441b","tree":[{"type":"blob","url":"https://api.github.com/repos/jacquev6/PyGithub/git/blobs/5dd930f591cd5188e9ea7200e308ad355182a1d8","sha":"5dd930f591cd5188e9ea7200e308ad355182a1d8","size":0,"path":"Barbaz.txt","mode":"100644"}]} + POST /repos/jacquev6/PyGithub/git/commits {'Authorization': 'Basic login_and_password_removed'} {"parents": ["7248e66831d4ffe09ef1f30a1df59ec0a9331ece", "12d427464f8d91c8e981043a86ba8a2a9e7319ea"], "message": "Commit created by PyGithub", "tree": "fae707821159639589bf94f3fb0a7154ec5d441b"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4965'), ('content-length', '918'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"1ada1e7861f74fa4fefa922bf03e891e"'), ('date', 'Fri, 01 Jun 2012 18:39:31 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/git/commits/6adf9ea25ff8a8f2a42bcb1c09e42526339037cd')] diff --git a/test/ReplayData/Repository.testCreateGitTreeWithBaseTree.txt b/test/ReplayData/Repository.testCreateGitTreeWithBaseTree.txt index a41817ee..5e6c6323 100644 --- a/test/ReplayData/Repository.testCreateGitTreeWithBaseTree.txt +++ b/test/ReplayData/Repository.testCreateGitTreeWithBaseTree.txt @@ -1,3 +1,8 @@ +GET /repos/jacquev6/PyGithub/git/trees/41cf8c178c636a018d537cb20daae09391efd70b {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '381'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"f33782d7031ff19c5301bb52068533cf"'), ('date', 'Fri, 01 Jun 2012 20:02:40 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/41cf8c178c636a018d537cb20daae09391efd70b","sha":"41cf8c178c636a018d537cb20daae09391efd70b","tree":[{"type":"blob","url":"https://api.github.com/repos/jacquev6/PyGithub/git/blobs/5dd930f591cd5188e9ea7200e308ad355182a1d8","sha":"5dd930f591cd5188e9ea7200e308ad355182a1d8","size":0,"path":"Barbaz.txt","mode":"100644"}]} + POST /repos/jacquev6/PyGithub/git/trees {'Authorization': 'Basic login_and_password_removed'} {"tree": [{"content": "File also created by PyGithub", "path": "Barbaz.txt", "type": "blob", "mode": "100644"}], "base_tree": "41cf8c178c636a018d537cb20daae09391efd70b"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4934'), ('content-length', '599'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"f04d90b327eaf7b7600bc22fd11a41a4"'), ('date', 'Sun, 27 May 2012 05:49:48 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/git/trees/107139a922f33bab6fbeb9f9eb8787e7f19e0528')] diff --git a/test/ReplayData/Repository.testCreateIssueWithAllArguments.txt b/test/ReplayData/Repository.testCreateIssueWithAllArguments.txt index 1858b6fa..ac9d7aa9 100644 --- a/test/ReplayData/Repository.testCreateIssueWithAllArguments.txt +++ b/test/ReplayData/Repository.testCreateIssueWithAllArguments.txt @@ -1,3 +1,18 @@ +GET /users/jacquev6 {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4991'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"0c1724d7560338bc2f2579af6e8ec545"'), ('date', 'Fri, 01 Jun 2012 20:09:23 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"owned_private_repos":5,"type":"User","company":"Criteo","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"jacquev6","email":"vincent@vincent-jacques.net","hireable":false,"public_gists":3,"created_at":"2010-07-09T06:10:06Z","location":"Paris, France","bio":"","url":"https://api.github.com/users/jacquev6","following":24,"private_gists":5,"public_repos":10,"blog":"http://vincent-jacques.net","disk_usage":16900,"name":"Vincent Jacques","total_private_repos":5,"collaborators":0,"followers":13,"html_url":"https://github.com/jacquev6","id":327146,"plan":{"private_repos":5,"space":614400,"name":"micro","collaborators":1}} + +GET /repos/jacquev6/PyGithub/milestones/2 {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4990'), ('content-length', '899'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"5fc4dbe5fd444fd2ea9f90c698b432cf"'), ('date', 'Fri, 01 Jun 2012 20:09:24 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"title":"Version 1.0: coherent public interface","creator":{"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","url":"https://api.github.com/users/jacquev6","id":327146,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"created_at":"2012-03-08T12:22:28Z","state":"open","description":"Heavy rewrite to have:\r\n* a fully coherent public interface\r\n* usable stack-traces in case of exception\r\n* more explicit exceptions\r\n* more readable code (for library exploration, auto-completion in IDEs, etc.)\r\n\r\nSee working branch https://github.com/jacquev6/PyGithub/tree/topic/RewriteWithGeneratedCode","url":"https://api.github.com/repos/jacquev6/PyGithub/milestones/2","closed_issues":13,"due_on":"2012-06-04T07:00:00Z","open_issues":6,"number":2,"id":93547} + +GET /repos/jacquev6/PyGithub/labels/Question {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4989'), ('content-length', '107'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"931e58d337b2290717303141eda89cd7"'), ('date', 'Fri, 01 Jun 2012 20:09:25 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"color":"02e10c","url":"https://api.github.com/repos/jacquev6/PyGithub/labels/Question","name":"Question"} + POST /repos/jacquev6/PyGithub/issues {'Authorization': 'Basic login_and_password_removed'} {"body": "Body created by PyGithub", "assignee": "jacquev6", "labels": ["Question"], "milestone": 2, "title": "Issue also created by PyGithub"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4943'), ('content-length', '2069'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"d131a11b793937127bf7d0ce56e2805e"'), ('date', 'Sun, 27 May 2012 05:40:15 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/issues/30')] diff --git a/test/ReplayData/Repository.testCreatePullFromIssue.txt b/test/ReplayData/Repository.testCreatePullFromIssue.txt index 931770c1..139cc71c 100644 --- a/test/ReplayData/Repository.testCreatePullFromIssue.txt +++ b/test/ReplayData/Repository.testCreatePullFromIssue.txt @@ -1,3 +1,8 @@ +GET /repos/jacquev6/PyGithub/issues/32 {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4986'), ('content-length', '2141'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"f88aca2b371ce28f651166ed9c5a2525"'), ('date', 'Fri, 01 Jun 2012 20:10:41 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"title":"Creation of a pull request from an issue is not covered by integration tests","pull_request":{"diff_url":"https://github.com/jacquev6/PyGithub/pull/32.diff","patch_url":"https://github.com/jacquev6/PyGithub/pull/32.patch","html_url":"https://github.com/jacquev6/PyGithub/pull/32"},"labels":[],"created_at":"2012-05-27T10:55:12Z","state":"closed","user":{"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","url":"https://api.github.com/users/jacquev6","id":327146,"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/repos/jacquev6/PyGithub/issues/32","assignee":null,"closed_at":"2012-05-27T11:03:53Z","updated_at":"2012-05-27T11:03:53Z","body":"","comments":0,"number":32,"id":4770481,"html_url":"https://github.com/jacquev6/PyGithub/issues/32","closed_by":{"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","url":"https://api.github.com/users/jacquev6","id":327146,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"milestone":{"title":"Version 1.0: coherent public interface","creator":{"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","url":"https://api.github.com/users/jacquev6","id":327146,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"created_at":"2012-03-08T12:22:28Z","state":"open","description":"Heavy rewrite to have:\r\n* a fully coherent public interface\r\n* usable stack-traces in case of exception\r\n* more explicit exceptions\r\n* more readable code (for library exploration, auto-completion in IDEs, etc.)\r\n\r\nSee working branch https://github.com/jacquev6/PyGithub/tree/topic/RewriteWithGeneratedCode","url":"https://api.github.com/repos/jacquev6/PyGithub/milestones/2","closed_issues":13,"due_on":"2012-06-04T07:00:00Z","open_issues":6,"number":2,"id":93547}} + POST /repos/jacquev6/PyGithub/pulls {'Authorization': 'Basic login_and_password_removed'} {"head": "BeaverSoftware:master", "base": "topic/RewriteWithGeneratedCode", "issue": 32} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4933'), ('content-length', '4501'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"2b035f5260fe63dd611156fea3049af0"'), ('date', 'Sun, 27 May 2012 10:58:42 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/pulls/32')] diff --git a/test/ReplayData/Repository.testGetIssuesWithArguments.txt b/test/ReplayData/Repository.testGetIssuesWithArguments.txt index cbe36b50..4d1917e8 100644 --- a/test/ReplayData/Repository.testGetIssuesWithArguments.txt +++ b/test/ReplayData/Repository.testGetIssuesWithArguments.txt @@ -1,3 +1,23 @@ +GET /repos/jacquev6/PyGithub/milestones/3 {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4986'), ('content-length', '577'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"aefd46b78a992c1eb76e6bb49c45be7c"'), ('date', 'Fri, 01 Jun 2012 19:52:57 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"title":"Version 0.5: full implementation","creator":{"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","url":"https://api.github.com/users/jacquev6","id":327146},"created_at":"2012-03-12T21:38:36Z","state":"closed","description":"","url":"https://api.github.com/repos/jacquev6/PyGithub/milestones/3","closed_issues":4,"due_on":"2012-03-20T07:00:00Z","open_issues":0,"number":3,"id":95354} + +GET /users/jacquev6 {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4985'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"7ce1335565832b7bdbe43916a0724156"'), ('date', 'Fri, 01 Jun 2012 19:52:57 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"type":"User","bio":"","collaborators":0,"company":"Criteo","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","total_private_repos":5,"email":"vincent@vincent-jacques.net","owned_private_repos":5,"created_at":"2010-07-09T06:10:06Z","location":"Paris, France","url":"https://api.github.com/users/jacquev6","following":24,"public_gists":3,"disk_usage":16900,"public_repos":10,"private_gists":5,"name":"Vincent Jacques","blog":"http://vincent-jacques.net","followers":13,"html_url":"https://github.com/jacquev6","hireable":false,"id":327146,"plan":{"private_repos":5,"collaborators":1,"space":614400,"name":"micro"},"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"} + +GET /users/Lyloa {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4984'), ('content-length', '554'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"73f74c6f88d8578cb44a6c29b1e2ee8e"'), ('date', 'Fri, 01 Jun 2012 19:52:58 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"type":"User","blog":null,"company":null,"gravatar_id":"1517ed584458ccf83e03f5d77d9699d7","login":"Lyloa","email":"nyu@lyloa.net","avatar_url":"https://secure.gravatar.com/avatar/1517ed584458ccf83e03f5d77d9699d7?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","public_repos":0,"created_at":"2011-10-16T14:36:46Z","location":"Paris","url":"https://api.github.com/users/Lyloa","following":0,"hireable":false,"name":"Lyloa","public_gists":0,"followers":1,"html_url":"https://github.com/Lyloa","bio":null,"id":1131432} + +GET /repos/jacquev6/PyGithub/labels/Bug {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4997'), ('content-length', '97'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"569c414d87e8ec43ec269a9e28bc2982"'), ('date', 'Fri, 01 Jun 2012 19:56:30 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"color":"e10c02","url":"https://api.github.com/repos/jacquev6/PyGithub/labels/Bug","name":"Bug"} + GET /repos/jacquev6/PyGithub/issues?state=closed&milestone=3 {'Authorization': 'Basic login_and_password_removed'} null 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4868'), ('content-length', '6944'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"5c472a7784b7cd933a35e2bb0ce5df38"'), ('date', 'Tue, 29 May 2012 18:39:43 GMT'), ('content-type', 'application/json; charset=utf-8')] diff --git a/test/Repository.py b/test/Repository.py index 8ca217aa..7e206447 100644 --- a/test/Repository.py +++ b/test/Repository.py @@ -66,7 +66,10 @@ class Repository( Framework.TestCase ): self.assertEqual( issue.number, 28 ) def testCreateIssueWithAllArguments( self ): - issue = self.repo.create_issue( "Issue also created by PyGithub", "Body created by PyGithub", "jacquev6", 2, [ "Question" ] ) + user = self.g.get_user( "jacquev6" ) + milestone = self.repo.get_milestone( 2 ) + question = self.repo.get_label( "Question" ) + issue = self.repo.create_issue( "Issue also created by PyGithub", "Body created by PyGithub", user, milestone, [ question ] ) self.assertEqual( issue.number, 30 ) def testCreateLabel( self ): @@ -137,6 +140,7 @@ class Repository( Framework.TestCase ): self.assertEqual( tree.sha, "41cf8c178c636a018d537cb20daae09391efd70b" ) def testCreateGitTreeWithBaseTree( self ): + base_tree = self.repo.get_git_tree( "41cf8c178c636a018d537cb20daae09391efd70b" ) tree = self.repo.create_git_tree( [ github.InputGitTreeElement( "Barbaz.txt", @@ -144,7 +148,7 @@ class Repository( Framework.TestCase ): "blob", content = "File also created by PyGithub" ) ], - "41cf8c178c636a018d537cb20daae09391efd70b" + base_tree ) self.assertEqual( tree.sha, "107139a922f33bab6fbeb9f9eb8787e7f19e0528" ) @@ -160,7 +164,8 @@ class Repository( Framework.TestCase ): self.assertEqual( tree.sha, "fae707821159639589bf94f3fb0a7154ec5d441b" ) def testCreateGitCommit( self ): - commit = self.repo.create_git_commit( "Commit created by PyGithub", "107139a922f33bab6fbeb9f9eb8787e7f19e0528", [] ) + tree = self.repo.get_git_tree( "107139a922f33bab6fbeb9f9eb8787e7f19e0528" ) + commit = self.repo.create_git_commit( "Commit created by PyGithub", tree, [] ) self.assertEqual( commit.sha, "0b820628236ab8bab3890860fc414fa757ca15f4" ) def testCreateGitCommitWithParents( self ): @@ -168,11 +173,13 @@ class Repository( Framework.TestCase ): self.repo.get_git_commit( "7248e66831d4ffe09ef1f30a1df59ec0a9331ece" ), self.repo.get_git_commit( "12d427464f8d91c8e981043a86ba8a2a9e7319ea" ), ] - commit = self.repo.create_git_commit( "Commit created by PyGithub", "fae707821159639589bf94f3fb0a7154ec5d441b", parents ) + tree = self.repo.get_git_tree( "fae707821159639589bf94f3fb0a7154ec5d441b" ) + commit = self.repo.create_git_commit( "Commit created by PyGithub", tree, parents ) self.assertEqual( commit.sha, "6adf9ea25ff8a8f2a42bcb1c09e42526339037cd" ) def testCreateGitCommitWithAllArguments( self ): - commit = self.repo.create_git_commit( "Commit created by PyGithub", "107139a922f33bab6fbeb9f9eb8787e7f19e0528", [], github.InputGitAuthor( "John Doe", "j.doe@vincent-jacques.net", "2008-07-09T16:13:30+12:00" ), github.InputGitAuthor( "John Doe", "j.doe@vincent-jacques.net", "2008-07-09T16:13:30+12:00" ) ) + tree = self.repo.get_git_tree( "107139a922f33bab6fbeb9f9eb8787e7f19e0528" ) + commit = self.repo.create_git_commit( "Commit created by PyGithub", tree, [], github.InputGitAuthor( "John Doe", "j.doe@vincent-jacques.net", "2008-07-09T16:13:30+12:00" ), github.InputGitAuthor( "John Doe", "j.doe@vincent-jacques.net", "2008-07-09T16:13:30+12:00" ) ) self.assertEqual( commit.sha, "526946197ae9da59c6507cacd13ad6f1cfb686ea" ) def testCreateGitTag( self ): @@ -253,11 +260,15 @@ class Repository( Framework.TestCase ): self.assertListKeyEqual( self.repo.get_issues(), lambda i: i.id, [ 4769659, 4639931, 4452000, 4356743, 3716033, 3715946, 3643837, 3628022, 3624595, 3624570, 3624561, 3624556, 3619973, 3527266, 3527245, 3527231 ] ) def testGetIssuesWithArguments( self ): - self.assertListKeyEqual( self.repo.get_issues( 3, "closed" ), lambda i: i.id, [ 3624472, 3620132, 3619658, 3561926 ] ) - self.assertListKeyEqual( self.repo.get_issues( labels = "Bug" ), lambda i: i.id, [ 4780155 ] ) - self.assertListKeyEqual( self.repo.get_issues( assignee = "jacquev6", sort = "comments", direction = "asc" ), lambda i: i.id, [ 4793106, 3527231, 3527266, 3624556, 4793216, 3619973, 3624595, 4452000, 3643837, 3628022, 3527245, 4793162, 4356743, 4780155 ] ) + milestone = self.repo.get_milestone( 3 ) + user = self.g.get_user( "jacquev6" ) + otherUser = self.g.get_user( "Lyloa" ) + bug = self.repo.get_label( "Bug" ) + self.assertListKeyEqual( self.repo.get_issues( milestone, "closed" ), lambda i: i.id, [ 3624472, 3620132, 3619658, 3561926 ] ) + self.assertListKeyEqual( self.repo.get_issues( labels = [ bug ] ), lambda i: i.id, [ 4780155 ] ) + self.assertListKeyEqual( self.repo.get_issues( assignee = user, sort = "comments", direction = "asc" ), lambda i: i.id, [ 4793106, 3527231, 3527266, 3624556, 4793216, 3619973, 3624595, 4452000, 3643837, 3628022, 3527245, 4793162, 4356743, 4780155 ] ) self.assertListKeyEqual( self.repo.get_issues( since = "2012-05-28T23:00:00Z" ), lambda i: i.id, [ 4793216, 4793162, 4793106, 3624556, 3619973, 3527266 ] ) - self.assertListKeyEqual( self.repo.get_issues( mentioned = "Lyloa" ), lambda i: i.id, [ 4793162 ] ) + self.assertListKeyEqual( self.repo.get_issues( mentioned = otherUser ), lambda i: i.id, [ 4793162 ] ) def testGetKeys( self ): self.assertListKeyEqual( self.repo.get_keys(), lambda k: k.title, [ "Key added through PyGithub" ] ) @@ -292,7 +303,8 @@ class Repository( Framework.TestCase ): self.assertEqual( pull.id, 1436215 ) def testCreatePullFromIssue( self ): - pull = self.repo.create_pull( 32, "topic/RewriteWithGeneratedCode", "BeaverSoftware:master" ) + issue = self.repo.get_issue( 32 ) + pull = self.repo.create_pull( issue, "topic/RewriteWithGeneratedCode", "BeaverSoftware:master" ) self.assertEqual( pull.id, 1436310 ) def testGetPulls( self ):