mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Test Issue.getComments
This commit is contained in:
@@ -1238,6 +1238,7 @@
|
||||
{ "name": "description", "type": "string" },
|
||||
{ "name": "fork", "type": "bool" },
|
||||
{ "name": "forks", "type": "integer" },
|
||||
{ "name": "full_name", "type": "string" },
|
||||
{ "name": "git_url", "type": "string" },
|
||||
{ "name": "has_downloads", "type": "bool" },
|
||||
{ "name": "has_issues", "type": "bool" },
|
||||
|
||||
@@ -7140,6 +7140,14 @@
|
||||
},
|
||||
"name": "forks"
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"simple": true,
|
||||
"cardinality": "scalar",
|
||||
"name": "string"
|
||||
},
|
||||
"name": "full_name"
|
||||
},
|
||||
{
|
||||
"type": {
|
||||
"simple": true,
|
||||
|
||||
@@ -944,6 +944,7 @@ Attributes
|
||||
* `description`: string
|
||||
* `fork`: bool
|
||||
* `forks`: integer
|
||||
* `full_name`: string
|
||||
* `git_url`: string
|
||||
* `has_downloads`: bool
|
||||
* `has_issues`: bool
|
||||
|
||||
@@ -63,6 +63,11 @@ class Repository( object ):
|
||||
self.__completeIfNeeded( self.__forks )
|
||||
return self.__forks
|
||||
|
||||
@property
|
||||
def full_name( self ):
|
||||
self.__completeIfNeeded( self.__full_name )
|
||||
return self.__full_name
|
||||
|
||||
@property
|
||||
def git_url( self ):
|
||||
self.__completeIfNeeded( self.__git_url )
|
||||
@@ -854,6 +859,7 @@ class Repository( object ):
|
||||
self.__description = None
|
||||
self.__fork = None
|
||||
self.__forks = None
|
||||
self.__full_name = None
|
||||
self.__git_url = None
|
||||
self.__has_downloads = None
|
||||
self.__has_issues = None
|
||||
@@ -897,7 +903,7 @@ class Repository( object ):
|
||||
def __useAttributes( self, attributes ):
|
||||
# @todo Remove this debug weakness: we shall assume that github will add new attributes
|
||||
for attribute in attributes:
|
||||
assert attribute in [ "clone_url", "created_at", "description", "fork", "forks", "git_url", "has_downloads", "has_issues", "has_wiki", "homepage", "html_url", "id", "language", "master_branch", "mirror_url", "name", "open_issues", "organization", "owner", "parent", "permissions", "private", "pushed_at", "size", "source", "ssh_url", "svn_url", "updated_at", "url", "watchers", ], attribute
|
||||
assert attribute in [ "clone_url", "created_at", "description", "fork", "forks", "full_name", "git_url", "has_downloads", "has_issues", "has_wiki", "homepage", "html_url", "id", "language", "master_branch", "mirror_url", "name", "open_issues", "organization", "owner", "parent", "permissions", "private", "pushed_at", "size", "source", "ssh_url", "svn_url", "updated_at", "url", "watchers", ], attribute
|
||||
# @todo No need to check if attribute is in attributes when attribute is mandatory
|
||||
if "clone_url" in attributes and attributes[ "clone_url" ] is not None:
|
||||
assert isinstance( attributes[ "clone_url" ], ( str, unicode ) )
|
||||
@@ -914,6 +920,9 @@ class Repository( object ):
|
||||
if "forks" in attributes and attributes[ "forks" ] is not None:
|
||||
assert isinstance( attributes[ "forks" ], int )
|
||||
self.__forks = attributes[ "forks" ]
|
||||
if "full_name" in attributes and attributes[ "full_name" ] is not None:
|
||||
assert isinstance( attributes[ "full_name" ], ( str, unicode ) )
|
||||
self.__full_name = attributes[ "full_name" ]
|
||||
if "git_url" in attributes and attributes[ "git_url" ] is not None:
|
||||
assert isinstance( attributes[ "git_url" ], ( str, unicode ) )
|
||||
self.__git_url = attributes[ "git_url" ]
|
||||
|
||||
@@ -107,6 +107,10 @@ class Issue( Framework.TestCaseWithRepo ):
|
||||
comment = self.repo.get_issue( 28 ).get_comment( 5808311 )
|
||||
comment.delete()
|
||||
|
||||
def testComments( self ):
|
||||
comment = self.repo.get_issue( 24 ).get_comments()[ 0 ]
|
||||
self.assertEqual( comment.user.login, "jacquev6" )
|
||||
|
||||
def testEvents( self ):
|
||||
event = self.repo.get_issue( 28 ).get_events()[ 0 ]
|
||||
self.assertEqual( event.actor.login, "jacquev6" )
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
GET /repos/jacquev6/PyGithub/issues/24 {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4985'), ('content-length', '2945'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"bd0bf26024bb20283dc017ee0099a60a"'), ('date', 'Sat, 26 May 2012 09:43:02 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"updated_at":"2012-05-04T19:23:57Z","body":"Thanks for PyGithub, it is easy to use and very complete. I just successfully used it to convert Trac tickets to Guthub issues.\r\n\r\nBut I had to learn the hard way that `create_issue()` expectes the milestone as number instead of a title. To track this down, I added the following `print` statement to `Requester.py`:\r\n\r\n```python\r\ndef __statusCheckedRequest( self, verb, url, parameters, input ):\r\n status, headers, output = self.__rawRequest( verb, url, parameters, input )\r\n if status < 200 or status >= 300:\r\n print output # <--- Added by me.\r\n raise UnknownGithubObject() # <--- sadly lacks any error details\r\n return headers, output\r\n```\r\n\r\nAs `output` already contains all the information needed (as JSON dump), it would be helpful if the exception raised here would include this information in the exception message.","url":"https://api.github.com/repos/jacquev6/PyGithub/issues/24","comments":2,"milestone":{"closed_issues":2,"creator":{"url":"https://api.github.com/users/jacquev6","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","id":327146},"url":"https://api.github.com/repos/jacquev6/PyGithub/milestones/2","number":2,"title":"Version 1.0: coherent public interface","due_on":"2012-06-04T07:00:00Z","open_issues":9,"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","id":93547},"number":24,"closed_by":null,"assignee":{"url":"https://api.github.com/users/jacquev6","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","id":327146},"closed_at":null,"title":"Improve error messages on broken requests","labels":[{"url":"https://api.github.com/repos/jacquev6/PyGithub/labels/Public+interface","name":"Public interface","color":"d7e102"}],"created_at":"2012-04-30T20:01:20Z","state":"open","user":{"url":"https://api.github.com/users/roskakori","avatar_url":"https://secure.gravatar.com/avatar/b58d0f1ea06b8d5de5f02c53f747ac03?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b58d0f1ea06b8d5de5f02c53f747ac03","login":"roskakori","id":328726},"id":4356743,"pull_request":{"patch_url":null,"diff_url":null,"html_url":null},"html_url":"https://github.com/jacquev6/PyGithub/issues/24"}
|
||||
|
||||
GET /repos/jacquev6/PyGithub/issues/24/comments {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4984'), ('content-length', '1820'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"bab5fb77d873847d153979f7fcd7e0f1"'), ('date', 'Sat, 26 May 2012 09:43:03 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
[{"user":{"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","url":"https://api.github.com/users/jacquev6","login":"jacquev6","id":327146},"updated_at":"2012-05-01T22:03:59Z","body":"Thank you for the suggestion. It's somehow related to https://github.com/jacquev6/PyGithub/issues/6, even if I have not described it in details.\r\n\r\nI'm currently doing a very deep rewrite, which will lead to much more readable stack traces in case of exceptions, and I will include more details about the error. I may also be able to detect type errors *before* sending the request to github.\r\n\r\nBy the way, I'm very glad to hear that you have solved a real-life use case using PyGithub :-)","url":"https://api.github.com/repos/jacquev6/PyGithub/issues/comments/5449237","id":5449237,"created_at":"2012-05-01T22:03:59Z"},{"user":{"gravatar_id":"b58d0f1ea06b8d5de5f02c53f747ac03","avatar_url":"https://secure.gravatar.com/avatar/b58d0f1ea06b8d5de5f02c53f747ac03?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/roskakori","login":"roskakori","id":328726},"updated_at":"2012-05-04T19:23:57Z","body":"Good to hear you are already working on this in #6, so I suppose this can be tagged as duplicate and be closed.\r\n\r\nBTW, I cleaned up my script to convert Trac tickets to Github issues and uploaded it to PyPI: http://pypi.python.org/pypi/tratihubis/. It seems that at least some people find it useful, so hopefully it helps to popularize PyGithub a little.","url":"https://api.github.com/repos/jacquev6/PyGithub/issues/comments/5518272","id":5518272,"created_at":"2012-05-04T19:23:57Z"}]
|
||||
|
||||
Reference in New Issue
Block a user