diff --git a/.gitignore b/.gitignore index 3af5a479..55cb5a84 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.pyc GithubCredentials.py -.coverage -/dist +/dist/ +/build/ /MANIFEST -/test/htmlcov/ +/PyGithub.egg-info/ +/.coverage diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..c2b4ea26 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +language: python +python: + - "2.7" + - "2.6" + - "2.5" + - "3.1" + - "3.2" +install: + - if [ $TRAVIS_PYTHON_VERSION == '2.5' ]; then pip install -r python25-requirements.txt --use-mirrors; fi +script: + - python setup.py test diff --git a/Contributing.md b/Contributing.md new file mode 100644 index 00000000..73004a5a --- /dev/null +++ b/Contributing.md @@ -0,0 +1,20 @@ +Issues +====== + +A good issue includes a [short, self contained, correct example](http://sscce.org/) of the problem, something like: + + assert github.Github().get_user("jacquev6").name == "Vincent Jacques" + +It is even better if you provide the debug logs associated with your issue. +Enable them with `github.enable_console_debug_logging()` and copy them in the body of the issue. +Warning, you may want to remove some private information (authentication information is removed, but there may be private stuff in the messages) + +If for any reason you are not able to do that, open your issue anyway and we will see what is needed to solve your problem. + +Pull requests +============= + +Please do your pull requests on the `develop` branch. + +PyGithub follows [pep8 Style Guide for Python Code](http://www.python.org/dev/peps/pep-0008/) except for line length. +So if you do heavy modifications, please check your code with [pep8 Python style guide checker](http://pypi.python.org/pypi/pep8), by running `pep8 --ignore=E501 github`. diff --git a/ReadMe.md b/ReadMe.md index 1fc3eacf..5ef5074a 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1,4 +1,4 @@ -This is a Python library to access the [Github API v3](http://developer.github.com/v3). +This is a Python (2 and 3) library to access the [Github API v3](http://developer.github.com/v3). With it, you can manage your [Github](http://github.com) resources (repositories, user profiles, organizations, etc.) from Python scripts. @@ -11,14 +11,33 @@ PyGithub is stable. I will maintain it up to date with the API, and fix bugs if What's new? =========== -[Version 1.7](https://github.com/jacquev6/PyGithub/issues?milestone=12&state=closed) (September 12th, 2012) ------------------------------------------------------------------------------------------------------------ +[![Build Status](https://secure.travis-ci.org/jacquev6/PyGithub.png)](http://travis-ci.org/jacquev6/PyGithub) -* Be able to clear the assignee and the milestone of an Issue. Thank you [quixotique](https://github.com/quixotique) for the merge request -* Fix an AssertionFailure in `Organization.get_xxx` when using Github Enterprise. Thank you [mnsanghvi](https://github.com/mnsanghvi) for pointing that -* Expose pagination to users needing it (`PaginatedList.get_page`). Thank you [kukuts](https://github.com/kukuts) for asking -* Improve handling of legacy search APIs -* Small refactoring (documentation, removal of old code generation artifacts) +Next version +------------ + +* Major improvement: support Python 3! PyGithub is automaticaly tested on [Travis](http://travis-ci.org/jacquev6/PyGithub) with versions 2.5, 2.6, 2.7, 3.1 and 3.2 of Python + +[Version 1.9.1](https://github.com/jacquev6/PyGithub/issues?milestone=17&state=closed) (November 20th, 2012) +------------------------------------------------------------------------------------------------------------ + +* Fix an assertion failure when integers returned by Github do not fit in a Python `int` + +[Version 1.9.0](https://github.com/jacquev6/PyGithub/issues?milestone=14&state=closed) (November 19th, 2012) +------------------------------------------------------------------------------------------------------------ + +* You can now use your client_id and client_secret to increase rate limiting without authentication +* You can now send a custom User-Agent +* PullRequest now has its 'assignee' attribute, thank you [mstead](https://github.com/mstead) +* Repository.edit now has 'default_branch' parameter +* create_repo has 'auto_init' and 'gitignore_template' parameters +* GistComment URL is changed (see http://developer.github.com/changes/2012-10-31-gist-comment-uris) +* A typo in the readme was fixed by [tymofij](https://github.com/tymofij), thank you +* Internal stuff: + * Add encoding comment to Python files, thank you [Zearin](https://github.com/Zearin) + * Restore support of Python 2.5 + * Restore coverage measurement in setup.py test + * Small refactoring Previous versions ----------------- @@ -34,7 +53,7 @@ You can also clone it on [Github](http://github.com/jacquev6/PyGithub). Tutorial ======== -First create a Gihtub instance: +First create a Github instance: from github import Github @@ -74,3 +93,16 @@ Projects using PyGithub * [Upverter](https://upverter.com) is a web-based schematic capture and PCB layout tool for people who design electronics. Designers can attach a Github project to an Upverter project. * [Tratihubis](http://pypi.python.org/pypi/tratihubis/) converts Trac tickets to Github issues +* https://github.com/CMB/cligh +* https://github.com/natduca/quickopen uses PyGithub to automaticaly create issues +* https://gist.github.com/3433798 +* https://github.com/zsiciarz/aquila-dsp.org +* https://github.com/robcowie/virtualenvwrapper.github + +They talk about PyGithub +======================== + +* http://stackoverflow.com/questions/10625190/most-suitable-python-library-for-github-api-v3 +* http://stackoverflow.com/questions/12379637/django-social-auth-github-authentication +* http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/py-pygithub/ +* http://oddshocks.com/blog/2012/08/02/developing-charsheet/ diff --git a/doc/ChangeLog.md b/doc/ChangeLog.md index 0da99048..e2b1689c 100644 --- a/doc/ChangeLog.md +++ b/doc/ChangeLog.md @@ -1,3 +1,39 @@ +[Version 1.9.1](https://github.com/jacquev6/PyGithub/issues?milestone=17&state=closed) (November 20th, 2012) +------------------------------------------------------------------------------------------------------------ + +* Fix an assertion failure when integers returned by Github do not fit in a Python `int` + +[Version 1.9.0](https://github.com/jacquev6/PyGithub/issues?milestone=14&state=closed) (November 19th, 2012) +------------------------------------------------------------------------------------------------------------ + +* You can now use your client_id and client_secret to increase rate limiting without authentication +* You can now send a custom User-Agent +* PullRequest now has its 'assignee' attribute, thank you [mstead](https://github.com/mstead) +* Repository.edit now has 'default_branch' parameter +* create_repo has 'auto_init' and 'gitignore_template' parameters +* GistComment URL is changed (see http://developer.github.com/changes/2012-10-31-gist-comment-uris) +* A typo in the readme was fixed by [tymofij](https://github.com/tymofij), thank you +* Internal stuff: + * Add encoding comment to Python files, thank you [Zearin](https://github.com/Zearin) + * Restore support of Python 2.5 + * Restore coverage measurement in setup.py test + * Small refactoring + +[Version 1.8.1](https://github.com/jacquev6/PyGithub/issues?milestone=15&state=closed) (October 28th, 2012) +----------------------------------------------------------------------------------------------------------- + +* Repository.get_git_ref prepends "refs/" to the requested references. Thank you [simon-weber](https://github.com/simon-weber) for noting the incoherence between documentation and behavior. If you feel like it's a breaking change, please see [this issue](https://github.com/jacquev6/PyGithub/issues/104) + +[Version 1.8.0](https://github.com/jacquev6/PyGithub/issues?milestone=13&state=closed) (September 30th, 2012) +------------------------------------------------------------------------------------------------------------- + +* Enable [Travis CI](http://travis-ci.org/#!/jacquev6/PyGithub) +* Fix error 500 when json payload contains percent character (`%`). Thank you again [quixotique](https://github.com/quixotique) for pointing that and reporting it to Github +* Enable debug logging. Logger name is `"github"`. Simple logging can be enabled by `github.enable_console_debug_logging()`. Thank you [quixotique](https://github.com/quixotique) for the merge request and the advice +* Publish tests in the PyPi source archive to ease QA tests of the [FreeBSD port](http://www.freshports.org/devel/py-pygithub/). Thank you [koobs](https://github.com/koobs) for maintaining this port +* Switch to [Semantic Versioning](http://semver.org/) +* Respect [pep8 Style Guide for Python Code](http://www.python.org/dev/peps/pep-0008/) + [Version 1.7](https://github.com/jacquev6/PyGithub/issues?milestone=12&state=closed) (September 12th, 2012) =========================================================================================================== diff --git a/doc/ReferenceOfClasses.md b/doc/ReferenceOfClasses.md index 53ed30a1..34189161 100644 --- a/doc/ReferenceOfClasses.md +++ b/doc/ReferenceOfClasses.md @@ -10,7 +10,11 @@ Constructed from user's login and password or OAuth token or nothing: g = Github( token ) g = Github() +You can also use your client_id and client_secret: + g = github.Github(client_id="YourClientId", client_secret="YourClientSecret") + You can add an argument `base_url = "http://my.enterprise.com:8080/path/to/github"` to connect to a local install of Github (ie. Github Enterprise). +You can add an argument `user_agent` to send a custom User-Agent header to Github. Another argument, that can be passed is `timeout` which has default value `10`. Attributes @@ -174,7 +178,7 @@ Orgs Repos ----- -* `create_repo( name, [description, homepage, private, has_issues, has_wiki, has_downloads] )`: `Repository` +* `create_repo( name, [description, homepage, private, has_issues, has_wiki, has_downloads, auto_init, gitignore_template] )`: `Repository` * `name`: string * `description`: string * `homepage`: string @@ -182,6 +186,8 @@ Repos * `has_issues`: bool * `has_wiki`: bool * `has_downloads`: bool + * `auto_init`: bool + * `gitignore_template`: string * `get_repo( name )`: `Repository` * `name`: string * `get_repos( [type, sort, direction] )`: `PaginatedList` of `Repository` @@ -969,7 +975,7 @@ Public_members Repos ----- -* `create_repo( name, [description, homepage, private, has_issues, has_wiki, has_downloads, team_id] )`: `Repository` +* `create_repo( name, [description, homepage, private, has_issues, has_wiki, has_downloads, team_id, auto_init, gitignore_template] )`: `Repository` * `name`: string * `description`: string * `homepage`: string @@ -978,6 +984,8 @@ Repos * `has_wiki`: bool * `has_downloads`: bool * `team_id`: `Team` + * `auto_init`: bool + * `gitignore_template`: string * `get_repo( name )`: `Repository` * `name`: string * `get_repos( [type] )`: `PaginatedList` of `Repository` @@ -1018,6 +1026,7 @@ Class `PullRequest` Attributes ---------- * `additions`: integer +* `assignee`: `NamedUser` * `base`: `PullRequestPart` * `body`: string * `changed_files`: integer @@ -1386,7 +1395,7 @@ Milestones Modification ------------ -* `edit( name, [description, homepage, public, has_issues, has_wiki, has_downloads] )` +* `edit( name, [description, homepage, public, has_issues, has_wiki, has_downloads, default_branch] )` * `name`: string * `description`: string * `homepage`: string @@ -1394,6 +1403,7 @@ Modification * `has_issues`: bool * `has_wiki`: bool * `has_downloads`: bool + * `default_branch`: string Pulls ----- diff --git a/github/AuthenticatedUser.py b/github/AuthenticatedUser.py index c67a0005..81b14754 100644 --- a/github/AuthenticatedUser.py +++ b/github/AuthenticatedUser.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,148 +13,148 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject -import PaginatedList +import github.GithubObject +import github.PaginatedList -import InputFileContent -import Gist -import Repository -import NamedUser -import Plan -import Organization -import UserKey -import Issue -import Event -import Authorization +import github.Gist +import github.Repository +import github.NamedUser +import github.Plan +import github.Organization +import github.UserKey +import github.Issue +import github.Event +import github.Authorization -class AuthenticatedUser( GithubObject.GithubObject ): + +class AuthenticatedUser(github.GithubObject.GithubObject): @property - def avatar_url( self ): - self._completeIfNotSet( self._avatar_url ) - return self._NoneIfNotSet( self._avatar_url ) + def avatar_url(self): + self._completeIfNotSet(self._avatar_url) + return self._NoneIfNotSet(self._avatar_url) @property - def bio( self ): - self._completeIfNotSet( self._bio ) - return self._NoneIfNotSet( self._bio ) + def bio(self): + self._completeIfNotSet(self._bio) + return self._NoneIfNotSet(self._bio) @property - def blog( self ): - self._completeIfNotSet( self._blog ) - return self._NoneIfNotSet( self._blog ) + def blog(self): + self._completeIfNotSet(self._blog) + return self._NoneIfNotSet(self._blog) @property - def collaborators( self ): - self._completeIfNotSet( self._collaborators ) - return self._NoneIfNotSet( self._collaborators ) + def collaborators(self): + self._completeIfNotSet(self._collaborators) + return self._NoneIfNotSet(self._collaborators) @property - def company( self ): - self._completeIfNotSet( self._company ) - return self._NoneIfNotSet( self._company ) + def company(self): + self._completeIfNotSet(self._company) + return self._NoneIfNotSet(self._company) @property - def created_at( self ): - self._completeIfNotSet( self._created_at ) - return self._NoneIfNotSet( self._created_at ) + def created_at(self): + self._completeIfNotSet(self._created_at) + return self._NoneIfNotSet(self._created_at) @property - def disk_usage( self ): - self._completeIfNotSet( self._disk_usage ) - return self._NoneIfNotSet( self._disk_usage ) + def disk_usage(self): + self._completeIfNotSet(self._disk_usage) + return self._NoneIfNotSet(self._disk_usage) @property - def email( self ): - self._completeIfNotSet( self._email ) - return self._NoneIfNotSet( self._email ) + def email(self): + self._completeIfNotSet(self._email) + return self._NoneIfNotSet(self._email) @property - def followers( self ): - self._completeIfNotSet( self._followers ) - return self._NoneIfNotSet( self._followers ) + def followers(self): + self._completeIfNotSet(self._followers) + return self._NoneIfNotSet(self._followers) @property - def following( self ): - self._completeIfNotSet( self._following ) - return self._NoneIfNotSet( self._following ) + def following(self): + self._completeIfNotSet(self._following) + return self._NoneIfNotSet(self._following) @property - def gravatar_id( self ): - self._completeIfNotSet( self._gravatar_id ) - return self._NoneIfNotSet( self._gravatar_id ) + def gravatar_id(self): + self._completeIfNotSet(self._gravatar_id) + return self._NoneIfNotSet(self._gravatar_id) @property - def hireable( self ): - self._completeIfNotSet( self._hireable ) - return self._NoneIfNotSet( self._hireable ) + def hireable(self): + self._completeIfNotSet(self._hireable) + return self._NoneIfNotSet(self._hireable) @property - def html_url( self ): - self._completeIfNotSet( self._html_url ) - return self._NoneIfNotSet( self._html_url ) + def html_url(self): + self._completeIfNotSet(self._html_url) + return self._NoneIfNotSet(self._html_url) @property - def id( self ): - self._completeIfNotSet( self._id ) - return self._NoneIfNotSet( self._id ) + def id(self): + self._completeIfNotSet(self._id) + return self._NoneIfNotSet(self._id) @property - def location( self ): - self._completeIfNotSet( self._location ) - return self._NoneIfNotSet( self._location ) + def location(self): + self._completeIfNotSet(self._location) + return self._NoneIfNotSet(self._location) @property - def login( self ): - self._completeIfNotSet( self._login ) - return self._NoneIfNotSet( self._login ) + def login(self): + self._completeIfNotSet(self._login) + return self._NoneIfNotSet(self._login) @property - def name( self ): - self._completeIfNotSet( self._name ) - return self._NoneIfNotSet( self._name ) + def name(self): + self._completeIfNotSet(self._name) + return self._NoneIfNotSet(self._name) @property - def owned_private_repos( self ): - self._completeIfNotSet( self._owned_private_repos ) - return self._NoneIfNotSet( self._owned_private_repos ) + def owned_private_repos(self): + self._completeIfNotSet(self._owned_private_repos) + return self._NoneIfNotSet(self._owned_private_repos) @property - def plan( self ): - self._completeIfNotSet( self._plan ) - return self._NoneIfNotSet( self._plan ) + def plan(self): + self._completeIfNotSet(self._plan) + return self._NoneIfNotSet(self._plan) @property - def private_gists( self ): - self._completeIfNotSet( self._private_gists ) - return self._NoneIfNotSet( self._private_gists ) + def private_gists(self): + self._completeIfNotSet(self._private_gists) + return self._NoneIfNotSet(self._private_gists) @property - def public_gists( self ): - self._completeIfNotSet( self._public_gists ) - return self._NoneIfNotSet( self._public_gists ) + def public_gists(self): + self._completeIfNotSet(self._public_gists) + return self._NoneIfNotSet(self._public_gists) @property - def public_repos( self ): - self._completeIfNotSet( self._public_repos ) - return self._NoneIfNotSet( self._public_repos ) + def public_repos(self): + self._completeIfNotSet(self._public_repos) + return self._NoneIfNotSet(self._public_repos) @property - def total_private_repos( self ): - self._completeIfNotSet( self._total_private_repos ) - return self._NoneIfNotSet( self._total_private_repos ) + def total_private_repos(self): + self._completeIfNotSet(self._total_private_repos) + return self._NoneIfNotSet(self._total_private_repos) @property - def type( self ): - self._completeIfNotSet( self._type ) - return self._NoneIfNotSet( self._type ) + def type(self): + self._completeIfNotSet(self._type) + return self._NoneIfNotSet(self._type) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) - def add_to_emails( self, *emails ): - assert all( isinstance( element, ( str, unicode ) ) for element in emails ), emails + def add_to_emails(self, *emails): + assert all(isinstance(element, (str, unicode)) for element in emails), emails post_parameters = emails headers, data = self._requester.requestAndCheck( "POST", @@ -161,8 +163,8 @@ class AuthenticatedUser( GithubObject.GithubObject ): post_parameters ) - def add_to_following( self, following ): - assert isinstance( following, NamedUser.NamedUser ), following + def add_to_following(self, following): + assert isinstance(following, github.NamedUser.NamedUser), following headers, data = self._requester.requestAndCheck( "PUT", "/user/following/" + following._identity, @@ -170,8 +172,8 @@ class AuthenticatedUser( GithubObject.GithubObject ): None ) - def add_to_starred( self, starred ): - assert isinstance( starred, Repository.Repository ), starred + def add_to_starred(self, starred): + assert isinstance(starred, github.Repository.Repository), starred headers, data = self._requester.requestAndCheck( "PUT", "/user/starred/" + starred._identity, @@ -179,8 +181,8 @@ class AuthenticatedUser( GithubObject.GithubObject ): None ) - def add_to_subscriptions( self, subscription ): - assert isinstance( subscription, Repository.Repository ), subscription + def add_to_subscriptions(self, subscription): + assert isinstance(subscription, github.Repository.Repository), subscription headers, data = self._requester.requestAndCheck( "PUT", "/user/subscriptions/" + subscription._identity, @@ -188,8 +190,8 @@ class AuthenticatedUser( GithubObject.GithubObject ): None ) - def add_to_watched( self, watched ): - assert isinstance( watched, Repository.Repository ), watched + def add_to_watched(self, watched): + assert isinstance(watched, github.Repository.Repository), watched headers, data = self._requester.requestAndCheck( "PUT", "/user/watched/" + watched._identity, @@ -197,56 +199,56 @@ class AuthenticatedUser( GithubObject.GithubObject ): None ) - def create_authorization( self, scopes = GithubObject.NotSet, note = GithubObject.NotSet, note_url = GithubObject.NotSet ): - assert scopes is GithubObject.NotSet or all( isinstance( element, ( str, unicode ) ) for element in scopes ), scopes - assert note is GithubObject.NotSet or isinstance( note, ( str, unicode ) ), note - assert note_url is GithubObject.NotSet or isinstance( note_url, ( str, unicode ) ), note_url + def create_authorization(self, scopes=github.GithubObject.NotSet, note=github.GithubObject.NotSet, note_url=github.GithubObject.NotSet): + assert scopes is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in scopes), scopes + assert note is github.GithubObject.NotSet or isinstance(note, (str, unicode)), note + assert note_url is github.GithubObject.NotSet or isinstance(note_url, (str, unicode)), note_url post_parameters = dict() - if scopes is not GithubObject.NotSet: - post_parameters[ "scopes" ] = scopes - if note is not GithubObject.NotSet: - post_parameters[ "note" ] = note - if note_url is not GithubObject.NotSet: - post_parameters[ "note_url" ] = note_url + if scopes is not github.GithubObject.NotSet: + post_parameters["scopes"] = scopes + if note is not github.GithubObject.NotSet: + post_parameters["note"] = note + if note_url is not github.GithubObject.NotSet: + post_parameters["note_url"] = note_url headers, data = self._requester.requestAndCheck( "POST", "/authorizations", None, post_parameters ) - return Authorization.Authorization( self._requester, data, completed = True ) + return github.Authorization.Authorization(self._requester, data, completed=True) - def create_fork( self, repo ): - assert isinstance( repo, Repository.Repository ), repo + def create_fork(self, repo): + assert isinstance(repo, github.Repository.Repository), repo headers, data = self._requester.requestAndCheck( "POST", "/repos/" + repo.owner.login + "/" + repo.name + "/forks", None, None ) - return Repository.Repository( self._requester, data, completed = True ) + return github.Repository.Repository(self._requester, data, completed=True) - def create_gist( self, public, files, description = GithubObject.NotSet ): - assert isinstance( public, bool ), public - assert all( isinstance( element, InputFileContent.InputFileContent ) for element in files.itervalues() ), files - assert description is GithubObject.NotSet or isinstance( description, ( str, unicode ) ), description + def create_gist(self, public, files, description=github.GithubObject.NotSet): + assert isinstance(public, bool), public + assert all(isinstance(element, github.InputFileContent) for element in files.itervalues()), files + assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description post_parameters = { "public": public, - "files": dict( ( key, value._identity ) for key, value in files.iteritems() ), + "files": dict((key, value._identity) for key, value in files.iteritems()), } - if description is not GithubObject.NotSet: - post_parameters[ "description" ] = description + if description is not github.GithubObject.NotSet: + post_parameters["description"] = description headers, data = self._requester.requestAndCheck( "POST", "/gists", None, post_parameters ) - return Gist.Gist( self._requester, data, completed = True ) + return github.Gist.Gist(self._requester, data, completed=True) - def create_key( self, title, key ): - assert isinstance( title, ( str, unicode ) ), title - assert isinstance( key, ( str, unicode ) ), key + def create_key(self, title, key): + assert isinstance(title, (str, unicode)), title + assert isinstance(key, (str, unicode)), key post_parameters = { "title": title, "key": key, @@ -257,89 +259,95 @@ class AuthenticatedUser( GithubObject.GithubObject ): None, post_parameters ) - return UserKey.UserKey( self._requester, data, completed = True ) + return github.UserKey.UserKey(self._requester, data, completed=True) - def create_repo( self, name, description = GithubObject.NotSet, homepage = GithubObject.NotSet, private = GithubObject.NotSet, has_issues = GithubObject.NotSet, has_wiki = GithubObject.NotSet, has_downloads = GithubObject.NotSet ): - assert isinstance( name, ( str, unicode ) ), name - assert description is GithubObject.NotSet or isinstance( description, ( str, unicode ) ), description - assert homepage is GithubObject.NotSet or isinstance( homepage, ( str, unicode ) ), homepage - assert private is GithubObject.NotSet or isinstance( private, bool ), private - 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 + def create_repo(self, name, description=github.GithubObject.NotSet, homepage=github.GithubObject.NotSet, private=github.GithubObject.NotSet, has_issues=github.GithubObject.NotSet, has_wiki=github.GithubObject.NotSet, has_downloads=github.GithubObject.NotSet, auto_init=github.GithubObject.NotSet, gitignore_template=github.GithubObject.NotSet): + assert isinstance(name, (str, unicode)), name + assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description + assert homepage is github.GithubObject.NotSet or isinstance(homepage, (str, unicode)), homepage + assert private is github.GithubObject.NotSet or isinstance(private, bool), private + assert has_issues is github.GithubObject.NotSet or isinstance(has_issues, bool), has_issues + assert has_wiki is github.GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki + assert has_downloads is github.GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads + assert auto_init is github.GithubObject.NotSet or isinstance(auto_init, bool), auto_init + assert gitignore_template is github.GithubObject.NotSet or isinstance(gitignore_template, (str, unicode)), gitignore_template post_parameters = { "name": name, } - if description is not GithubObject.NotSet: - post_parameters[ "description" ] = description - if homepage is not GithubObject.NotSet: - post_parameters[ "homepage" ] = homepage - if private is not GithubObject.NotSet: - post_parameters[ "private" ] = private - if has_issues is not GithubObject.NotSet: - post_parameters[ "has_issues" ] = has_issues - if has_wiki is not GithubObject.NotSet: - post_parameters[ "has_wiki" ] = has_wiki - if has_downloads is not GithubObject.NotSet: - post_parameters[ "has_downloads" ] = has_downloads + if description is not github.GithubObject.NotSet: + post_parameters["description"] = description + if homepage is not github.GithubObject.NotSet: + post_parameters["homepage"] = homepage + if private is not github.GithubObject.NotSet: + post_parameters["private"] = private + if has_issues is not github.GithubObject.NotSet: + post_parameters["has_issues"] = has_issues + if has_wiki is not github.GithubObject.NotSet: + post_parameters["has_wiki"] = has_wiki + if has_downloads is not github.GithubObject.NotSet: + post_parameters["has_downloads"] = has_downloads + if auto_init is not github.GithubObject.NotSet: + post_parameters["auto_init"] = auto_init + if gitignore_template is not github.GithubObject.NotSet: + post_parameters["gitignore_template"] = gitignore_template headers, data = self._requester.requestAndCheck( "POST", "/user/repos", None, post_parameters ) - return Repository.Repository( self._requester, data, completed = True ) + return github.Repository.Repository(self._requester, data, completed=True) - def edit( self, name = GithubObject.NotSet, email = GithubObject.NotSet, blog = GithubObject.NotSet, company = GithubObject.NotSet, location = GithubObject.NotSet, hireable = GithubObject.NotSet, bio = GithubObject.NotSet ): - assert name is GithubObject.NotSet or isinstance( name, ( str, unicode ) ), name - assert email is GithubObject.NotSet or isinstance( email, ( str, unicode ) ), email - assert blog is GithubObject.NotSet or isinstance( blog, ( str, unicode ) ), blog - assert company is GithubObject.NotSet or isinstance( company, ( str, unicode ) ), company - assert location is GithubObject.NotSet or isinstance( location, ( str, unicode ) ), location - assert hireable is GithubObject.NotSet or isinstance( hireable, bool ), hireable - assert bio is GithubObject.NotSet or isinstance( bio, ( str, unicode ) ), bio + def edit(self, name=github.GithubObject.NotSet, email=github.GithubObject.NotSet, blog=github.GithubObject.NotSet, company=github.GithubObject.NotSet, location=github.GithubObject.NotSet, hireable=github.GithubObject.NotSet, bio=github.GithubObject.NotSet): + assert name is github.GithubObject.NotSet or isinstance(name, (str, unicode)), name + assert email is github.GithubObject.NotSet or isinstance(email, (str, unicode)), email + assert blog is github.GithubObject.NotSet or isinstance(blog, (str, unicode)), blog + assert company is github.GithubObject.NotSet or isinstance(company, (str, unicode)), company + assert location is github.GithubObject.NotSet or isinstance(location, (str, unicode)), location + assert hireable is github.GithubObject.NotSet or isinstance(hireable, bool), hireable + assert bio is github.GithubObject.NotSet or isinstance(bio, (str, unicode)), bio post_parameters = dict() - if name is not GithubObject.NotSet: - post_parameters[ "name" ] = name - if email is not GithubObject.NotSet: - post_parameters[ "email" ] = email - if blog is not GithubObject.NotSet: - post_parameters[ "blog" ] = blog - if company is not GithubObject.NotSet: - post_parameters[ "company" ] = company - if location is not GithubObject.NotSet: - post_parameters[ "location" ] = location - if hireable is not GithubObject.NotSet: - post_parameters[ "hireable" ] = hireable - if bio is not GithubObject.NotSet: - post_parameters[ "bio" ] = bio + if name is not github.GithubObject.NotSet: + post_parameters["name"] = name + if email is not github.GithubObject.NotSet: + post_parameters["email"] = email + if blog is not github.GithubObject.NotSet: + post_parameters["blog"] = blog + if company is not github.GithubObject.NotSet: + post_parameters["company"] = company + if location is not github.GithubObject.NotSet: + post_parameters["location"] = location + if hireable is not github.GithubObject.NotSet: + post_parameters["hireable"] = hireable + if bio is not github.GithubObject.NotSet: + post_parameters["bio"] = bio headers, data = self._requester.requestAndCheck( "PATCH", "/user", None, post_parameters ) - self._useAttributes( data ) + self._useAttributes(data) - def get_authorization( self, id ): - assert isinstance( id, int ), id + def get_authorization(self, id): + assert isinstance(id, (int, long)), id headers, data = self._requester.requestAndCheck( "GET", - "/authorizations/" + str( id ), + "/authorizations/" + str(id), None, None ) - return Authorization.Authorization( self._requester, data, completed = True ) + return github.Authorization.Authorization(self._requester, data, completed=True) - def get_authorizations( self ): - return PaginatedList.PaginatedList( - Authorization.Authorization, + def get_authorizations(self): + return github.PaginatedList.PaginatedList( + github.Authorization.Authorization, self._requester, "/authorizations", None ) - def get_emails( self ): + def get_emails(self): headers, data = self._requester.requestAndCheck( "GET", "/user/emails", @@ -348,143 +356,143 @@ class AuthenticatedUser( GithubObject.GithubObject ): ) return data - def get_events( self ): - return PaginatedList.PaginatedList( - Event.Event, + def get_events(self): + return github.PaginatedList.PaginatedList( + github.Event.Event, self._requester, "/events", None ) - def get_followers( self ): - return PaginatedList.PaginatedList( - NamedUser.NamedUser, + def get_followers(self): + return github.PaginatedList.PaginatedList( + github.NamedUser.NamedUser, self._requester, "/user/followers", None ) - def get_following( self ): - return PaginatedList.PaginatedList( - NamedUser.NamedUser, + def get_following(self): + return github.PaginatedList.PaginatedList( + github.NamedUser.NamedUser, self._requester, "/user/following", None ) - def get_gists( self ): - return PaginatedList.PaginatedList( - Gist.Gist, + def get_gists(self): + return github.PaginatedList.PaginatedList( + github.Gist.Gist, self._requester, "/gists", None ) - def get_issues( self ): - return PaginatedList.PaginatedList( - Issue.Issue, + def get_issues(self): + return github.PaginatedList.PaginatedList( + github.Issue.Issue, self._requester, "/issues", None ) - def get_key( self, id ): - assert isinstance( id, int ), id + def get_key(self, id): + assert isinstance(id, (int, long)), id headers, data = self._requester.requestAndCheck( "GET", - "/user/keys/" + str( id ), + "/user/keys/" + str(id), None, None ) - return UserKey.UserKey( self._requester, data, completed = True ) + return github.UserKey.UserKey(self._requester, data, completed=True) - def get_keys( self ): - return PaginatedList.PaginatedList( - UserKey.UserKey, + def get_keys(self): + return github.PaginatedList.PaginatedList( + github.UserKey.UserKey, self._requester, "/user/keys", None ) - def get_organization_events( self, org ): - assert isinstance( org, Organization.Organization ), org - return PaginatedList.PaginatedList( - Event.Event, + def get_organization_events(self, org): + assert isinstance(org, github.Organization.Organization), org + return github.PaginatedList.PaginatedList( + github.Event.Event, self._requester, "/users/" + self.login + "/events/orgs/" + org.login, None ) - def get_orgs( self ): - return PaginatedList.PaginatedList( - Organization.Organization, + def get_orgs(self): + return github.PaginatedList.PaginatedList( + github.Organization.Organization, self._requester, "/user/orgs", None ) - def get_repo( self, name ): - assert isinstance( name, ( str, unicode ) ), name + def get_repo(self, name): + assert isinstance(name, (str, unicode)), name headers, data = self._requester.requestAndCheck( "GET", "/repos/" + self.login + "/" + name, None, None ) - return Repository.Repository( self._requester, data, completed = True ) + return github.Repository.Repository(self._requester, data, completed=True) - def get_repos( self, type = GithubObject.NotSet, sort = GithubObject.NotSet, direction = GithubObject.NotSet ): - assert type is GithubObject.NotSet or isinstance( type, ( str, unicode ) ), type - assert sort is GithubObject.NotSet or isinstance( sort, ( str, unicode ) ), sort - assert direction is GithubObject.NotSet or isinstance( direction, ( str, unicode ) ), direction + def get_repos(self, type=github.GithubObject.NotSet, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet): + assert type is github.GithubObject.NotSet or isinstance(type, (str, unicode)), type + assert sort is github.GithubObject.NotSet or isinstance(sort, (str, unicode)), sort + assert direction is github.GithubObject.NotSet or isinstance(direction, (str, unicode)), direction url_parameters = dict() - if type is not GithubObject.NotSet: - url_parameters[ "type" ] = type - if sort is not GithubObject.NotSet: - url_parameters[ "sort" ] = sort - if direction is not GithubObject.NotSet: - url_parameters[ "direction" ] = direction - return PaginatedList.PaginatedList( - Repository.Repository, + if type is not github.GithubObject.NotSet: + url_parameters["type"] = type + if sort is not github.GithubObject.NotSet: + url_parameters["sort"] = sort + if direction is not github.GithubObject.NotSet: + url_parameters["direction"] = direction + return github.PaginatedList.PaginatedList( + github.Repository.Repository, self._requester, "/user/repos", url_parameters ) - def get_starred( self ): - return PaginatedList.PaginatedList( - Repository.Repository, + def get_starred(self): + return github.PaginatedList.PaginatedList( + github.Repository.Repository, self._requester, "/user/starred", None ) - def get_starred_gists( self ): - return PaginatedList.PaginatedList( - Gist.Gist, + def get_starred_gists(self): + return github.PaginatedList.PaginatedList( + github.Gist.Gist, self._requester, "/gists/starred", None ) - def get_subscriptions( self ): - return PaginatedList.PaginatedList( - Repository.Repository, + def get_subscriptions(self): + return github.PaginatedList.PaginatedList( + github.Repository.Repository, self._requester, "/user/subscriptions", None ) - def get_watched( self ): - return PaginatedList.PaginatedList( - Repository.Repository, + def get_watched(self): + return github.PaginatedList.PaginatedList( + github.Repository.Repository, self._requester, "/user/watched", None ) - def has_in_following( self, following ): - assert isinstance( following, NamedUser.NamedUser ), following + def has_in_following(self, following): + assert isinstance(following, github.NamedUser.NamedUser), following status, headers, data = self._requester.requestRaw( "GET", "/user/following/" + following._identity, @@ -493,8 +501,8 @@ class AuthenticatedUser( GithubObject.GithubObject ): ) return status == 204 - def has_in_starred( self, starred ): - assert isinstance( starred, Repository.Repository ), starred + def has_in_starred(self, starred): + assert isinstance(starred, github.Repository.Repository), starred status, headers, data = self._requester.requestRaw( "GET", "/user/starred/" + starred._identity, @@ -503,8 +511,8 @@ class AuthenticatedUser( GithubObject.GithubObject ): ) return status == 204 - def has_in_subscriptions( self, subscription ): - assert isinstance( subscription, Repository.Repository ), subscription + def has_in_subscriptions(self, subscription): + assert isinstance(subscription, github.Repository.Repository), subscription status, headers, data = self._requester.requestRaw( "GET", "/user/subscriptions/" + subscription._identity, @@ -513,8 +521,8 @@ class AuthenticatedUser( GithubObject.GithubObject ): ) return status == 204 - def has_in_watched( self, watched ): - assert isinstance( watched, Repository.Repository ), watched + def has_in_watched(self, watched): + assert isinstance(watched, github.Repository.Repository), watched status, headers, data = self._requester.requestRaw( "GET", "/user/watched/" + watched._identity, @@ -523,8 +531,8 @@ class AuthenticatedUser( GithubObject.GithubObject ): ) return status == 204 - def remove_from_emails( self, *emails ): - assert all( isinstance( element, ( str, unicode ) ) for element in emails ), emails + def remove_from_emails(self, *emails): + assert all(isinstance(element, (str, unicode)) for element in emails), emails post_parameters = emails headers, data = self._requester.requestAndCheck( "DELETE", @@ -533,8 +541,8 @@ class AuthenticatedUser( GithubObject.GithubObject ): post_parameters ) - def remove_from_following( self, following ): - assert isinstance( following, NamedUser.NamedUser ), following + def remove_from_following(self, following): + assert isinstance(following, github.NamedUser.NamedUser), following headers, data = self._requester.requestAndCheck( "DELETE", "/user/following/" + following._identity, @@ -542,8 +550,8 @@ class AuthenticatedUser( GithubObject.GithubObject ): None ) - def remove_from_starred( self, starred ): - assert isinstance( starred, Repository.Repository ), starred + def remove_from_starred(self, starred): + assert isinstance(starred, github.Repository.Repository), starred headers, data = self._requester.requestAndCheck( "DELETE", "/user/starred/" + starred._identity, @@ -551,8 +559,8 @@ class AuthenticatedUser( GithubObject.GithubObject ): None ) - def remove_from_subscriptions( self, subscription ): - assert isinstance( subscription, Repository.Repository ), subscription + def remove_from_subscriptions(self, subscription): + assert isinstance(subscription, github.Repository.Repository), subscription headers, data = self._requester.requestAndCheck( "DELETE", "/user/subscriptions/" + subscription._identity, @@ -560,8 +568,8 @@ class AuthenticatedUser( GithubObject.GithubObject ): None ) - def remove_from_watched( self, watched ): - assert isinstance( watched, Repository.Repository ), watched + def remove_from_watched(self, watched): + assert isinstance(watched, github.Repository.Repository), watched headers, data = self._requester.requestAndCheck( "DELETE", "/user/watched/" + watched._identity, @@ -569,106 +577,106 @@ class AuthenticatedUser( GithubObject.GithubObject ): None ) - def _initAttributes( self ): - self._avatar_url = GithubObject.NotSet - self._bio = GithubObject.NotSet - self._blog = GithubObject.NotSet - self._collaborators = GithubObject.NotSet - self._company = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._disk_usage = GithubObject.NotSet - self._email = GithubObject.NotSet - self._followers = GithubObject.NotSet - self._following = GithubObject.NotSet - self._gravatar_id = GithubObject.NotSet - self._hireable = GithubObject.NotSet - self._html_url = GithubObject.NotSet - self._id = GithubObject.NotSet - self._location = GithubObject.NotSet - self._login = GithubObject.NotSet - self._name = GithubObject.NotSet - self._owned_private_repos = GithubObject.NotSet - self._plan = GithubObject.NotSet - self._private_gists = GithubObject.NotSet - self._public_gists = GithubObject.NotSet - self._public_repos = GithubObject.NotSet - self._total_private_repos = GithubObject.NotSet - self._type = GithubObject.NotSet - self._url = GithubObject.NotSet + def _initAttributes(self): + self._avatar_url = github.GithubObject.NotSet + self._bio = github.GithubObject.NotSet + self._blog = github.GithubObject.NotSet + self._collaborators = github.GithubObject.NotSet + self._company = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._disk_usage = github.GithubObject.NotSet + self._email = github.GithubObject.NotSet + self._followers = github.GithubObject.NotSet + self._following = github.GithubObject.NotSet + self._gravatar_id = github.GithubObject.NotSet + self._hireable = github.GithubObject.NotSet + self._html_url = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._location = github.GithubObject.NotSet + self._login = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._owned_private_repos = github.GithubObject.NotSet + self._plan = github.GithubObject.NotSet + self._private_gists = github.GithubObject.NotSet + self._public_gists = github.GithubObject.NotSet + self._public_repos = github.GithubObject.NotSet + self._total_private_repos = github.GithubObject.NotSet + self._type = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "avatar_url" in attributes: # pragma no branch - assert attributes[ "avatar_url" ] is None or isinstance( attributes[ "avatar_url" ], ( str, unicode ) ), attributes[ "avatar_url" ] - self._avatar_url = attributes[ "avatar_url" ] - if "bio" in attributes: # pragma no branch - assert attributes[ "bio" ] is None or isinstance( attributes[ "bio" ], ( str, unicode ) ), attributes[ "bio" ] - self._bio = attributes[ "bio" ] - if "blog" in attributes: # pragma no branch - assert attributes[ "blog" ] is None or isinstance( attributes[ "blog" ], ( str, unicode ) ), attributes[ "blog" ] - self._blog = attributes[ "blog" ] - if "collaborators" in attributes: # pragma no branch - assert attributes[ "collaborators" ] is None or isinstance( attributes[ "collaborators" ], int ), attributes[ "collaborators" ] - self._collaborators = attributes[ "collaborators" ] - if "company" in attributes: # pragma no branch - assert attributes[ "company" ] is None or isinstance( attributes[ "company" ], ( str, unicode ) ), attributes[ "company" ] - self._company = attributes[ "company" ] - if "created_at" in attributes: # pragma no branch - assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = self._parseDatetime( attributes[ "created_at" ] ) - if "disk_usage" in attributes: # pragma no branch - assert attributes[ "disk_usage" ] is None or isinstance( attributes[ "disk_usage" ], int ), attributes[ "disk_usage" ] - self._disk_usage = attributes[ "disk_usage" ] - if "email" in attributes: # pragma no branch - assert attributes[ "email" ] is None or isinstance( attributes[ "email" ], ( str, unicode ) ), attributes[ "email" ] - self._email = attributes[ "email" ] - if "followers" in attributes: # pragma no branch - assert attributes[ "followers" ] is None or isinstance( attributes[ "followers" ], int ), attributes[ "followers" ] - self._followers = attributes[ "followers" ] - if "following" in attributes: # pragma no branch - assert attributes[ "following" ] is None or isinstance( attributes[ "following" ], int ), attributes[ "following" ] - self._following = attributes[ "following" ] - if "gravatar_id" in attributes: # pragma no branch - assert attributes[ "gravatar_id" ] is None or isinstance( attributes[ "gravatar_id" ], ( str, unicode ) ), attributes[ "gravatar_id" ] - self._gravatar_id = attributes[ "gravatar_id" ] - if "hireable" in attributes: # pragma no branch - assert attributes[ "hireable" ] is None or isinstance( attributes[ "hireable" ], bool ), attributes[ "hireable" ] - self._hireable = attributes[ "hireable" ] - if "html_url" in attributes: # pragma no branch - assert attributes[ "html_url" ] is None or isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ] - self._html_url = attributes[ "html_url" ] - if "id" in attributes: # pragma no branch - assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] - self._id = attributes[ "id" ] - if "location" in attributes: # pragma no branch - assert attributes[ "location" ] is None or isinstance( attributes[ "location" ], ( str, unicode ) ), attributes[ "location" ] - self._location = attributes[ "location" ] - if "login" in attributes: # pragma no branch - assert attributes[ "login" ] is None or isinstance( attributes[ "login" ], ( str, unicode ) ), attributes[ "login" ] - self._login = attributes[ "login" ] - if "name" in attributes: # pragma no branch - assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ] - self._name = attributes[ "name" ] - if "owned_private_repos" in attributes: # pragma no branch - assert attributes[ "owned_private_repos" ] is None or isinstance( attributes[ "owned_private_repos" ], int ), attributes[ "owned_private_repos" ] - self._owned_private_repos = attributes[ "owned_private_repos" ] - if "plan" in attributes: # pragma no branch - assert attributes[ "plan" ] is None or isinstance( attributes[ "plan" ], dict ), attributes[ "plan" ] - self._plan = None if attributes[ "plan" ] is None else Plan.Plan( self._requester, attributes[ "plan" ], completed = False ) - if "private_gists" in attributes: # pragma no branch - assert attributes[ "private_gists" ] is None or isinstance( attributes[ "private_gists" ], int ), attributes[ "private_gists" ] - self._private_gists = attributes[ "private_gists" ] - if "public_gists" in attributes: # pragma no branch - assert attributes[ "public_gists" ] is None or isinstance( attributes[ "public_gists" ], int ), attributes[ "public_gists" ] - self._public_gists = attributes[ "public_gists" ] - if "public_repos" in attributes: # pragma no branch - assert attributes[ "public_repos" ] is None or isinstance( attributes[ "public_repos" ], int ), attributes[ "public_repos" ] - self._public_repos = attributes[ "public_repos" ] - if "total_private_repos" in attributes: # pragma no branch - assert attributes[ "total_private_repos" ] is None or isinstance( attributes[ "total_private_repos" ], int ), attributes[ "total_private_repos" ] - self._total_private_repos = attributes[ "total_private_repos" ] - if "type" in attributes: # pragma no branch - assert attributes[ "type" ] is None or isinstance( attributes[ "type" ], ( str, unicode ) ), attributes[ "type" ] - self._type = attributes[ "type" ] - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] + def _useAttributes(self, attributes): + if "avatar_url" in attributes: # pragma no branch + assert attributes["avatar_url"] is None or isinstance(attributes["avatar_url"], (str, unicode)), attributes["avatar_url"] + self._avatar_url = attributes["avatar_url"] + if "bio" in attributes: # pragma no branch + assert attributes["bio"] is None or isinstance(attributes["bio"], (str, unicode)), attributes["bio"] + self._bio = attributes["bio"] + if "blog" in attributes: # pragma no branch + assert attributes["blog"] is None or isinstance(attributes["blog"], (str, unicode)), attributes["blog"] + self._blog = attributes["blog"] + if "collaborators" in attributes: # pragma no branch + assert attributes["collaborators"] is None or isinstance(attributes["collaborators"], (int, long)), attributes["collaborators"] + self._collaborators = attributes["collaborators"] + if "company" in attributes: # pragma no branch + assert attributes["company"] is None or isinstance(attributes["company"], (str, unicode)), attributes["company"] + self._company = attributes["company"] + if "created_at" in attributes: # pragma no branch + assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"] + self._created_at = self._parseDatetime(attributes["created_at"]) + if "disk_usage" in attributes: # pragma no branch + assert attributes["disk_usage"] is None or isinstance(attributes["disk_usage"], (int, long)), attributes["disk_usage"] + self._disk_usage = attributes["disk_usage"] + if "email" in attributes: # pragma no branch + assert attributes["email"] is None or isinstance(attributes["email"], (str, unicode)), attributes["email"] + self._email = attributes["email"] + if "followers" in attributes: # pragma no branch + assert attributes["followers"] is None or isinstance(attributes["followers"], (int, long)), attributes["followers"] + self._followers = attributes["followers"] + if "following" in attributes: # pragma no branch + assert attributes["following"] is None or isinstance(attributes["following"], (int, long)), attributes["following"] + self._following = attributes["following"] + if "gravatar_id" in attributes: # pragma no branch + assert attributes["gravatar_id"] is None or isinstance(attributes["gravatar_id"], (str, unicode)), attributes["gravatar_id"] + self._gravatar_id = attributes["gravatar_id"] + if "hireable" in attributes: # pragma no branch + assert attributes["hireable"] is None or isinstance(attributes["hireable"], bool), attributes["hireable"] + self._hireable = attributes["hireable"] + if "html_url" in attributes: # pragma no branch + assert attributes["html_url"] is None or isinstance(attributes["html_url"], (str, unicode)), attributes["html_url"] + self._html_url = attributes["html_url"] + if "id" in attributes: # pragma no branch + assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] + self._id = attributes["id"] + if "location" in attributes: # pragma no branch + assert attributes["location"] is None or isinstance(attributes["location"], (str, unicode)), attributes["location"] + self._location = attributes["location"] + if "login" in attributes: # pragma no branch + assert attributes["login"] is None or isinstance(attributes["login"], (str, unicode)), attributes["login"] + self._login = attributes["login"] + if "name" in attributes: # pragma no branch + assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] + self._name = attributes["name"] + if "owned_private_repos" in attributes: # pragma no branch + assert attributes["owned_private_repos"] is None or isinstance(attributes["owned_private_repos"], (int, long)), attributes["owned_private_repos"] + self._owned_private_repos = attributes["owned_private_repos"] + if "plan" in attributes: # pragma no branch + assert attributes["plan"] is None or isinstance(attributes["plan"], dict), attributes["plan"] + self._plan = None if attributes["plan"] is None else github.Plan.Plan(self._requester, attributes["plan"], completed=False) + if "private_gists" in attributes: # pragma no branch + assert attributes["private_gists"] is None or isinstance(attributes["private_gists"], (int, long)), attributes["private_gists"] + self._private_gists = attributes["private_gists"] + if "public_gists" in attributes: # pragma no branch + assert attributes["public_gists"] is None or isinstance(attributes["public_gists"], (int, long)), attributes["public_gists"] + self._public_gists = attributes["public_gists"] + if "public_repos" in attributes: # pragma no branch + assert attributes["public_repos"] is None or isinstance(attributes["public_repos"], (int, long)), attributes["public_repos"] + self._public_repos = attributes["public_repos"] + if "total_private_repos" in attributes: # pragma no branch + assert attributes["total_private_repos"] is None or isinstance(attributes["total_private_repos"], (int, long)), attributes["total_private_repos"] + self._total_private_repos = attributes["total_private_repos"] + if "type" in attributes: # pragma no branch + assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"] + self._type = attributes["type"] + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] diff --git a/github/Authorization.py b/github/Authorization.py index f437d6ad..e6876565 100644 --- a/github/Authorization.py +++ b/github/Authorization.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,57 +13,58 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import AuthorizationApplication +import github.AuthorizationApplication -class Authorization( GithubObject.GithubObject ): + +class Authorization(github.GithubObject.GithubObject): @property - def app( self ): - self._completeIfNotSet( self._app ) - return self._NoneIfNotSet( self._app ) + def app(self): + self._completeIfNotSet(self._app) + return self._NoneIfNotSet(self._app) @property - def created_at( self ): - self._completeIfNotSet( self._created_at ) - return self._NoneIfNotSet( self._created_at ) + def created_at(self): + self._completeIfNotSet(self._created_at) + return self._NoneIfNotSet(self._created_at) @property - def id( self ): - self._completeIfNotSet( self._id ) - return self._NoneIfNotSet( self._id ) + def id(self): + self._completeIfNotSet(self._id) + return self._NoneIfNotSet(self._id) @property - def note( self ): - self._completeIfNotSet( self._note ) - return self._NoneIfNotSet( self._note ) + def note(self): + self._completeIfNotSet(self._note) + return self._NoneIfNotSet(self._note) @property - def note_url( self ): - self._completeIfNotSet( self._note_url ) - return self._NoneIfNotSet( self._note_url ) + def note_url(self): + self._completeIfNotSet(self._note_url) + return self._NoneIfNotSet(self._note_url) @property - def scopes( self ): - self._completeIfNotSet( self._scopes ) - return self._NoneIfNotSet( self._scopes ) + def scopes(self): + self._completeIfNotSet(self._scopes) + return self._NoneIfNotSet(self._scopes) @property - def token( self ): - self._completeIfNotSet( self._token ) - return self._NoneIfNotSet( self._token ) + def token(self): + self._completeIfNotSet(self._token) + return self._NoneIfNotSet(self._token) @property - def updated_at( self ): - self._completeIfNotSet( self._updated_at ) - return self._NoneIfNotSet( self._updated_at ) + def updated_at(self): + self._completeIfNotSet(self._updated_at) + return self._NoneIfNotSet(self._updated_at) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) - def delete( self ): + def delete(self): headers, data = self._requester.requestAndCheck( "DELETE", self.url, @@ -69,67 +72,67 @@ class Authorization( GithubObject.GithubObject ): None ) - def edit( self, scopes = GithubObject.NotSet, add_scopes = GithubObject.NotSet, remove_scopes = GithubObject.NotSet, note = GithubObject.NotSet, note_url = GithubObject.NotSet ): - assert scopes is GithubObject.NotSet or all( isinstance( element, ( str, unicode ) ) for element in scopes ), scopes - assert add_scopes is GithubObject.NotSet or all( isinstance( element, ( str, unicode ) ) for element in add_scopes ), add_scopes - assert remove_scopes is GithubObject.NotSet or all( isinstance( element, ( str, unicode ) ) for element in remove_scopes ), remove_scopes - assert note is GithubObject.NotSet or isinstance( note, ( str, unicode ) ), note - assert note_url is GithubObject.NotSet or isinstance( note_url, ( str, unicode ) ), note_url + def edit(self, scopes=github.GithubObject.NotSet, add_scopes=github.GithubObject.NotSet, remove_scopes=github.GithubObject.NotSet, note=github.GithubObject.NotSet, note_url=github.GithubObject.NotSet): + assert scopes is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in scopes), scopes + assert add_scopes is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in add_scopes), add_scopes + assert remove_scopes is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in remove_scopes), remove_scopes + assert note is github.GithubObject.NotSet or isinstance(note, (str, unicode)), note + assert note_url is github.GithubObject.NotSet or isinstance(note_url, (str, unicode)), note_url post_parameters = dict() - if scopes is not GithubObject.NotSet: - post_parameters[ "scopes" ] = scopes - if add_scopes is not GithubObject.NotSet: - post_parameters[ "add_scopes" ] = add_scopes - if remove_scopes is not GithubObject.NotSet: - post_parameters[ "remove_scopes" ] = remove_scopes - if note is not GithubObject.NotSet: - post_parameters[ "note" ] = note - if note_url is not GithubObject.NotSet: - post_parameters[ "note_url" ] = note_url + if scopes is not github.GithubObject.NotSet: + post_parameters["scopes"] = scopes + if add_scopes is not github.GithubObject.NotSet: + post_parameters["add_scopes"] = add_scopes + if remove_scopes is not github.GithubObject.NotSet: + post_parameters["remove_scopes"] = remove_scopes + if note is not github.GithubObject.NotSet: + post_parameters["note"] = note + if note_url is not github.GithubObject.NotSet: + post_parameters["note_url"] = note_url headers, data = self._requester.requestAndCheck( "PATCH", self.url, None, post_parameters ) - self._useAttributes( data ) + self._useAttributes(data) - def _initAttributes( self ): - self._app = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._id = GithubObject.NotSet - self._note = GithubObject.NotSet - self._note_url = GithubObject.NotSet - self._scopes = GithubObject.NotSet - self._token = GithubObject.NotSet - self._updated_at = GithubObject.NotSet - self._url = GithubObject.NotSet + def _initAttributes(self): + self._app = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._note = github.GithubObject.NotSet + self._note_url = github.GithubObject.NotSet + self._scopes = github.GithubObject.NotSet + self._token = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "app" in attributes: # pragma no branch - assert attributes[ "app" ] is None or isinstance( attributes[ "app" ], dict ), attributes[ "app" ] - self._app = None if attributes[ "app" ] is None else AuthorizationApplication.AuthorizationApplication( self._requester, attributes[ "app" ], completed = False ) - if "created_at" in attributes: # pragma no branch - assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = self._parseDatetime( attributes[ "created_at" ] ) - if "id" in attributes: # pragma no branch - assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] - self._id = attributes[ "id" ] - if "note" in attributes: # pragma no branch - assert attributes[ "note" ] is None or isinstance( attributes[ "note" ], ( str, unicode ) ), attributes[ "note" ] - self._note = attributes[ "note" ] - if "note_url" in attributes: # pragma no branch - assert attributes[ "note_url" ] is None or isinstance( attributes[ "note_url" ], ( str, unicode ) ), attributes[ "note_url" ] - self._note_url = attributes[ "note_url" ] - if "scopes" in attributes: # pragma no branch - assert attributes[ "scopes" ] is None or all( isinstance( element, ( str, unicode ) ) for element in attributes[ "scopes" ] ), attributes[ "scopes" ] - self._scopes = attributes[ "scopes" ] - if "token" in attributes: # pragma no branch - assert attributes[ "token" ] is None or isinstance( attributes[ "token" ], ( str, unicode ) ), attributes[ "token" ] - self._token = attributes[ "token" ] - if "updated_at" in attributes: # pragma no branch - assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ] - self._updated_at = self._parseDatetime( attributes[ "updated_at" ] ) - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] + def _useAttributes(self, attributes): + if "app" in attributes: # pragma no branch + assert attributes["app"] is None or isinstance(attributes["app"], dict), attributes["app"] + self._app = None if attributes["app"] is None else github.AuthorizationApplication.AuthorizationApplication(self._requester, attributes["app"], completed=False) + if "created_at" in attributes: # pragma no branch + assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"] + self._created_at = self._parseDatetime(attributes["created_at"]) + if "id" in attributes: # pragma no branch + assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] + self._id = attributes["id"] + if "note" in attributes: # pragma no branch + assert attributes["note"] is None or isinstance(attributes["note"], (str, unicode)), attributes["note"] + self._note = attributes["note"] + if "note_url" in attributes: # pragma no branch + assert attributes["note_url"] is None or isinstance(attributes["note_url"], (str, unicode)), attributes["note_url"] + self._note_url = attributes["note_url"] + if "scopes" in attributes: # pragma no branch + assert attributes["scopes"] is None or all(isinstance(element, (str, unicode)) for element in attributes["scopes"]), attributes["scopes"] + self._scopes = attributes["scopes"] + if "token" in attributes: # pragma no branch + assert attributes["token"] is None or isinstance(attributes["token"], (str, unicode)), attributes["token"] + self._token = attributes["token"] + if "updated_at" in attributes: # pragma no branch + assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], (str, unicode)), attributes["updated_at"] + self._updated_at = self._parseDatetime(attributes["updated_at"]) + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] diff --git a/github/AuthorizationApplication.py b/github/AuthorizationApplication.py index ea79de42..15326561 100644 --- a/github/AuthorizationApplication.py +++ b/github/AuthorizationApplication.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,27 +13,28 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class AuthorizationApplication( GithubObject.GithubObject ): + +class AuthorizationApplication(github.GithubObject.GithubObject): @property - def name( self ): - self._completeIfNotSet( self._name ) - return self._NoneIfNotSet( self._name ) + def name(self): + self._completeIfNotSet(self._name) + return self._NoneIfNotSet(self._name) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) - def _initAttributes( self ): - self._name = GithubObject.NotSet - self._url = GithubObject.NotSet + def _initAttributes(self): + self._name = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "name" in attributes: # pragma no branch - assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ] - self._name = attributes[ "name" ] - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] + def _useAttributes(self, attributes): + if "name" in attributes: # pragma no branch + assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] + self._name = attributes["name"] + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] diff --git a/github/Branch.py b/github/Branch.py index f37da93e..c843d54e 100644 --- a/github/Branch.py +++ b/github/Branch.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,27 +13,28 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import Commit +import github.Commit -class Branch( GithubObject.BasicGithubObject ): + +class Branch(github.GithubObject.BasicGithubObject): @property - def commit( self ): - return self._NoneIfNotSet( self._commit ) + def commit(self): + return self._NoneIfNotSet(self._commit) @property - def name( self ): - return self._NoneIfNotSet( self._name ) + def name(self): + return self._NoneIfNotSet(self._name) - def _initAttributes( self ): - self._commit = GithubObject.NotSet - self._name = GithubObject.NotSet + def _initAttributes(self): + self._commit = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "commit" in attributes: # pragma no branch - assert attributes[ "commit" ] is None or isinstance( attributes[ "commit" ], dict ), attributes[ "commit" ] - self._commit = None if attributes[ "commit" ] is None else Commit.Commit( self._requester, attributes[ "commit" ], completed = False ) - if "name" in attributes: # pragma no branch - assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ] - self._name = attributes[ "name" ] + def _useAttributes(self, attributes): + if "commit" in attributes: # pragma no branch + assert attributes["commit"] is None or isinstance(attributes["commit"], dict), attributes["commit"] + self._commit = None if attributes["commit"] is None else github.Commit.Commit(self._requester, attributes["commit"], completed=False) + if "name" in attributes: # pragma no branch + assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] + self._name = attributes["name"] diff --git a/github/Commit.py b/github/Commit.py index 7db6a17f..6998596e 100644 --- a/github/Commit.py +++ b/github/Commit.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,157 +13,157 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject -import PaginatedList +import github.GithubObject +import github.PaginatedList -import GitCommit -import NamedUser -import CommitStatus -import File -import CommitStats -import Commit -import CommitComment +import github.GitCommit +import github.NamedUser +import github.CommitStatus +import github.File +import github.CommitStats +import github.CommitComment -class Commit( GithubObject.GithubObject ): + +class Commit(github.GithubObject.GithubObject): @property - def author( self ): - self._completeIfNotSet( self._author ) - return self._NoneIfNotSet( self._author ) + def author(self): + self._completeIfNotSet(self._author) + return self._NoneIfNotSet(self._author) @property - def commit( self ): - self._completeIfNotSet( self._commit ) - return self._NoneIfNotSet( self._commit ) + def commit(self): + self._completeIfNotSet(self._commit) + return self._NoneIfNotSet(self._commit) @property - def committer( self ): - self._completeIfNotSet( self._committer ) - return self._NoneIfNotSet( self._committer ) + def committer(self): + self._completeIfNotSet(self._committer) + return self._NoneIfNotSet(self._committer) @property - def files( self ): - self._completeIfNotSet( self._files ) - return self._NoneIfNotSet( self._files ) + def files(self): + self._completeIfNotSet(self._files) + return self._NoneIfNotSet(self._files) @property - def parents( self ): - self._completeIfNotSet( self._parents ) - return self._NoneIfNotSet( self._parents ) + def parents(self): + self._completeIfNotSet(self._parents) + return self._NoneIfNotSet(self._parents) @property - def sha( self ): - self._completeIfNotSet( self._sha ) - return self._NoneIfNotSet( self._sha ) + def sha(self): + self._completeIfNotSet(self._sha) + return self._NoneIfNotSet(self._sha) @property - def stats( self ): - self._completeIfNotSet( self._stats ) - return self._NoneIfNotSet( self._stats ) + def stats(self): + self._completeIfNotSet(self._stats) + return self._NoneIfNotSet(self._stats) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) - def create_comment( self, body, line = GithubObject.NotSet, path = GithubObject.NotSet, position = GithubObject.NotSet ): - assert isinstance( body, ( str, unicode ) ), body - assert line is GithubObject.NotSet or isinstance( line, int ), line - assert path is GithubObject.NotSet or isinstance( path, ( str, unicode ) ), path - assert position is GithubObject.NotSet or isinstance( position, int ), position + def create_comment(self, body, line=github.GithubObject.NotSet, path=github.GithubObject.NotSet, position=github.GithubObject.NotSet): + assert isinstance(body, (str, unicode)), body + assert line is github.GithubObject.NotSet or isinstance(line, (int, long)), line + assert path is github.GithubObject.NotSet or isinstance(path, (str, unicode)), path + assert position is github.GithubObject.NotSet or isinstance(position, (int, long)), position post_parameters = { "body": body, } - if line is not GithubObject.NotSet: - post_parameters[ "line" ] = line - if path is not GithubObject.NotSet: - post_parameters[ "path" ] = path - if position is not GithubObject.NotSet: - post_parameters[ "position" ] = position + if line is not github.GithubObject.NotSet: + post_parameters["line"] = line + if path is not github.GithubObject.NotSet: + post_parameters["path"] = path + if position is not github.GithubObject.NotSet: + post_parameters["position"] = position headers, data = self._requester.requestAndCheck( "POST", self.url + "/comments", None, post_parameters ) - return CommitComment.CommitComment( self._requester, data, completed = True ) + return github.CommitComment.CommitComment(self._requester, data, completed=True) - def create_status( self, state, target_url = GithubObject.NotSet, description = GithubObject.NotSet ): - assert isinstance( state, ( str, unicode ) ), state - assert target_url is GithubObject.NotSet or isinstance( target_url, ( str, unicode ) ), target_url - assert description is GithubObject.NotSet or isinstance( description, ( str, unicode ) ), description + def create_status(self, state, target_url=github.GithubObject.NotSet, description=github.GithubObject.NotSet): + assert isinstance(state, (str, unicode)), state + assert target_url is github.GithubObject.NotSet or isinstance(target_url, (str, unicode)), target_url + assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description post_parameters = { "state": state, } - if target_url is not GithubObject.NotSet: - post_parameters[ "target_url" ] = target_url - if description is not GithubObject.NotSet: - post_parameters[ "description" ] = description + if target_url is not github.GithubObject.NotSet: + post_parameters["target_url"] = target_url + if description is not github.GithubObject.NotSet: + post_parameters["description"] = description headers, data = self._requester.requestAndCheck( "POST", - self._parentUrl( self._parentUrl( self.url ) ) + "/statuses/" + self.sha, + self._parentUrl(self._parentUrl(self.url)) + "/statuses/" + self.sha, None, post_parameters ) - return CommitStatus.CommitStatus( self._requester, data, completed = True ) + return github.CommitStatus.CommitStatus(self._requester, data, completed=True) - def get_comments( self ): - return PaginatedList.PaginatedList( - CommitComment.CommitComment, + def get_comments(self): + return github.PaginatedList.PaginatedList( + github.CommitComment.CommitComment, self._requester, self.url + "/comments", None ) - def get_statuses( self ): - return PaginatedList.PaginatedList( - CommitStatus.CommitStatus, + def get_statuses(self): + return github.PaginatedList.PaginatedList( + github.CommitStatus.CommitStatus, self._requester, - self._parentUrl( self._parentUrl( self.url ) ) + "/statuses/" + self.sha, + self._parentUrl(self._parentUrl(self.url)) + "/statuses/" + self.sha, None ) @property - def _identity( self ): + def _identity(self): return self.sha - def _initAttributes( self ): - self._author = GithubObject.NotSet - self._commit = GithubObject.NotSet - self._committer = GithubObject.NotSet - self._files = GithubObject.NotSet - self._parents = GithubObject.NotSet - self._sha = GithubObject.NotSet - self._stats = GithubObject.NotSet - self._url = GithubObject.NotSet + def _initAttributes(self): + self._author = github.GithubObject.NotSet + self._commit = github.GithubObject.NotSet + self._committer = github.GithubObject.NotSet + self._files = github.GithubObject.NotSet + self._parents = github.GithubObject.NotSet + self._sha = github.GithubObject.NotSet + self._stats = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "author" in attributes: # pragma no branch - assert attributes[ "author" ] is None or isinstance( attributes[ "author" ], dict ), attributes[ "author" ] - self._author = None if attributes[ "author" ] is None else NamedUser.NamedUser( self._requester, attributes[ "author" ], completed = False ) - if "commit" in attributes: # pragma no branch - assert attributes[ "commit" ] is None or isinstance( attributes[ "commit" ], dict ), attributes[ "commit" ] - self._commit = None if attributes[ "commit" ] is None else GitCommit.GitCommit( self._requester, attributes[ "commit" ], completed = False ) - if "committer" in attributes: # pragma no branch - assert attributes[ "committer" ] is None or isinstance( attributes[ "committer" ], dict ), attributes[ "committer" ] - self._committer = None if attributes[ "committer" ] is None else NamedUser.NamedUser( self._requester, attributes[ "committer" ], completed = False ) - if "files" in attributes: # pragma no branch - assert attributes[ "files" ] is None or all( isinstance( element, dict ) for element in attributes[ "files" ] ), attributes[ "files" ] - self._files = None if attributes[ "files" ] is None else [ - File.File( self._requester, element, completed = False ) - for element in attributes[ "files" ] + def _useAttributes(self, attributes): + if "author" in attributes: # pragma no branch + assert attributes["author"] is None or isinstance(attributes["author"], dict), attributes["author"] + self._author = None if attributes["author"] is None else github.NamedUser.NamedUser(self._requester, attributes["author"], completed=False) + if "commit" in attributes: # pragma no branch + assert attributes["commit"] is None or isinstance(attributes["commit"], dict), attributes["commit"] + self._commit = None if attributes["commit"] is None else github.GitCommit.GitCommit(self._requester, attributes["commit"], completed=False) + if "committer" in attributes: # pragma no branch + assert attributes["committer"] is None or isinstance(attributes["committer"], dict), attributes["committer"] + self._committer = None if attributes["committer"] is None else github.NamedUser.NamedUser(self._requester, attributes["committer"], completed=False) + if "files" in attributes: # pragma no branch + assert attributes["files"] is None or all(isinstance(element, dict) for element in attributes["files"]), attributes["files"] + self._files = None if attributes["files"] is None else [ + github.File.File(self._requester, element, completed=False) + for element in attributes["files"] ] - if "parents" in attributes: # pragma no branch - assert attributes[ "parents" ] is None or all( isinstance( element, dict ) for element in attributes[ "parents" ] ), attributes[ "parents" ] - self._parents = None if attributes[ "parents" ] is None else [ - Commit( self._requester, element, completed = False ) - for element in attributes[ "parents" ] + if "parents" in attributes: # pragma no branch + assert attributes["parents"] is None or all(isinstance(element, dict) for element in attributes["parents"]), attributes["parents"] + self._parents = None if attributes["parents"] is None else [ + Commit(self._requester, element, completed=False) + for element in attributes["parents"] ] - if "sha" in attributes: # pragma no branch - assert attributes[ "sha" ] is None or isinstance( attributes[ "sha" ], ( str, unicode ) ), attributes[ "sha" ] - self._sha = attributes[ "sha" ] - if "stats" in attributes: # pragma no branch - assert attributes[ "stats" ] is None or isinstance( attributes[ "stats" ], dict ), attributes[ "stats" ] - self._stats = None if attributes[ "stats" ] is None else CommitStats.CommitStats( self._requester, attributes[ "stats" ], completed = False ) - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] + if "sha" in attributes: # pragma no branch + assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"] + self._sha = attributes["sha"] + if "stats" in attributes: # pragma no branch + assert attributes["stats"] is None or isinstance(attributes["stats"], dict), attributes["stats"] + self._stats = None if attributes["stats"] is None else github.CommitStats.CommitStats(self._requester, attributes["stats"], completed=False) + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] diff --git a/github/CommitComment.py b/github/CommitComment.py index 1e42af84..f5d93c72 100644 --- a/github/CommitComment.py +++ b/github/CommitComment.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,67 +13,68 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import NamedUser +import github.NamedUser -class CommitComment( GithubObject.GithubObject ): + +class CommitComment(github.GithubObject.GithubObject): @property - def body( self ): - self._completeIfNotSet( self._body ) - return self._NoneIfNotSet( self._body ) + def body(self): + self._completeIfNotSet(self._body) + return self._NoneIfNotSet(self._body) @property - def commit_id( self ): - self._completeIfNotSet( self._commit_id ) - return self._NoneIfNotSet( self._commit_id ) + def commit_id(self): + self._completeIfNotSet(self._commit_id) + return self._NoneIfNotSet(self._commit_id) @property - def created_at( self ): - self._completeIfNotSet( self._created_at ) - return self._NoneIfNotSet( self._created_at ) + def created_at(self): + self._completeIfNotSet(self._created_at) + return self._NoneIfNotSet(self._created_at) @property - def html_url( self ): - self._completeIfNotSet( self._html_url ) - return self._NoneIfNotSet( self._html_url ) + def html_url(self): + self._completeIfNotSet(self._html_url) + return self._NoneIfNotSet(self._html_url) @property - def id( self ): - self._completeIfNotSet( self._id ) - return self._NoneIfNotSet( self._id ) + def id(self): + self._completeIfNotSet(self._id) + return self._NoneIfNotSet(self._id) @property - def line( self ): - self._completeIfNotSet( self._line ) - return self._NoneIfNotSet( self._line ) + def line(self): + self._completeIfNotSet(self._line) + return self._NoneIfNotSet(self._line) @property - def path( self ): - self._completeIfNotSet( self._path ) - return self._NoneIfNotSet( self._path ) + def path(self): + self._completeIfNotSet(self._path) + return self._NoneIfNotSet(self._path) @property - def position( self ): - self._completeIfNotSet( self._position ) - return self._NoneIfNotSet( self._position ) + def position(self): + self._completeIfNotSet(self._position) + return self._NoneIfNotSet(self._position) @property - def updated_at( self ): - self._completeIfNotSet( self._updated_at ) - return self._NoneIfNotSet( self._updated_at ) + def updated_at(self): + self._completeIfNotSet(self._updated_at) + return self._NoneIfNotSet(self._updated_at) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) @property - def user( self ): - self._completeIfNotSet( self._user ) - return self._NoneIfNotSet( self._user ) + def user(self): + self._completeIfNotSet(self._user) + return self._NoneIfNotSet(self._user) - def delete( self ): + def delete(self): headers, data = self._requester.requestAndCheck( "DELETE", self.url, @@ -79,8 +82,8 @@ class CommitComment( GithubObject.GithubObject ): None ) - def edit( self, body ): - assert isinstance( body, ( str, unicode ) ), body + def edit(self, body): + assert isinstance(body, (str, unicode)), body post_parameters = { "body": body, } @@ -90,52 +93,52 @@ class CommitComment( GithubObject.GithubObject ): None, post_parameters ) - self._useAttributes( data ) + self._useAttributes(data) - def _initAttributes( self ): - self._body = GithubObject.NotSet - self._commit_id = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._html_url = GithubObject.NotSet - self._id = GithubObject.NotSet - self._line = GithubObject.NotSet - self._path = GithubObject.NotSet - self._position = GithubObject.NotSet - self._updated_at = GithubObject.NotSet - self._url = GithubObject.NotSet - self._user = GithubObject.NotSet + def _initAttributes(self): + self._body = github.GithubObject.NotSet + self._commit_id = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._html_url = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._line = github.GithubObject.NotSet + self._path = github.GithubObject.NotSet + self._position = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + self._user = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "body" in attributes: # pragma no branch - assert attributes[ "body" ] is None or isinstance( attributes[ "body" ], ( str, unicode ) ), attributes[ "body" ] - self._body = attributes[ "body" ] - if "commit_id" in attributes: # pragma no branch - assert attributes[ "commit_id" ] is None or isinstance( attributes[ "commit_id" ], ( str, unicode ) ), attributes[ "commit_id" ] - self._commit_id = attributes[ "commit_id" ] - if "created_at" in attributes: # pragma no branch - assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = self._parseDatetime( attributes[ "created_at" ] ) - if "html_url" in attributes: # pragma no branch - assert attributes[ "html_url" ] is None or isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ] - self._html_url = attributes[ "html_url" ] - if "id" in attributes: # pragma no branch - assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] - self._id = attributes[ "id" ] - if "line" in attributes: # pragma no branch - assert attributes[ "line" ] is None or isinstance( attributes[ "line" ], int ), attributes[ "line" ] - self._line = attributes[ "line" ] - if "path" in attributes: # pragma no branch - assert attributes[ "path" ] is None or isinstance( attributes[ "path" ], ( str, unicode ) ), attributes[ "path" ] - self._path = attributes[ "path" ] - if "position" in attributes: # pragma no branch - assert attributes[ "position" ] is None or isinstance( attributes[ "position" ], int ), attributes[ "position" ] - self._position = attributes[ "position" ] - if "updated_at" in attributes: # pragma no branch - assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ] - self._updated_at = self._parseDatetime( attributes[ "updated_at" ] ) - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] - if "user" in attributes: # pragma no branch - assert attributes[ "user" ] is None or isinstance( attributes[ "user" ], dict ), attributes[ "user" ] - self._user = None if attributes[ "user" ] is None else NamedUser.NamedUser( self._requester, attributes[ "user" ], completed = False ) + def _useAttributes(self, attributes): + if "body" in attributes: # pragma no branch + assert attributes["body"] is None or isinstance(attributes["body"], (str, unicode)), attributes["body"] + self._body = attributes["body"] + if "commit_id" in attributes: # pragma no branch + assert attributes["commit_id"] is None or isinstance(attributes["commit_id"], (str, unicode)), attributes["commit_id"] + self._commit_id = attributes["commit_id"] + if "created_at" in attributes: # pragma no branch + assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"] + self._created_at = self._parseDatetime(attributes["created_at"]) + if "html_url" in attributes: # pragma no branch + assert attributes["html_url"] is None or isinstance(attributes["html_url"], (str, unicode)), attributes["html_url"] + self._html_url = attributes["html_url"] + if "id" in attributes: # pragma no branch + assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] + self._id = attributes["id"] + if "line" in attributes: # pragma no branch + assert attributes["line"] is None or isinstance(attributes["line"], (int, long)), attributes["line"] + self._line = attributes["line"] + if "path" in attributes: # pragma no branch + assert attributes["path"] is None or isinstance(attributes["path"], (str, unicode)), attributes["path"] + self._path = attributes["path"] + if "position" in attributes: # pragma no branch + assert attributes["position"] is None or isinstance(attributes["position"], (int, long)), attributes["position"] + self._position = attributes["position"] + if "updated_at" in attributes: # pragma no branch + assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], (str, unicode)), attributes["updated_at"] + self._updated_at = self._parseDatetime(attributes["updated_at"]) + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] + if "user" in attributes: # pragma no branch + assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"] + self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False) diff --git a/github/CommitStats.py b/github/CommitStats.py index c0217975..7740614b 100644 --- a/github/CommitStats.py +++ b/github/CommitStats.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,33 +13,34 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class CommitStats( GithubObject.BasicGithubObject ): + +class CommitStats(github.GithubObject.BasicGithubObject): @property - def additions( self ): - return self._NoneIfNotSet( self._additions ) + def additions(self): + return self._NoneIfNotSet(self._additions) @property - def deletions( self ): - return self._NoneIfNotSet( self._deletions ) + def deletions(self): + return self._NoneIfNotSet(self._deletions) @property - def total( self ): - return self._NoneIfNotSet( self._total ) + def total(self): + return self._NoneIfNotSet(self._total) - def _initAttributes( self ): - self._additions = GithubObject.NotSet - self._deletions = GithubObject.NotSet - self._total = GithubObject.NotSet + def _initAttributes(self): + self._additions = github.GithubObject.NotSet + self._deletions = github.GithubObject.NotSet + self._total = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "additions" in attributes: # pragma no branch - assert attributes[ "additions" ] is None or isinstance( attributes[ "additions" ], int ), attributes[ "additions" ] - self._additions = attributes[ "additions" ] - if "deletions" in attributes: # pragma no branch - assert attributes[ "deletions" ] is None or isinstance( attributes[ "deletions" ], int ), attributes[ "deletions" ] - self._deletions = attributes[ "deletions" ] - if "total" in attributes: # pragma no branch - assert attributes[ "total" ] is None or isinstance( attributes[ "total" ], int ), attributes[ "total" ] - self._total = attributes[ "total" ] + def _useAttributes(self, attributes): + if "additions" in attributes: # pragma no branch + assert attributes["additions"] is None or isinstance(attributes["additions"], (int, long)), attributes["additions"] + self._additions = attributes["additions"] + if "deletions" in attributes: # pragma no branch + assert attributes["deletions"] is None or isinstance(attributes["deletions"], (int, long)), attributes["deletions"] + self._deletions = attributes["deletions"] + if "total" in attributes: # pragma no branch + assert attributes["total"] is None or isinstance(attributes["total"], (int, long)), attributes["total"] + self._total = attributes["total"] diff --git a/github/CommitStatus.py b/github/CommitStatus.py index c6f11679..29b7e43b 100644 --- a/github/CommitStatus.py +++ b/github/CommitStatus.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,67 +13,68 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import NamedUser +import github.NamedUser -class CommitStatus( GithubObject.BasicGithubObject ): + +class CommitStatus(github.GithubObject.BasicGithubObject): @property - def created_at( self ): - return self._NoneIfNotSet( self._created_at ) + def created_at(self): + return self._NoneIfNotSet(self._created_at) @property - def creator( self ): - return self._NoneIfNotSet( self._creator ) + def creator(self): + return self._NoneIfNotSet(self._creator) @property - def description( self ): - return self._NoneIfNotSet( self._description ) + def description(self): + return self._NoneIfNotSet(self._description) @property - def id( self ): - return self._NoneIfNotSet( self._id ) + def id(self): + return self._NoneIfNotSet(self._id) @property - def state( self ): - return self._NoneIfNotSet( self._state ) + def state(self): + return self._NoneIfNotSet(self._state) @property - def target_url( self ): - return self._NoneIfNotSet( self._target_url ) + def target_url(self): + return self._NoneIfNotSet(self._target_url) @property - def updated_at( self ): - return self._NoneIfNotSet( self._updated_at ) + def updated_at(self): + return self._NoneIfNotSet(self._updated_at) - def _initAttributes( self ): - self._created_at = GithubObject.NotSet - self._creator = GithubObject.NotSet - self._description = GithubObject.NotSet - self._id = GithubObject.NotSet - self._state = GithubObject.NotSet - self._target_url = GithubObject.NotSet - self._updated_at = GithubObject.NotSet + def _initAttributes(self): + self._created_at = github.GithubObject.NotSet + self._creator = github.GithubObject.NotSet + self._description = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._state = github.GithubObject.NotSet + self._target_url = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "created_at" in attributes: # pragma no branch - assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = self._parseDatetime( attributes[ "created_at" ] ) - if "creator" in attributes: # pragma no branch - assert attributes[ "creator" ] is None or isinstance( attributes[ "creator" ], dict ), attributes[ "creator" ] - self._creator = None if attributes[ "creator" ] is None else NamedUser.NamedUser( self._requester, attributes[ "creator" ], completed = False ) - if "description" in attributes: # pragma no branch - assert attributes[ "description" ] is None or isinstance( attributes[ "description" ], ( str, unicode ) ), attributes[ "description" ] - self._description = attributes[ "description" ] - if "id" in attributes: # pragma no branch - assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] - self._id = attributes[ "id" ] - if "state" in attributes: # pragma no branch - assert attributes[ "state" ] is None or isinstance( attributes[ "state" ], ( str, unicode ) ), attributes[ "state" ] - self._state = attributes[ "state" ] - if "target_url" in attributes: # pragma no branch - assert attributes[ "target_url" ] is None or isinstance( attributes[ "target_url" ], ( str, unicode ) ), attributes[ "target_url" ] - self._target_url = attributes[ "target_url" ] - if "updated_at" in attributes: # pragma no branch - assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ] - self._updated_at = self._parseDatetime( attributes[ "updated_at" ] ) + def _useAttributes(self, attributes): + if "created_at" in attributes: # pragma no branch + assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"] + self._created_at = self._parseDatetime(attributes["created_at"]) + if "creator" in attributes: # pragma no branch + assert attributes["creator"] is None or isinstance(attributes["creator"], dict), attributes["creator"] + self._creator = None if attributes["creator"] is None else github.NamedUser.NamedUser(self._requester, attributes["creator"], completed=False) + if "description" in attributes: # pragma no branch + assert attributes["description"] is None or isinstance(attributes["description"], (str, unicode)), attributes["description"] + self._description = attributes["description"] + if "id" in attributes: # pragma no branch + assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] + self._id = attributes["id"] + if "state" in attributes: # pragma no branch + assert attributes["state"] is None or isinstance(attributes["state"], (str, unicode)), attributes["state"] + self._state = attributes["state"] + if "target_url" in attributes: # pragma no branch + assert attributes["target_url"] is None or isinstance(attributes["target_url"], (str, unicode)), attributes["target_url"] + self._target_url = attributes["target_url"] + if "updated_at" in attributes: # pragma no branch + assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], (str, unicode)), attributes["updated_at"] + self._updated_at = self._parseDatetime(attributes["updated_at"]) diff --git a/github/Comparison.py b/github/Comparison.py index 0961d60d..8fe9771e 100644 --- a/github/Comparison.py +++ b/github/Comparison.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,126 +13,127 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import Commit -import File +import github.Commit +import github.File -class Comparison( GithubObject.GithubObject ): + +class Comparison(github.GithubObject.GithubObject): @property - def ahead_by( self ): - self._completeIfNotSet( self._ahead_by ) - return self._NoneIfNotSet( self._ahead_by ) + def ahead_by(self): + self._completeIfNotSet(self._ahead_by) + return self._NoneIfNotSet(self._ahead_by) @property - def base_commit( self ): - self._completeIfNotSet( self._base_commit ) - return self._NoneIfNotSet( self._base_commit ) + def base_commit(self): + self._completeIfNotSet(self._base_commit) + return self._NoneIfNotSet(self._base_commit) @property - def behind_by( self ): - self._completeIfNotSet( self._behind_by ) - return self._NoneIfNotSet( self._behind_by ) + def behind_by(self): + self._completeIfNotSet(self._behind_by) + return self._NoneIfNotSet(self._behind_by) @property - def commits( self ): - self._completeIfNotSet( self._commits ) - return self._NoneIfNotSet( self._commits ) + def commits(self): + self._completeIfNotSet(self._commits) + return self._NoneIfNotSet(self._commits) @property - def diff_url( self ): - self._completeIfNotSet( self._diff_url ) - return self._NoneIfNotSet( self._diff_url ) + def diff_url(self): + self._completeIfNotSet(self._diff_url) + return self._NoneIfNotSet(self._diff_url) @property - def files( self ): - self._completeIfNotSet( self._files ) - return self._NoneIfNotSet( self._files ) + def files(self): + self._completeIfNotSet(self._files) + return self._NoneIfNotSet(self._files) @property - def html_url( self ): - self._completeIfNotSet( self._html_url ) - return self._NoneIfNotSet( self._html_url ) + def html_url(self): + self._completeIfNotSet(self._html_url) + return self._NoneIfNotSet(self._html_url) @property - def patch_url( self ): - self._completeIfNotSet( self._patch_url ) - return self._NoneIfNotSet( self._patch_url ) + def patch_url(self): + self._completeIfNotSet(self._patch_url) + return self._NoneIfNotSet(self._patch_url) @property - def permalink_url( self ): - self._completeIfNotSet( self._permalink_url ) - return self._NoneIfNotSet( self._permalink_url ) + def permalink_url(self): + self._completeIfNotSet(self._permalink_url) + return self._NoneIfNotSet(self._permalink_url) @property - def status( self ): - self._completeIfNotSet( self._status ) - return self._NoneIfNotSet( self._status ) + def status(self): + self._completeIfNotSet(self._status) + return self._NoneIfNotSet(self._status) @property - def total_commits( self ): - self._completeIfNotSet( self._total_commits ) - return self._NoneIfNotSet( self._total_commits ) + def total_commits(self): + self._completeIfNotSet(self._total_commits) + return self._NoneIfNotSet(self._total_commits) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) - def _initAttributes( self ): - self._ahead_by = GithubObject.NotSet - self._base_commit = GithubObject.NotSet - self._behind_by = GithubObject.NotSet - self._commits = GithubObject.NotSet - self._diff_url = GithubObject.NotSet - self._files = GithubObject.NotSet - self._html_url = GithubObject.NotSet - self._patch_url = GithubObject.NotSet - self._permalink_url = GithubObject.NotSet - self._status = GithubObject.NotSet - self._total_commits = GithubObject.NotSet - self._url = GithubObject.NotSet + def _initAttributes(self): + self._ahead_by = github.GithubObject.NotSet + self._base_commit = github.GithubObject.NotSet + self._behind_by = github.GithubObject.NotSet + self._commits = github.GithubObject.NotSet + self._diff_url = github.GithubObject.NotSet + self._files = github.GithubObject.NotSet + self._html_url = github.GithubObject.NotSet + self._patch_url = github.GithubObject.NotSet + self._permalink_url = github.GithubObject.NotSet + self._status = github.GithubObject.NotSet + self._total_commits = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "ahead_by" in attributes: # pragma no branch - assert attributes[ "ahead_by" ] is None or isinstance( attributes[ "ahead_by" ], int ), attributes[ "ahead_by" ] - self._ahead_by = attributes[ "ahead_by" ] - if "base_commit" in attributes: # pragma no branch - assert attributes[ "base_commit" ] is None or isinstance( attributes[ "base_commit" ], dict ), attributes[ "base_commit" ] - self._base_commit = None if attributes[ "base_commit" ] is None else Commit.Commit( self._requester, attributes[ "base_commit" ], completed = False ) - if "behind_by" in attributes: # pragma no branch - assert attributes[ "behind_by" ] is None or isinstance( attributes[ "behind_by" ], int ), attributes[ "behind_by" ] - self._behind_by = attributes[ "behind_by" ] - if "commits" in attributes: # pragma no branch - assert attributes[ "commits" ] is None or all( isinstance( element, dict ) for element in attributes[ "commits" ] ), attributes[ "commits" ] - self._commits = None if attributes[ "commits" ] is None else [ - Commit.Commit( self._requester, element, completed = False ) - for element in attributes[ "commits" ] + def _useAttributes(self, attributes): + if "ahead_by" in attributes: # pragma no branch + assert attributes["ahead_by"] is None or isinstance(attributes["ahead_by"], (int, long)), attributes["ahead_by"] + self._ahead_by = attributes["ahead_by"] + if "base_commit" in attributes: # pragma no branch + assert attributes["base_commit"] is None or isinstance(attributes["base_commit"], dict), attributes["base_commit"] + self._base_commit = None if attributes["base_commit"] is None else github.Commit.Commit(self._requester, attributes["base_commit"], completed=False) + if "behind_by" in attributes: # pragma no branch + assert attributes["behind_by"] is None or isinstance(attributes["behind_by"], (int, long)), attributes["behind_by"] + self._behind_by = attributes["behind_by"] + if "commits" in attributes: # pragma no branch + assert attributes["commits"] is None or all(isinstance(element, dict) for element in attributes["commits"]), attributes["commits"] + self._commits = None if attributes["commits"] is None else [ + github.Commit.Commit(self._requester, element, completed=False) + for element in attributes["commits"] ] - if "diff_url" in attributes: # pragma no branch - assert attributes[ "diff_url" ] is None or isinstance( attributes[ "diff_url" ], ( str, unicode ) ), attributes[ "diff_url" ] - self._diff_url = attributes[ "diff_url" ] - if "files" in attributes: # pragma no branch - assert attributes[ "files" ] is None or all( isinstance( element, dict ) for element in attributes[ "files" ] ), attributes[ "files" ] - self._files = None if attributes[ "files" ] is None else [ - File.File( self._requester, element, completed = False ) - for element in attributes[ "files" ] + if "diff_url" in attributes: # pragma no branch + assert attributes["diff_url"] is None or isinstance(attributes["diff_url"], (str, unicode)), attributes["diff_url"] + self._diff_url = attributes["diff_url"] + if "files" in attributes: # pragma no branch + assert attributes["files"] is None or all(isinstance(element, dict) for element in attributes["files"]), attributes["files"] + self._files = None if attributes["files"] is None else [ + github.File.File(self._requester, element, completed=False) + for element in attributes["files"] ] - if "html_url" in attributes: # pragma no branch - assert attributes[ "html_url" ] is None or isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ] - self._html_url = attributes[ "html_url" ] - if "patch_url" in attributes: # pragma no branch - assert attributes[ "patch_url" ] is None or isinstance( attributes[ "patch_url" ], ( str, unicode ) ), attributes[ "patch_url" ] - self._patch_url = attributes[ "patch_url" ] - if "permalink_url" in attributes: # pragma no branch - assert attributes[ "permalink_url" ] is None or isinstance( attributes[ "permalink_url" ], ( str, unicode ) ), attributes[ "permalink_url" ] - self._permalink_url = attributes[ "permalink_url" ] - if "status" in attributes: # pragma no branch - assert attributes[ "status" ] is None or isinstance( attributes[ "status" ], ( str, unicode ) ), attributes[ "status" ] - self._status = attributes[ "status" ] - if "total_commits" in attributes: # pragma no branch - assert attributes[ "total_commits" ] is None or isinstance( attributes[ "total_commits" ], int ), attributes[ "total_commits" ] - self._total_commits = attributes[ "total_commits" ] - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] + if "html_url" in attributes: # pragma no branch + assert attributes["html_url"] is None or isinstance(attributes["html_url"], (str, unicode)), attributes["html_url"] + self._html_url = attributes["html_url"] + if "patch_url" in attributes: # pragma no branch + assert attributes["patch_url"] is None or isinstance(attributes["patch_url"], (str, unicode)), attributes["patch_url"] + self._patch_url = attributes["patch_url"] + if "permalink_url" in attributes: # pragma no branch + assert attributes["permalink_url"] is None or isinstance(attributes["permalink_url"], (str, unicode)), attributes["permalink_url"] + self._permalink_url = attributes["permalink_url"] + if "status" in attributes: # pragma no branch + assert attributes["status"] is None or isinstance(attributes["status"], (str, unicode)), attributes["status"] + self._status = attributes["status"] + if "total_commits" in attributes: # pragma no branch + assert attributes["total_commits"] is None or isinstance(attributes["total_commits"], (int, long)), attributes["total_commits"] + self._total_commits = attributes["total_commits"] + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] diff --git a/github/ContentFile.py b/github/ContentFile.py index e1411596..4f43188c 100644 --- a/github/ContentFile.py +++ b/github/ContentFile.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,65 +13,66 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class ContentFile( GithubObject.BasicGithubObject ): + +class ContentFile(github.GithubObject.BasicGithubObject): @property - def content( self ): - return self._NoneIfNotSet( self._content ) + def content(self): + return self._NoneIfNotSet(self._content) @property - def encoding( self ): - return self._NoneIfNotSet( self._encoding ) + def encoding(self): + return self._NoneIfNotSet(self._encoding) @property - def name( self ): - return self._NoneIfNotSet( self._name ) + def name(self): + return self._NoneIfNotSet(self._name) @property - def path( self ): - return self._NoneIfNotSet( self._path ) + def path(self): + return self._NoneIfNotSet(self._path) @property - def sha( self ): - return self._NoneIfNotSet( self._sha ) + def sha(self): + return self._NoneIfNotSet(self._sha) @property - def size( self ): - return self._NoneIfNotSet( self._size ) + def size(self): + return self._NoneIfNotSet(self._size) @property - def type( self ): - return self._NoneIfNotSet( self._type ) + def type(self): + return self._NoneIfNotSet(self._type) - def _initAttributes( self ): - self._content = GithubObject.NotSet - self._encoding = GithubObject.NotSet - self._name = GithubObject.NotSet - self._path = GithubObject.NotSet - self._sha = GithubObject.NotSet - self._size = GithubObject.NotSet - self._type = GithubObject.NotSet + def _initAttributes(self): + self._content = github.GithubObject.NotSet + self._encoding = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._path = github.GithubObject.NotSet + self._sha = github.GithubObject.NotSet + self._size = github.GithubObject.NotSet + self._type = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "content" in attributes: # pragma no branch - assert attributes[ "content" ] is None or isinstance( attributes[ "content" ], ( str, unicode ) ), attributes[ "content" ] - self._content = attributes[ "content" ] - if "encoding" in attributes: # pragma no branch - assert attributes[ "encoding" ] is None or isinstance( attributes[ "encoding" ], ( str, unicode ) ), attributes[ "encoding" ] - self._encoding = attributes[ "encoding" ] - if "name" in attributes: # pragma no branch - assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ] - self._name = attributes[ "name" ] - if "path" in attributes: # pragma no branch - assert attributes[ "path" ] is None or isinstance( attributes[ "path" ], ( str, unicode ) ), attributes[ "path" ] - self._path = attributes[ "path" ] - if "sha" in attributes: # pragma no branch - assert attributes[ "sha" ] is None or isinstance( attributes[ "sha" ], ( str, unicode ) ), attributes[ "sha" ] - self._sha = attributes[ "sha" ] - if "size" in attributes: # pragma no branch - assert attributes[ "size" ] is None or isinstance( attributes[ "size" ], int ), attributes[ "size" ] - self._size = attributes[ "size" ] - if "type" in attributes: # pragma no branch - assert attributes[ "type" ] is None or isinstance( attributes[ "type" ], ( str, unicode ) ), attributes[ "type" ] - self._type = attributes[ "type" ] + def _useAttributes(self, attributes): + if "content" in attributes: # pragma no branch + assert attributes["content"] is None or isinstance(attributes["content"], (str, unicode)), attributes["content"] + self._content = attributes["content"] + if "encoding" in attributes: # pragma no branch + assert attributes["encoding"] is None or isinstance(attributes["encoding"], (str, unicode)), attributes["encoding"] + self._encoding = attributes["encoding"] + if "name" in attributes: # pragma no branch + assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] + self._name = attributes["name"] + if "path" in attributes: # pragma no branch + assert attributes["path"] is None or isinstance(attributes["path"], (str, unicode)), attributes["path"] + self._path = attributes["path"] + if "sha" in attributes: # pragma no branch + assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"] + self._sha = attributes["sha"] + if "size" in attributes: # pragma no branch + assert attributes["size"] is None or isinstance(attributes["size"], (int, long)), attributes["size"] + self._size = attributes["size"] + if "type" in attributes: # pragma no branch + assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"] + self._type = attributes["type"] diff --git a/github/Download.py b/github/Download.py index 7cf040fc..6e172a1e 100644 --- a/github/Download.py +++ b/github/Download.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,110 +13,111 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class Download( GithubObject.GithubObject ): + +class Download(github.GithubObject.GithubObject): @property - def accesskeyid( self ): - self._completeIfNotSet( self._accesskeyid ) - return self._NoneIfNotSet( self._accesskeyid ) + def accesskeyid(self): + self._completeIfNotSet(self._accesskeyid) + return self._NoneIfNotSet(self._accesskeyid) @property - def acl( self ): - self._completeIfNotSet( self._acl ) - return self._NoneIfNotSet( self._acl ) + def acl(self): + self._completeIfNotSet(self._acl) + return self._NoneIfNotSet(self._acl) @property - def bucket( self ): - self._completeIfNotSet( self._bucket ) - return self._NoneIfNotSet( self._bucket ) + def bucket(self): + self._completeIfNotSet(self._bucket) + return self._NoneIfNotSet(self._bucket) @property - def content_type( self ): - self._completeIfNotSet( self._content_type ) - return self._NoneIfNotSet( self._content_type ) + def content_type(self): + self._completeIfNotSet(self._content_type) + return self._NoneIfNotSet(self._content_type) @property - def created_at( self ): - self._completeIfNotSet( self._created_at ) - return self._NoneIfNotSet( self._created_at ) + def created_at(self): + self._completeIfNotSet(self._created_at) + return self._NoneIfNotSet(self._created_at) @property - def description( self ): - self._completeIfNotSet( self._description ) - return self._NoneIfNotSet( self._description ) + def description(self): + self._completeIfNotSet(self._description) + return self._NoneIfNotSet(self._description) @property - def download_count( self ): - self._completeIfNotSet( self._download_count ) - return self._NoneIfNotSet( self._download_count ) + def download_count(self): + self._completeIfNotSet(self._download_count) + return self._NoneIfNotSet(self._download_count) @property - def expirationdate( self ): - self._completeIfNotSet( self._expirationdate ) - return self._NoneIfNotSet( self._expirationdate ) + def expirationdate(self): + self._completeIfNotSet(self._expirationdate) + return self._NoneIfNotSet(self._expirationdate) @property - def html_url( self ): - self._completeIfNotSet( self._html_url ) - return self._NoneIfNotSet( self._html_url ) + def html_url(self): + self._completeIfNotSet(self._html_url) + return self._NoneIfNotSet(self._html_url) @property - def id( self ): - self._completeIfNotSet( self._id ) - return self._NoneIfNotSet( self._id ) + def id(self): + self._completeIfNotSet(self._id) + return self._NoneIfNotSet(self._id) @property - def mime_type( self ): - self._completeIfNotSet( self._mime_type ) - return self._NoneIfNotSet( self._mime_type ) + def mime_type(self): + self._completeIfNotSet(self._mime_type) + return self._NoneIfNotSet(self._mime_type) @property - def name( self ): - self._completeIfNotSet( self._name ) - return self._NoneIfNotSet( self._name ) + def name(self): + self._completeIfNotSet(self._name) + return self._NoneIfNotSet(self._name) @property - def path( self ): - self._completeIfNotSet( self._path ) - return self._NoneIfNotSet( self._path ) + def path(self): + self._completeIfNotSet(self._path) + return self._NoneIfNotSet(self._path) @property - def policy( self ): - self._completeIfNotSet( self._policy ) - return self._NoneIfNotSet( self._policy ) + def policy(self): + self._completeIfNotSet(self._policy) + return self._NoneIfNotSet(self._policy) @property - def prefix( self ): - self._completeIfNotSet( self._prefix ) - return self._NoneIfNotSet( self._prefix ) + def prefix(self): + self._completeIfNotSet(self._prefix) + return self._NoneIfNotSet(self._prefix) @property - def redirect( self ): - self._completeIfNotSet( self._redirect ) - return self._NoneIfNotSet( self._redirect ) + def redirect(self): + self._completeIfNotSet(self._redirect) + return self._NoneIfNotSet(self._redirect) @property - def s3_url( self ): - self._completeIfNotSet( self._s3_url ) - return self._NoneIfNotSet( self._s3_url ) + def s3_url(self): + self._completeIfNotSet(self._s3_url) + return self._NoneIfNotSet(self._s3_url) @property - def signature( self ): - self._completeIfNotSet( self._signature ) - return self._NoneIfNotSet( self._signature ) + def signature(self): + self._completeIfNotSet(self._signature) + return self._NoneIfNotSet(self._signature) @property - def size( self ): - self._completeIfNotSet( self._size ) - return self._NoneIfNotSet( self._size ) + def size(self): + self._completeIfNotSet(self._size) + return self._NoneIfNotSet(self._size) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) - def delete( self ): + def delete(self): headers, data = self._requester.requestAndCheck( "DELETE", self.url, @@ -122,86 +125,86 @@ class Download( GithubObject.GithubObject ): None ) - def _initAttributes( self ): - self._accesskeyid = GithubObject.NotSet - self._acl = GithubObject.NotSet - self._bucket = GithubObject.NotSet - self._content_type = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._description = GithubObject.NotSet - self._download_count = GithubObject.NotSet - self._expirationdate = GithubObject.NotSet - self._html_url = GithubObject.NotSet - self._id = GithubObject.NotSet - self._mime_type = GithubObject.NotSet - self._name = GithubObject.NotSet - self._path = GithubObject.NotSet - self._policy = GithubObject.NotSet - self._prefix = GithubObject.NotSet - self._redirect = GithubObject.NotSet - self._s3_url = GithubObject.NotSet - self._signature = GithubObject.NotSet - self._size = GithubObject.NotSet - self._url = GithubObject.NotSet + def _initAttributes(self): + self._accesskeyid = github.GithubObject.NotSet + self._acl = github.GithubObject.NotSet + self._bucket = github.GithubObject.NotSet + self._content_type = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._description = github.GithubObject.NotSet + self._download_count = github.GithubObject.NotSet + self._expirationdate = github.GithubObject.NotSet + self._html_url = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._mime_type = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._path = github.GithubObject.NotSet + self._policy = github.GithubObject.NotSet + self._prefix = github.GithubObject.NotSet + self._redirect = github.GithubObject.NotSet + self._s3_url = github.GithubObject.NotSet + self._signature = github.GithubObject.NotSet + self._size = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "accesskeyid" in attributes: # pragma no branch - assert attributes[ "accesskeyid" ] is None or isinstance( attributes[ "accesskeyid" ], ( str, unicode ) ), attributes[ "accesskeyid" ] - self._accesskeyid = attributes[ "accesskeyid" ] - if "acl" in attributes: # pragma no branch - assert attributes[ "acl" ] is None or isinstance( attributes[ "acl" ], ( str, unicode ) ), attributes[ "acl" ] - self._acl = attributes[ "acl" ] - if "bucket" in attributes: # pragma no branch - assert attributes[ "bucket" ] is None or isinstance( attributes[ "bucket" ], ( str, unicode ) ), attributes[ "bucket" ] - self._bucket = attributes[ "bucket" ] - if "content_type" in attributes: # pragma no branch - assert attributes[ "content_type" ] is None or isinstance( attributes[ "content_type" ], ( str, unicode ) ), attributes[ "content_type" ] - self._content_type = attributes[ "content_type" ] - if "created_at" in attributes: # pragma no branch - assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = self._parseDatetime( attributes[ "created_at" ] ) - if "description" in attributes: # pragma no branch - assert attributes[ "description" ] is None or isinstance( attributes[ "description" ], ( str, unicode ) ), attributes[ "description" ] - self._description = attributes[ "description" ] - if "download_count" in attributes: # pragma no branch - assert attributes[ "download_count" ] is None or isinstance( attributes[ "download_count" ], int ), attributes[ "download_count" ] - self._download_count = attributes[ "download_count" ] - if "expirationdate" in attributes: # pragma no branch - assert attributes[ "expirationdate" ] is None or isinstance( attributes[ "expirationdate" ], ( str, unicode ) ), attributes[ "expirationdate" ] - self._expirationdate = self._parseDatetime( attributes[ "expirationdate" ] ) - if "html_url" in attributes: # pragma no branch - assert attributes[ "html_url" ] is None or isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ] - self._html_url = attributes[ "html_url" ] - if "id" in attributes: # pragma no branch - assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] - self._id = attributes[ "id" ] - if "mime_type" in attributes: # pragma no branch - assert attributes[ "mime_type" ] is None or isinstance( attributes[ "mime_type" ], ( str, unicode ) ), attributes[ "mime_type" ] - self._mime_type = attributes[ "mime_type" ] - if "name" in attributes: # pragma no branch - assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ] - self._name = attributes[ "name" ] - if "path" in attributes: # pragma no branch - assert attributes[ "path" ] is None or isinstance( attributes[ "path" ], ( str, unicode ) ), attributes[ "path" ] - self._path = attributes[ "path" ] - if "policy" in attributes: # pragma no branch - assert attributes[ "policy" ] is None or isinstance( attributes[ "policy" ], ( str, unicode ) ), attributes[ "policy" ] - self._policy = attributes[ "policy" ] - if "prefix" in attributes: # pragma no branch - assert attributes[ "prefix" ] is None or isinstance( attributes[ "prefix" ], ( str, unicode ) ), attributes[ "prefix" ] - self._prefix = attributes[ "prefix" ] - if "redirect" in attributes: # pragma no branch - assert attributes[ "redirect" ] is None or isinstance( attributes[ "redirect" ], bool ), attributes[ "redirect" ] - self._redirect = attributes[ "redirect" ] - if "s3_url" in attributes: # pragma no branch - assert attributes[ "s3_url" ] is None or isinstance( attributes[ "s3_url" ], ( str, unicode ) ), attributes[ "s3_url" ] - self._s3_url = attributes[ "s3_url" ] - if "signature" in attributes: # pragma no branch - assert attributes[ "signature" ] is None or isinstance( attributes[ "signature" ], ( str, unicode ) ), attributes[ "signature" ] - self._signature = attributes[ "signature" ] - if "size" in attributes: # pragma no branch - assert attributes[ "size" ] is None or isinstance( attributes[ "size" ], int ), attributes[ "size" ] - self._size = attributes[ "size" ] - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] + def _useAttributes(self, attributes): + if "accesskeyid" in attributes: # pragma no branch + assert attributes["accesskeyid"] is None or isinstance(attributes["accesskeyid"], (str, unicode)), attributes["accesskeyid"] + self._accesskeyid = attributes["accesskeyid"] + if "acl" in attributes: # pragma no branch + assert attributes["acl"] is None or isinstance(attributes["acl"], (str, unicode)), attributes["acl"] + self._acl = attributes["acl"] + if "bucket" in attributes: # pragma no branch + assert attributes["bucket"] is None or isinstance(attributes["bucket"], (str, unicode)), attributes["bucket"] + self._bucket = attributes["bucket"] + if "content_type" in attributes: # pragma no branch + assert attributes["content_type"] is None or isinstance(attributes["content_type"], (str, unicode)), attributes["content_type"] + self._content_type = attributes["content_type"] + if "created_at" in attributes: # pragma no branch + assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"] + self._created_at = self._parseDatetime(attributes["created_at"]) + if "description" in attributes: # pragma no branch + assert attributes["description"] is None or isinstance(attributes["description"], (str, unicode)), attributes["description"] + self._description = attributes["description"] + if "download_count" in attributes: # pragma no branch + assert attributes["download_count"] is None or isinstance(attributes["download_count"], (int, long)), attributes["download_count"] + self._download_count = attributes["download_count"] + if "expirationdate" in attributes: # pragma no branch + assert attributes["expirationdate"] is None or isinstance(attributes["expirationdate"], (str, unicode)), attributes["expirationdate"] + self._expirationdate = self._parseDatetime(attributes["expirationdate"]) + if "html_url" in attributes: # pragma no branch + assert attributes["html_url"] is None or isinstance(attributes["html_url"], (str, unicode)), attributes["html_url"] + self._html_url = attributes["html_url"] + if "id" in attributes: # pragma no branch + assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] + self._id = attributes["id"] + if "mime_type" in attributes: # pragma no branch + assert attributes["mime_type"] is None or isinstance(attributes["mime_type"], (str, unicode)), attributes["mime_type"] + self._mime_type = attributes["mime_type"] + if "name" in attributes: # pragma no branch + assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] + self._name = attributes["name"] + if "path" in attributes: # pragma no branch + assert attributes["path"] is None or isinstance(attributes["path"], (str, unicode)), attributes["path"] + self._path = attributes["path"] + if "policy" in attributes: # pragma no branch + assert attributes["policy"] is None or isinstance(attributes["policy"], (str, unicode)), attributes["policy"] + self._policy = attributes["policy"] + if "prefix" in attributes: # pragma no branch + assert attributes["prefix"] is None or isinstance(attributes["prefix"], (str, unicode)), attributes["prefix"] + self._prefix = attributes["prefix"] + if "redirect" in attributes: # pragma no branch + assert attributes["redirect"] is None or isinstance(attributes["redirect"], bool), attributes["redirect"] + self._redirect = attributes["redirect"] + if "s3_url" in attributes: # pragma no branch + assert attributes["s3_url"] is None or isinstance(attributes["s3_url"], (str, unicode)), attributes["s3_url"] + self._s3_url = attributes["s3_url"] + if "signature" in attributes: # pragma no branch + assert attributes["signature"] is None or isinstance(attributes["signature"], (str, unicode)), attributes["signature"] + self._signature = attributes["signature"] + if "size" in attributes: # pragma no branch + assert attributes["size"] is None or isinstance(attributes["size"], (int, long)), attributes["size"] + self._size = attributes["size"] + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] diff --git a/github/Event.py b/github/Event.py index c14485d7..238907d2 100644 --- a/github/Event.py +++ b/github/Event.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,77 +13,78 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import Organization -import Repository -import NamedUser +import github.Organization +import github.Repository +import github.NamedUser -class Event( GithubObject.BasicGithubObject ): + +class Event(github.GithubObject.BasicGithubObject): @property - def actor( self ): - return self._NoneIfNotSet( self._actor ) + def actor(self): + return self._NoneIfNotSet(self._actor) @property - def created_at( self ): - return self._NoneIfNotSet( self._created_at ) + def created_at(self): + return self._NoneIfNotSet(self._created_at) @property - def id( self ): - return self._NoneIfNotSet( self._id ) + def id(self): + return self._NoneIfNotSet(self._id) @property - def org( self ): - return self._NoneIfNotSet( self._org ) + def org(self): + return self._NoneIfNotSet(self._org) @property - def payload( self ): - return self._NoneIfNotSet( self._payload ) + def payload(self): + return self._NoneIfNotSet(self._payload) @property - def public( self ): - return self._NoneIfNotSet( self._public ) + def public(self): + return self._NoneIfNotSet(self._public) @property - def repo( self ): - return self._NoneIfNotSet( self._repo ) + def repo(self): + return self._NoneIfNotSet(self._repo) @property - def type( self ): - return self._NoneIfNotSet( self._type ) + def type(self): + return self._NoneIfNotSet(self._type) - def _initAttributes( self ): - self._actor = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._id = GithubObject.NotSet - self._org = GithubObject.NotSet - self._payload = GithubObject.NotSet - self._public = GithubObject.NotSet - self._repo = GithubObject.NotSet - self._type = GithubObject.NotSet + def _initAttributes(self): + self._actor = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._org = github.GithubObject.NotSet + self._payload = github.GithubObject.NotSet + self._public = github.GithubObject.NotSet + self._repo = github.GithubObject.NotSet + self._type = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "actor" in attributes: # pragma no branch - assert attributes[ "actor" ] is None or isinstance( attributes[ "actor" ], dict ), attributes[ "actor" ] - self._actor = None if attributes[ "actor" ] is None else NamedUser.NamedUser( self._requester, attributes[ "actor" ], completed = False ) - if "created_at" in attributes: # pragma no branch - assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = self._parseDatetime( attributes[ "created_at" ] ) - if "id" in attributes: # pragma no branch - assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], ( str, unicode ) ), attributes[ "id" ] - self._id = attributes[ "id" ] - if "org" in attributes: # pragma no branch - assert attributes[ "org" ] is None or isinstance( attributes[ "org" ], dict ), attributes[ "org" ] - self._org = None if attributes[ "org" ] is None else Organization.Organization( self._requester, attributes[ "org" ], completed = False ) - if "payload" in attributes: # pragma no branch - assert attributes[ "payload" ] is None or isinstance( attributes[ "payload" ], dict ), attributes[ "payload" ] - self._payload = attributes[ "payload" ] - if "public" in attributes: # pragma no branch - assert attributes[ "public" ] is None or isinstance( attributes[ "public" ], bool ), attributes[ "public" ] - self._public = attributes[ "public" ] - if "repo" in attributes: # pragma no branch - assert attributes[ "repo" ] is None or isinstance( attributes[ "repo" ], dict ), attributes[ "repo" ] - self._repo = None if attributes[ "repo" ] is None else Repository.Repository( self._requester, attributes[ "repo" ], completed = False ) - if "type" in attributes: # pragma no branch - assert attributes[ "type" ] is None or isinstance( attributes[ "type" ], ( str, unicode ) ), attributes[ "type" ] - self._type = attributes[ "type" ] + def _useAttributes(self, attributes): + if "actor" in attributes: # pragma no branch + assert attributes["actor"] is None or isinstance(attributes["actor"], dict), attributes["actor"] + self._actor = None if attributes["actor"] is None else github.NamedUser.NamedUser(self._requester, attributes["actor"], completed=False) + if "created_at" in attributes: # pragma no branch + assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"] + self._created_at = self._parseDatetime(attributes["created_at"]) + if "id" in attributes: # pragma no branch + assert attributes["id"] is None or isinstance(attributes["id"], (str, unicode)), attributes["id"] + self._id = attributes["id"] + if "org" in attributes: # pragma no branch + assert attributes["org"] is None or isinstance(attributes["org"], dict), attributes["org"] + self._org = None if attributes["org"] is None else github.Organization.Organization(self._requester, attributes["org"], completed=False) + if "payload" in attributes: # pragma no branch + assert attributes["payload"] is None or isinstance(attributes["payload"], dict), attributes["payload"] + self._payload = attributes["payload"] + if "public" in attributes: # pragma no branch + assert attributes["public"] is None or isinstance(attributes["public"], bool), attributes["public"] + self._public = attributes["public"] + if "repo" in attributes: # pragma no branch + assert attributes["repo"] is None or isinstance(attributes["repo"], dict), attributes["repo"] + self._repo = None if attributes["repo"] is None else github.Repository.Repository(self._requester, attributes["repo"], completed=False) + if "type" in attributes: # pragma no branch + assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"] + self._type = attributes["type"] diff --git a/github/File.py b/github/File.py index 9eb1af92..f01f0183 100644 --- a/github/File.py +++ b/github/File.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,81 +13,82 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class File( GithubObject.BasicGithubObject ): + +class File(github.GithubObject.BasicGithubObject): @property - def additions( self ): - return self._NoneIfNotSet( self._additions ) + def additions(self): + return self._NoneIfNotSet(self._additions) @property - def blob_url( self ): - return self._NoneIfNotSet( self._blob_url ) + def blob_url(self): + return self._NoneIfNotSet(self._blob_url) @property - def changes( self ): - return self._NoneIfNotSet( self._changes ) + def changes(self): + return self._NoneIfNotSet(self._changes) @property - def deletions( self ): - return self._NoneIfNotSet( self._deletions ) + def deletions(self): + return self._NoneIfNotSet(self._deletions) @property - def filename( self ): - return self._NoneIfNotSet( self._filename ) + def filename(self): + return self._NoneIfNotSet(self._filename) @property - def patch( self ): - return self._NoneIfNotSet( self._patch ) + def patch(self): + return self._NoneIfNotSet(self._patch) @property - def raw_url( self ): - return self._NoneIfNotSet( self._raw_url ) + def raw_url(self): + return self._NoneIfNotSet(self._raw_url) @property - def sha( self ): - return self._NoneIfNotSet( self._sha ) + def sha(self): + return self._NoneIfNotSet(self._sha) @property - def status( self ): - return self._NoneIfNotSet( self._status ) + def status(self): + return self._NoneIfNotSet(self._status) - def _initAttributes( self ): - self._additions = GithubObject.NotSet - self._blob_url = GithubObject.NotSet - self._changes = GithubObject.NotSet - self._deletions = GithubObject.NotSet - self._filename = GithubObject.NotSet - self._patch = GithubObject.NotSet - self._raw_url = GithubObject.NotSet - self._sha = GithubObject.NotSet - self._status = GithubObject.NotSet + def _initAttributes(self): + self._additions = github.GithubObject.NotSet + self._blob_url = github.GithubObject.NotSet + self._changes = github.GithubObject.NotSet + self._deletions = github.GithubObject.NotSet + self._filename = github.GithubObject.NotSet + self._patch = github.GithubObject.NotSet + self._raw_url = github.GithubObject.NotSet + self._sha = github.GithubObject.NotSet + self._status = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "additions" in attributes: # pragma no branch - assert attributes[ "additions" ] is None or isinstance( attributes[ "additions" ], int ), attributes[ "additions" ] - self._additions = attributes[ "additions" ] - if "blob_url" in attributes: # pragma no branch - assert attributes[ "blob_url" ] is None or isinstance( attributes[ "blob_url" ], ( str, unicode ) ), attributes[ "blob_url" ] - self._blob_url = attributes[ "blob_url" ] - if "changes" in attributes: # pragma no branch - assert attributes[ "changes" ] is None or isinstance( attributes[ "changes" ], int ), attributes[ "changes" ] - self._changes = attributes[ "changes" ] - if "deletions" in attributes: # pragma no branch - assert attributes[ "deletions" ] is None or isinstance( attributes[ "deletions" ], int ), attributes[ "deletions" ] - self._deletions = attributes[ "deletions" ] - if "filename" in attributes: # pragma no branch - assert attributes[ "filename" ] is None or isinstance( attributes[ "filename" ], ( str, unicode ) ), attributes[ "filename" ] - self._filename = attributes[ "filename" ] - if "patch" in attributes: # pragma no branch - assert attributes[ "patch" ] is None or isinstance( attributes[ "patch" ], ( str, unicode ) ), attributes[ "patch" ] - self._patch = attributes[ "patch" ] - if "raw_url" in attributes: # pragma no branch - assert attributes[ "raw_url" ] is None or isinstance( attributes[ "raw_url" ], ( str, unicode ) ), attributes[ "raw_url" ] - self._raw_url = attributes[ "raw_url" ] - if "sha" in attributes: # pragma no branch - assert attributes[ "sha" ] is None or isinstance( attributes[ "sha" ], ( str, unicode ) ), attributes[ "sha" ] - self._sha = attributes[ "sha" ] - if "status" in attributes: # pragma no branch - assert attributes[ "status" ] is None or isinstance( attributes[ "status" ], ( str, unicode ) ), attributes[ "status" ] - self._status = attributes[ "status" ] + def _useAttributes(self, attributes): + if "additions" in attributes: # pragma no branch + assert attributes["additions"] is None or isinstance(attributes["additions"], (int, long)), attributes["additions"] + self._additions = attributes["additions"] + if "blob_url" in attributes: # pragma no branch + assert attributes["blob_url"] is None or isinstance(attributes["blob_url"], (str, unicode)), attributes["blob_url"] + self._blob_url = attributes["blob_url"] + if "changes" in attributes: # pragma no branch + assert attributes["changes"] is None or isinstance(attributes["changes"], (int, long)), attributes["changes"] + self._changes = attributes["changes"] + if "deletions" in attributes: # pragma no branch + assert attributes["deletions"] is None or isinstance(attributes["deletions"], (int, long)), attributes["deletions"] + self._deletions = attributes["deletions"] + if "filename" in attributes: # pragma no branch + assert attributes["filename"] is None or isinstance(attributes["filename"], (str, unicode)), attributes["filename"] + self._filename = attributes["filename"] + if "patch" in attributes: # pragma no branch + assert attributes["patch"] is None or isinstance(attributes["patch"], (str, unicode)), attributes["patch"] + self._patch = attributes["patch"] + if "raw_url" in attributes: # pragma no branch + assert attributes["raw_url"] is None or isinstance(attributes["raw_url"], (str, unicode)), attributes["raw_url"] + self._raw_url = attributes["raw_url"] + if "sha" in attributes: # pragma no branch + assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"] + self._sha = attributes["sha"] + if "status" in attributes: # pragma no branch + assert attributes["status"] is None or isinstance(attributes["status"], (str, unicode)), attributes["status"] + self._status = attributes["status"] diff --git a/github/Gist.py b/github/Gist.py index df20199d..cdf7339a 100644 --- a/github/Gist.py +++ b/github/Gist.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,94 +13,93 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject -import PaginatedList +import github.GithubObject +import github.PaginatedList -import Gist -import GistComment -import NamedUser -import GistFile -import InputFileContent -import GistHistoryState +import github.GistComment +import github.NamedUser +import github.GistFile +import github.GistHistoryState -class Gist( GithubObject.GithubObject ): + +class Gist(github.GithubObject.GithubObject): @property - def comments( self ): - self._completeIfNotSet( self._comments ) - return self._NoneIfNotSet( self._comments ) + def comments(self): + self._completeIfNotSet(self._comments) + return self._NoneIfNotSet(self._comments) @property - def created_at( self ): - self._completeIfNotSet( self._created_at ) - return self._NoneIfNotSet( self._created_at ) + def created_at(self): + self._completeIfNotSet(self._created_at) + return self._NoneIfNotSet(self._created_at) @property - def description( self ): - self._completeIfNotSet( self._description ) - return self._NoneIfNotSet( self._description ) + def description(self): + self._completeIfNotSet(self._description) + return self._NoneIfNotSet(self._description) @property - def files( self ): - self._completeIfNotSet( self._files ) - return self._NoneIfNotSet( self._files ) + def files(self): + self._completeIfNotSet(self._files) + return self._NoneIfNotSet(self._files) @property - def fork_of( self ): - self._completeIfNotSet( self._fork_of ) - return self._NoneIfNotSet( self._fork_of ) + def fork_of(self): + self._completeIfNotSet(self._fork_of) + return self._NoneIfNotSet(self._fork_of) @property - def forks( self ): - self._completeIfNotSet( self._forks ) - return self._NoneIfNotSet( self._forks ) + def forks(self): + self._completeIfNotSet(self._forks) + return self._NoneIfNotSet(self._forks) @property - def git_pull_url( self ): - self._completeIfNotSet( self._git_pull_url ) - return self._NoneIfNotSet( self._git_pull_url ) + def git_pull_url(self): + self._completeIfNotSet(self._git_pull_url) + return self._NoneIfNotSet(self._git_pull_url) @property - def git_push_url( self ): - self._completeIfNotSet( self._git_push_url ) - return self._NoneIfNotSet( self._git_push_url ) + def git_push_url(self): + self._completeIfNotSet(self._git_push_url) + return self._NoneIfNotSet(self._git_push_url) @property - def history( self ): - self._completeIfNotSet( self._history ) - return self._NoneIfNotSet( self._history ) + def history(self): + self._completeIfNotSet(self._history) + return self._NoneIfNotSet(self._history) @property - def html_url( self ): - self._completeIfNotSet( self._html_url ) - return self._NoneIfNotSet( self._html_url ) + def html_url(self): + self._completeIfNotSet(self._html_url) + return self._NoneIfNotSet(self._html_url) @property - def id( self ): - self._completeIfNotSet( self._id ) - return self._NoneIfNotSet( self._id ) + def id(self): + self._completeIfNotSet(self._id) + return self._NoneIfNotSet(self._id) @property - def public( self ): - self._completeIfNotSet( self._public ) - return self._NoneIfNotSet( self._public ) + def public(self): + self._completeIfNotSet(self._public) + return self._NoneIfNotSet(self._public) @property - def updated_at( self ): - self._completeIfNotSet( self._updated_at ) - return self._NoneIfNotSet( self._updated_at ) + def updated_at(self): + self._completeIfNotSet(self._updated_at) + return self._NoneIfNotSet(self._updated_at) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) @property - def user( self ): - self._completeIfNotSet( self._user ) - return self._NoneIfNotSet( self._user ) + def user(self): + self._completeIfNotSet(self._user) + return self._NoneIfNotSet(self._user) - def create_comment( self, body ): - assert isinstance( body, ( str, unicode ) ), body + def create_comment(self, body): + assert isinstance(body, (str, unicode)), body post_parameters = { "body": body, } @@ -108,18 +109,18 @@ class Gist( GithubObject.GithubObject ): None, post_parameters ) - return GistComment.GistComment( self._requester, data, completed = True ) + return github.GistComment.GistComment(self._requester, data, completed=True) - def create_fork( self ): + def create_fork(self): headers, data = self._requester.requestAndCheck( "POST", self.url + "/fork", None, None ) - return Gist( self._requester, data, completed = True ) + return Gist(self._requester, data, completed=True) - def delete( self ): + def delete(self): headers, data = self._requester.requestAndCheck( "DELETE", self.url, @@ -127,41 +128,41 @@ class Gist( GithubObject.GithubObject ): None ) - def edit( self, description = GithubObject.NotSet, files = GithubObject.NotSet ): - assert description is GithubObject.NotSet or isinstance( description, ( str, unicode ) ), description - assert files is GithubObject.NotSet or all( isinstance( element, InputFileContent.InputFileContent ) for element in files.itervalues() ), files + def edit(self, description=github.GithubObject.NotSet, files=github.GithubObject.NotSet): + assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description + assert files is github.GithubObject.NotSet or all(isinstance(element, github.InputFileContent) for element in files.itervalues()), files post_parameters = dict() - if description is not GithubObject.NotSet: - post_parameters[ "description" ] = description - if files is not GithubObject.NotSet: - post_parameters[ "files" ] = dict( ( key, value._identity ) for key, value in files.iteritems() ) + if description is not github.GithubObject.NotSet: + post_parameters["description"] = description + if files is not github.GithubObject.NotSet: + post_parameters["files"] = dict((key, value._identity) for key, value in files.iteritems()) headers, data = self._requester.requestAndCheck( "PATCH", self.url, None, post_parameters ) - self._useAttributes( data ) + self._useAttributes(data) - def get_comment( self, id ): - assert isinstance( id, int ), id + def get_comment(self, id): + assert isinstance(id, (int, long)), id headers, data = self._requester.requestAndCheck( "GET", - "/gists/comments/" + str( id ), + self.url + "/comments/" + str(id), None, None ) - return GistComment.GistComment( self._requester, data, completed = True ) + return github.GistComment.GistComment(self._requester, data, completed=True) - def get_comments( self ): - return PaginatedList.PaginatedList( - GistComment.GistComment, + def get_comments(self): + return github.PaginatedList.PaginatedList( + github.GistComment.GistComment, self._requester, self.url + "/comments", None ) - def is_starred( self ): + def is_starred(self): status, headers, data = self._requester.requestRaw( "GET", self.url + "/star", @@ -170,7 +171,7 @@ class Gist( GithubObject.GithubObject ): ) return status == 204 - def reset_starred( self ): + def reset_starred(self): headers, data = self._requester.requestAndCheck( "DELETE", self.url + "/star", @@ -178,7 +179,7 @@ class Gist( GithubObject.GithubObject ): None ) - def set_starred( self ): + def set_starred(self): headers, data = self._requester.requestAndCheck( "PUT", self.url + "/star", @@ -186,75 +187,75 @@ class Gist( GithubObject.GithubObject ): None ) - def _initAttributes( self ): - self._comments = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._description = GithubObject.NotSet - self._files = GithubObject.NotSet - self._fork_of = GithubObject.NotSet - self._forks = GithubObject.NotSet - self._git_pull_url = GithubObject.NotSet - self._git_push_url = GithubObject.NotSet - self._history = GithubObject.NotSet - self._html_url = GithubObject.NotSet - self._id = GithubObject.NotSet - self._public = GithubObject.NotSet - self._updated_at = GithubObject.NotSet - self._url = GithubObject.NotSet - self._user = GithubObject.NotSet + def _initAttributes(self): + self._comments = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._description = github.GithubObject.NotSet + self._files = github.GithubObject.NotSet + self._fork_of = github.GithubObject.NotSet + self._forks = github.GithubObject.NotSet + self._git_pull_url = github.GithubObject.NotSet + self._git_push_url = github.GithubObject.NotSet + self._history = github.GithubObject.NotSet + self._html_url = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._public = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + self._user = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "comments" in attributes: # pragma no branch - assert attributes[ "comments" ] is None or isinstance( attributes[ "comments" ], int ), attributes[ "comments" ] - self._comments = attributes[ "comments" ] - if "created_at" in attributes: # pragma no branch - assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = self._parseDatetime( attributes[ "created_at" ] ) - if "description" in attributes: # pragma no branch - assert attributes[ "description" ] is None or isinstance( attributes[ "description" ], ( str, unicode ) ), attributes[ "description" ] - self._description = attributes[ "description" ] - if "files" in attributes: # pragma no branch - assert attributes[ "files" ] is None or all( isinstance( element, dict ) for element in attributes[ "files" ].itervalues() ), attributes[ "files" ] - self._files = None if attributes[ "files" ] is None else dict( - ( key, GistFile.GistFile( self._requester, element, completed = False ) ) - for key, element in attributes[ "files" ].iteritems() + def _useAttributes(self, attributes): + if "comments" in attributes: # pragma no branch + assert attributes["comments"] is None or isinstance(attributes["comments"], (int, long)), attributes["comments"] + self._comments = attributes["comments"] + if "created_at" in attributes: # pragma no branch + assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"] + self._created_at = self._parseDatetime(attributes["created_at"]) + if "description" in attributes: # pragma no branch + assert attributes["description"] is None or isinstance(attributes["description"], (str, unicode)), attributes["description"] + self._description = attributes["description"] + if "files" in attributes: # pragma no branch + assert attributes["files"] is None or all(isinstance(element, dict) for element in attributes["files"].itervalues()), attributes["files"] + self._files = None if attributes["files"] is None else dict( + (key, github.GistFile.GistFile(self._requester, element, completed=False)) + for key, element in attributes["files"].iteritems() ) - if "fork_of" in attributes: # pragma no branch - assert attributes[ "fork_of" ] is None or isinstance( attributes[ "fork_of" ], dict ), attributes[ "fork_of" ] - self._fork_of = None if attributes[ "fork_of" ] is None else Gist( self._requester, attributes[ "fork_of" ], completed = False ) - if "forks" in attributes: # pragma no branch - assert attributes[ "forks" ] is None or all( isinstance( element, dict ) for element in attributes[ "forks" ] ), attributes[ "forks" ] - self._forks = None if attributes[ "forks" ] is None else [ - Gist( self._requester, element, completed = False ) - for element in attributes[ "forks" ] + if "fork_of" in attributes: # pragma no branch + assert attributes["fork_of"] is None or isinstance(attributes["fork_of"], dict), attributes["fork_of"] + self._fork_of = None if attributes["fork_of"] is None else Gist(self._requester, attributes["fork_of"], completed=False) + if "forks" in attributes: # pragma no branch + assert attributes["forks"] is None or all(isinstance(element, dict) for element in attributes["forks"]), attributes["forks"] + self._forks = None if attributes["forks"] is None else [ + Gist(self._requester, element, completed=False) + for element in attributes["forks"] ] - if "git_pull_url" in attributes: # pragma no branch - assert attributes[ "git_pull_url" ] is None or isinstance( attributes[ "git_pull_url" ], ( str, unicode ) ), attributes[ "git_pull_url" ] - self._git_pull_url = attributes[ "git_pull_url" ] - if "git_push_url" in attributes: # pragma no branch - assert attributes[ "git_push_url" ] is None or isinstance( attributes[ "git_push_url" ], ( str, unicode ) ), attributes[ "git_push_url" ] - self._git_push_url = attributes[ "git_push_url" ] - if "history" in attributes: # pragma no branch - assert attributes[ "history" ] is None or all( isinstance( element, dict ) for element in attributes[ "history" ] ), attributes[ "history" ] - self._history = None if attributes[ "history" ] is None else [ - GistHistoryState.GistHistoryState( self._requester, element, completed = False ) - for element in attributes[ "history" ] + if "git_pull_url" in attributes: # pragma no branch + assert attributes["git_pull_url"] is None or isinstance(attributes["git_pull_url"], (str, unicode)), attributes["git_pull_url"] + self._git_pull_url = attributes["git_pull_url"] + if "git_push_url" in attributes: # pragma no branch + assert attributes["git_push_url"] is None or isinstance(attributes["git_push_url"], (str, unicode)), attributes["git_push_url"] + self._git_push_url = attributes["git_push_url"] + if "history" in attributes: # pragma no branch + assert attributes["history"] is None or all(isinstance(element, dict) for element in attributes["history"]), attributes["history"] + self._history = None if attributes["history"] is None else [ + github.GistHistoryState.GistHistoryState(self._requester, element, completed=False) + for element in attributes["history"] ] - if "html_url" in attributes: # pragma no branch - assert attributes[ "html_url" ] is None or isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ] - self._html_url = attributes[ "html_url" ] - if "id" in attributes: # pragma no branch - assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], ( str, unicode ) ), attributes[ "id" ] - self._id = attributes[ "id" ] - if "public" in attributes: # pragma no branch - assert attributes[ "public" ] is None or isinstance( attributes[ "public" ], bool ), attributes[ "public" ] - self._public = attributes[ "public" ] - if "updated_at" in attributes: # pragma no branch - assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ] - self._updated_at = self._parseDatetime( attributes[ "updated_at" ] ) - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] - if "user" in attributes: # pragma no branch - assert attributes[ "user" ] is None or isinstance( attributes[ "user" ], dict ), attributes[ "user" ] - self._user = None if attributes[ "user" ] is None else NamedUser.NamedUser( self._requester, attributes[ "user" ], completed = False ) + if "html_url" in attributes: # pragma no branch + assert attributes["html_url"] is None or isinstance(attributes["html_url"], (str, unicode)), attributes["html_url"] + self._html_url = attributes["html_url"] + if "id" in attributes: # pragma no branch + assert attributes["id"] is None or isinstance(attributes["id"], (str, unicode)), attributes["id"] + self._id = attributes["id"] + if "public" in attributes: # pragma no branch + assert attributes["public"] is None or isinstance(attributes["public"], bool), attributes["public"] + self._public = attributes["public"] + if "updated_at" in attributes: # pragma no branch + assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], (str, unicode)), attributes["updated_at"] + self._updated_at = self._parseDatetime(attributes["updated_at"]) + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] + if "user" in attributes: # pragma no branch + assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"] + self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False) diff --git a/github/GistComment.py b/github/GistComment.py index bd4d7eaa..1d0a573c 100644 --- a/github/GistComment.py +++ b/github/GistComment.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,42 +13,43 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import NamedUser +import github.NamedUser -class GistComment( GithubObject.GithubObject ): + +class GistComment(github.GithubObject.GithubObject): @property - def body( self ): - self._completeIfNotSet( self._body ) - return self._NoneIfNotSet( self._body ) + def body(self): + self._completeIfNotSet(self._body) + return self._NoneIfNotSet(self._body) @property - def created_at( self ): - self._completeIfNotSet( self._created_at ) - return self._NoneIfNotSet( self._created_at ) + def created_at(self): + self._completeIfNotSet(self._created_at) + return self._NoneIfNotSet(self._created_at) @property - def id( self ): - self._completeIfNotSet( self._id ) - return self._NoneIfNotSet( self._id ) + def id(self): + self._completeIfNotSet(self._id) + return self._NoneIfNotSet(self._id) @property - def updated_at( self ): - self._completeIfNotSet( self._updated_at ) - return self._NoneIfNotSet( self._updated_at ) + def updated_at(self): + self._completeIfNotSet(self._updated_at) + return self._NoneIfNotSet(self._updated_at) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) @property - def user( self ): - self._completeIfNotSet( self._user ) - return self._NoneIfNotSet( self._user ) + def user(self): + self._completeIfNotSet(self._user) + return self._NoneIfNotSet(self._user) - def delete( self ): + def delete(self): headers, data = self._requester.requestAndCheck( "DELETE", self.url, @@ -54,8 +57,8 @@ class GistComment( GithubObject.GithubObject ): None ) - def edit( self, body ): - assert isinstance( body, ( str, unicode ) ), body + def edit(self, body): + assert isinstance(body, (str, unicode)), body post_parameters = { "body": body, } @@ -65,32 +68,32 @@ class GistComment( GithubObject.GithubObject ): None, post_parameters ) - self._useAttributes( data ) + self._useAttributes(data) - def _initAttributes( self ): - self._body = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._id = GithubObject.NotSet - self._updated_at = GithubObject.NotSet - self._url = GithubObject.NotSet - self._user = GithubObject.NotSet + def _initAttributes(self): + self._body = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + self._user = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "body" in attributes: # pragma no branch - assert attributes[ "body" ] is None or isinstance( attributes[ "body" ], ( str, unicode ) ), attributes[ "body" ] - self._body = attributes[ "body" ] - if "created_at" in attributes: # pragma no branch - assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = self._parseDatetime( attributes[ "created_at" ] ) - if "id" in attributes: # pragma no branch - assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] - self._id = attributes[ "id" ] - if "updated_at" in attributes: # pragma no branch - assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ] - self._updated_at = self._parseDatetime( attributes[ "updated_at" ] ) - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] - if "user" in attributes: # pragma no branch - assert attributes[ "user" ] is None or isinstance( attributes[ "user" ], dict ), attributes[ "user" ] - self._user = None if attributes[ "user" ] is None else NamedUser.NamedUser( self._requester, attributes[ "user" ], completed = False ) + def _useAttributes(self, attributes): + if "body" in attributes: # pragma no branch + assert attributes["body"] is None or isinstance(attributes["body"], (str, unicode)), attributes["body"] + self._body = attributes["body"] + if "created_at" in attributes: # pragma no branch + assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"] + self._created_at = self._parseDatetime(attributes["created_at"]) + if "id" in attributes: # pragma no branch + assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] + self._id = attributes["id"] + if "updated_at" in attributes: # pragma no branch + assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], (str, unicode)), attributes["updated_at"] + self._updated_at = self._parseDatetime(attributes["updated_at"]) + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] + if "user" in attributes: # pragma no branch + assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"] + self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False) diff --git a/github/GistFile.py b/github/GistFile.py index 3b4e418b..4e2fb323 100644 --- a/github/GistFile.py +++ b/github/GistFile.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,49 +13,50 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class GistFile( GithubObject.BasicGithubObject ): + +class GistFile(github.GithubObject.BasicGithubObject): @property - def content( self ): - return self._NoneIfNotSet( self._content ) + def content(self): + return self._NoneIfNotSet(self._content) @property - def filename( self ): - return self._NoneIfNotSet( self._filename ) + def filename(self): + return self._NoneIfNotSet(self._filename) @property - def language( self ): - return self._NoneIfNotSet( self._language ) + def language(self): + return self._NoneIfNotSet(self._language) @property - def raw_url( self ): - return self._NoneIfNotSet( self._raw_url ) + def raw_url(self): + return self._NoneIfNotSet(self._raw_url) @property - def size( self ): - return self._NoneIfNotSet( self._size ) + def size(self): + return self._NoneIfNotSet(self._size) - def _initAttributes( self ): - self._content = GithubObject.NotSet - self._filename = GithubObject.NotSet - self._language = GithubObject.NotSet - self._raw_url = GithubObject.NotSet - self._size = GithubObject.NotSet + def _initAttributes(self): + self._content = github.GithubObject.NotSet + self._filename = github.GithubObject.NotSet + self._language = github.GithubObject.NotSet + self._raw_url = github.GithubObject.NotSet + self._size = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "content" in attributes: # pragma no branch - assert attributes[ "content" ] is None or isinstance( attributes[ "content" ], ( str, unicode ) ), attributes[ "content" ] - self._content = attributes[ "content" ] - if "filename" in attributes: # pragma no branch - assert attributes[ "filename" ] is None or isinstance( attributes[ "filename" ], ( str, unicode ) ), attributes[ "filename" ] - self._filename = attributes[ "filename" ] - if "language" in attributes: # pragma no branch - assert attributes[ "language" ] is None or isinstance( attributes[ "language" ], ( str, unicode ) ), attributes[ "language" ] - self._language = attributes[ "language" ] - if "raw_url" in attributes: # pragma no branch - assert attributes[ "raw_url" ] is None or isinstance( attributes[ "raw_url" ], ( str, unicode ) ), attributes[ "raw_url" ] - self._raw_url = attributes[ "raw_url" ] - if "size" in attributes: # pragma no branch - assert attributes[ "size" ] is None or isinstance( attributes[ "size" ], int ), attributes[ "size" ] - self._size = attributes[ "size" ] + def _useAttributes(self, attributes): + if "content" in attributes: # pragma no branch + assert attributes["content"] is None or isinstance(attributes["content"], (str, unicode)), attributes["content"] + self._content = attributes["content"] + if "filename" in attributes: # pragma no branch + assert attributes["filename"] is None or isinstance(attributes["filename"], (str, unicode)), attributes["filename"] + self._filename = attributes["filename"] + if "language" in attributes: # pragma no branch + assert attributes["language"] is None or isinstance(attributes["language"], (str, unicode)), attributes["language"] + self._language = attributes["language"] + if "raw_url" in attributes: # pragma no branch + assert attributes["raw_url"] is None or isinstance(attributes["raw_url"], (str, unicode)), attributes["raw_url"] + self._raw_url = attributes["raw_url"] + if "size" in attributes: # pragma no branch + assert attributes["size"] is None or isinstance(attributes["size"], (int, long)), attributes["size"] + self._size = attributes["size"] diff --git a/github/GistHistoryState.py b/github/GistHistoryState.py index 016694a7..89c8349e 100644 --- a/github/GistHistoryState.py +++ b/github/GistHistoryState.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,57 +13,58 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import NamedUser -import CommitStats +import github.NamedUser +import github.CommitStats -class GistHistoryState( GithubObject.GithubObject ): + +class GistHistoryState(github.GithubObject.GithubObject): @property - def change_status( self ): - self._completeIfNotSet( self._change_status ) - return self._NoneIfNotSet( self._change_status ) + def change_status(self): + self._completeIfNotSet(self._change_status) + return self._NoneIfNotSet(self._change_status) @property - def committed_at( self ): - self._completeIfNotSet( self._committed_at ) - return self._NoneIfNotSet( self._committed_at ) + def committed_at(self): + self._completeIfNotSet(self._committed_at) + return self._NoneIfNotSet(self._committed_at) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) @property - def user( self ): - self._completeIfNotSet( self._user ) - return self._NoneIfNotSet( self._user ) + def user(self): + self._completeIfNotSet(self._user) + return self._NoneIfNotSet(self._user) @property - def version( self ): - self._completeIfNotSet( self._version ) - return self._NoneIfNotSet( self._version ) + def version(self): + self._completeIfNotSet(self._version) + return self._NoneIfNotSet(self._version) - def _initAttributes( self ): - self._change_status = GithubObject.NotSet - self._committed_at = GithubObject.NotSet - self._url = GithubObject.NotSet - self._user = GithubObject.NotSet - self._version = GithubObject.NotSet + def _initAttributes(self): + self._change_status = github.GithubObject.NotSet + self._committed_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + self._user = github.GithubObject.NotSet + self._version = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "change_status" in attributes: # pragma no branch - assert attributes[ "change_status" ] is None or isinstance( attributes[ "change_status" ], dict ), attributes[ "change_status" ] - self._change_status = None if attributes[ "change_status" ] is None else CommitStats.CommitStats( self._requester, attributes[ "change_status" ], completed = False ) - if "committed_at" in attributes: # pragma no branch - assert attributes[ "committed_at" ] is None or isinstance( attributes[ "committed_at" ], ( str, unicode ) ), attributes[ "committed_at" ] - self._committed_at = self._parseDatetime( attributes[ "committed_at" ] ) - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] - if "user" in attributes: # pragma no branch - assert attributes[ "user" ] is None or isinstance( attributes[ "user" ], dict ), attributes[ "user" ] - self._user = None if attributes[ "user" ] is None else NamedUser.NamedUser( self._requester, attributes[ "user" ], completed = False ) - if "version" in attributes: # pragma no branch - assert attributes[ "version" ] is None or isinstance( attributes[ "version" ], ( str, unicode ) ), attributes[ "version" ] - self._version = attributes[ "version" ] + def _useAttributes(self, attributes): + if "change_status" in attributes: # pragma no branch + assert attributes["change_status"] is None or isinstance(attributes["change_status"], dict), attributes["change_status"] + self._change_status = None if attributes["change_status"] is None else github.CommitStats.CommitStats(self._requester, attributes["change_status"], completed=False) + if "committed_at" in attributes: # pragma no branch + assert attributes["committed_at"] is None or isinstance(attributes["committed_at"], (str, unicode)), attributes["committed_at"] + self._committed_at = self._parseDatetime(attributes["committed_at"]) + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] + if "user" in attributes: # pragma no branch + assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"] + self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False) + if "version" in attributes: # pragma no branch + assert attributes["version"] is None or isinstance(attributes["version"], (str, unicode)), attributes["version"] + self._version = attributes["version"] diff --git a/github/GitAuthor.py b/github/GitAuthor.py index 8542229b..fe378303 100644 --- a/github/GitAuthor.py +++ b/github/GitAuthor.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,33 +13,34 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class GitAuthor( GithubObject.BasicGithubObject ): + +class GitAuthor(github.GithubObject.BasicGithubObject): @property - def date( self ): - return self._NoneIfNotSet( self._date ) + def date(self): + return self._NoneIfNotSet(self._date) @property - def email( self ): - return self._NoneIfNotSet( self._email ) + def email(self): + return self._NoneIfNotSet(self._email) @property - def name( self ): - return self._NoneIfNotSet( self._name ) + def name(self): + return self._NoneIfNotSet(self._name) - def _initAttributes( self ): - self._date = GithubObject.NotSet - self._email = GithubObject.NotSet - self._name = GithubObject.NotSet + def _initAttributes(self): + self._date = github.GithubObject.NotSet + self._email = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "date" in attributes: # pragma no branch - assert attributes[ "date" ] is None or isinstance( attributes[ "date" ], ( str, unicode ) ), attributes[ "date" ] - self._date = self._parseDatetime( attributes[ "date" ] ) - if "email" in attributes: # pragma no branch - assert attributes[ "email" ] is None or isinstance( attributes[ "email" ], ( str, unicode ) ), attributes[ "email" ] - self._email = attributes[ "email" ] - if "name" in attributes: # pragma no branch - assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ] - self._name = attributes[ "name" ] + def _useAttributes(self, attributes): + if "date" in attributes: # pragma no branch + assert attributes["date"] is None or isinstance(attributes["date"], (str, unicode)), attributes["date"] + self._date = self._parseDatetime(attributes["date"]) + if "email" in attributes: # pragma no branch + assert attributes["email"] is None or isinstance(attributes["email"], (str, unicode)), attributes["email"] + self._email = attributes["email"] + if "name" in attributes: # pragma no branch + assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] + self._name = attributes["name"] diff --git a/github/GitBlob.py b/github/GitBlob.py index 1a883c77..bd5a304f 100644 --- a/github/GitBlob.py +++ b/github/GitBlob.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,54 +13,55 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class GitBlob( GithubObject.GithubObject ): + +class GitBlob(github.GithubObject.GithubObject): @property - def content( self ): - self._completeIfNotSet( self._content ) - return self._NoneIfNotSet( self._content ) + def content(self): + self._completeIfNotSet(self._content) + return self._NoneIfNotSet(self._content) @property - def encoding( self ): - self._completeIfNotSet( self._encoding ) - return self._NoneIfNotSet( self._encoding ) + def encoding(self): + self._completeIfNotSet(self._encoding) + return self._NoneIfNotSet(self._encoding) @property - def sha( self ): - self._completeIfNotSet( self._sha ) - return self._NoneIfNotSet( self._sha ) + def sha(self): + self._completeIfNotSet(self._sha) + return self._NoneIfNotSet(self._sha) @property - def size( self ): - self._completeIfNotSet( self._size ) - return self._NoneIfNotSet( self._size ) + def size(self): + self._completeIfNotSet(self._size) + return self._NoneIfNotSet(self._size) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) - def _initAttributes( self ): - self._content = GithubObject.NotSet - self._encoding = GithubObject.NotSet - self._sha = GithubObject.NotSet - self._size = GithubObject.NotSet - self._url = GithubObject.NotSet + def _initAttributes(self): + self._content = github.GithubObject.NotSet + self._encoding = github.GithubObject.NotSet + self._sha = github.GithubObject.NotSet + self._size = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "content" in attributes: # pragma no branch - assert attributes[ "content" ] is None or isinstance( attributes[ "content" ], ( str, unicode ) ), attributes[ "content" ] - self._content = attributes[ "content" ] - if "encoding" in attributes: # pragma no branch - assert attributes[ "encoding" ] is None or isinstance( attributes[ "encoding" ], ( str, unicode ) ), attributes[ "encoding" ] - self._encoding = attributes[ "encoding" ] - if "sha" in attributes: # pragma no branch - assert attributes[ "sha" ] is None or isinstance( attributes[ "sha" ], ( str, unicode ) ), attributes[ "sha" ] - self._sha = attributes[ "sha" ] - if "size" in attributes: # pragma no branch - assert attributes[ "size" ] is None or isinstance( attributes[ "size" ], int ), attributes[ "size" ] - self._size = attributes[ "size" ] - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] + def _useAttributes(self, attributes): + if "content" in attributes: # pragma no branch + assert attributes["content"] is None or isinstance(attributes["content"], (str, unicode)), attributes["content"] + self._content = attributes["content"] + if "encoding" in attributes: # pragma no branch + assert attributes["encoding"] is None or isinstance(attributes["encoding"], (str, unicode)), attributes["encoding"] + self._encoding = attributes["encoding"] + if "sha" in attributes: # pragma no branch + assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"] + self._sha = attributes["sha"] + if "size" in attributes: # pragma no branch + assert attributes["size"] is None or isinstance(attributes["size"], (int, long)), attributes["size"] + self._size = attributes["size"] + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] diff --git a/github/GitCommit.py b/github/GitCommit.py index 3feb4624..3e3afe88 100644 --- a/github/GitCommit.py +++ b/github/GitCommit.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,83 +13,83 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import GitAuthor -import GitCommit -import GitTree +import github.GitAuthor +import github.GitTree -class GitCommit( GithubObject.GithubObject ): + +class GitCommit(github.GithubObject.GithubObject): @property - def author( self ): - self._completeIfNotSet( self._author ) - return self._NoneIfNotSet( self._author ) + def author(self): + self._completeIfNotSet(self._author) + return self._NoneIfNotSet(self._author) @property - def committer( self ): - self._completeIfNotSet( self._committer ) - return self._NoneIfNotSet( self._committer ) + def committer(self): + self._completeIfNotSet(self._committer) + return self._NoneIfNotSet(self._committer) @property - def message( self ): - self._completeIfNotSet( self._message ) - return self._NoneIfNotSet( self._message ) + def message(self): + self._completeIfNotSet(self._message) + return self._NoneIfNotSet(self._message) @property - def parents( self ): - self._completeIfNotSet( self._parents ) - return self._NoneIfNotSet( self._parents ) + def parents(self): + self._completeIfNotSet(self._parents) + return self._NoneIfNotSet(self._parents) @property - def sha( self ): - self._completeIfNotSet( self._sha ) - return self._NoneIfNotSet( self._sha ) + def sha(self): + self._completeIfNotSet(self._sha) + return self._NoneIfNotSet(self._sha) @property - def tree( self ): - self._completeIfNotSet( self._tree ) - return self._NoneIfNotSet( self._tree ) + def tree(self): + self._completeIfNotSet(self._tree) + return self._NoneIfNotSet(self._tree) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) @property - def _identity( self ): + def _identity(self): return self.sha - def _initAttributes( self ): - self._author = GithubObject.NotSet - self._committer = GithubObject.NotSet - self._message = GithubObject.NotSet - self._parents = GithubObject.NotSet - self._sha = GithubObject.NotSet - self._tree = GithubObject.NotSet - self._url = GithubObject.NotSet + def _initAttributes(self): + self._author = github.GithubObject.NotSet + self._committer = github.GithubObject.NotSet + self._message = github.GithubObject.NotSet + self._parents = github.GithubObject.NotSet + self._sha = github.GithubObject.NotSet + self._tree = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "author" in attributes: # pragma no branch - assert attributes[ "author" ] is None or isinstance( attributes[ "author" ], dict ), attributes[ "author" ] - self._author = None if attributes[ "author" ] is None else GitAuthor.GitAuthor( self._requester, attributes[ "author" ], completed = False ) - if "committer" in attributes: # pragma no branch - assert attributes[ "committer" ] is None or isinstance( attributes[ "committer" ], dict ), attributes[ "committer" ] - self._committer = None if attributes[ "committer" ] is None else GitAuthor.GitAuthor( self._requester, attributes[ "committer" ], completed = False ) - if "message" in attributes: # pragma no branch - assert attributes[ "message" ] is None or isinstance( attributes[ "message" ], ( str, unicode ) ), attributes[ "message" ] - self._message = attributes[ "message" ] - if "parents" in attributes: # pragma no branch - assert attributes[ "parents" ] is None or all( isinstance( element, dict ) for element in attributes[ "parents" ] ), attributes[ "parents" ] - self._parents = None if attributes[ "parents" ] is None else [ - GitCommit( self._requester, element, completed = False ) - for element in attributes[ "parents" ] + def _useAttributes(self, attributes): + if "author" in attributes: # pragma no branch + assert attributes["author"] is None or isinstance(attributes["author"], dict), attributes["author"] + self._author = None if attributes["author"] is None else github.GitAuthor.GitAuthor(self._requester, attributes["author"], completed=False) + if "committer" in attributes: # pragma no branch + assert attributes["committer"] is None or isinstance(attributes["committer"], dict), attributes["committer"] + self._committer = None if attributes["committer"] is None else github.GitAuthor.GitAuthor(self._requester, attributes["committer"], completed=False) + if "message" in attributes: # pragma no branch + assert attributes["message"] is None or isinstance(attributes["message"], (str, unicode)), attributes["message"] + self._message = attributes["message"] + if "parents" in attributes: # pragma no branch + assert attributes["parents"] is None or all(isinstance(element, dict) for element in attributes["parents"]), attributes["parents"] + self._parents = None if attributes["parents"] is None else [ + GitCommit(self._requester, element, completed=False) + for element in attributes["parents"] ] - if "sha" in attributes: # pragma no branch - assert attributes[ "sha" ] is None or isinstance( attributes[ "sha" ], ( str, unicode ) ), attributes[ "sha" ] - self._sha = attributes[ "sha" ] - if "tree" in attributes: # pragma no branch - assert attributes[ "tree" ] is None or isinstance( attributes[ "tree" ], dict ), attributes[ "tree" ] - self._tree = None if attributes[ "tree" ] is None else GitTree.GitTree( self._requester, attributes[ "tree" ], completed = False ) - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] + if "sha" in attributes: # pragma no branch + assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"] + self._sha = attributes["sha"] + if "tree" in attributes: # pragma no branch + assert attributes["tree"] is None or isinstance(attributes["tree"], dict), attributes["tree"] + self._tree = None if attributes["tree"] is None else github.GitTree.GitTree(self._requester, attributes["tree"], completed=False) + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] diff --git a/github/GitObject.py b/github/GitObject.py index 8e5126a0..e5a2db27 100644 --- a/github/GitObject.py +++ b/github/GitObject.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,33 +13,34 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class GitObject( GithubObject.BasicGithubObject ): + +class GitObject(github.GithubObject.BasicGithubObject): @property - def sha( self ): - return self._NoneIfNotSet( self._sha ) + def sha(self): + return self._NoneIfNotSet(self._sha) @property - def type( self ): - return self._NoneIfNotSet( self._type ) + def type(self): + return self._NoneIfNotSet(self._type) @property - def url( self ): - return self._NoneIfNotSet( self._url ) + def url(self): + return self._NoneIfNotSet(self._url) - def _initAttributes( self ): - self._sha = GithubObject.NotSet - self._type = GithubObject.NotSet - self._url = GithubObject.NotSet + def _initAttributes(self): + self._sha = github.GithubObject.NotSet + self._type = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "sha" in attributes: # pragma no branch - assert attributes[ "sha" ] is None or isinstance( attributes[ "sha" ], ( str, unicode ) ), attributes[ "sha" ] - self._sha = attributes[ "sha" ] - if "type" in attributes: # pragma no branch - assert attributes[ "type" ] is None or isinstance( attributes[ "type" ], ( str, unicode ) ), attributes[ "type" ] - self._type = attributes[ "type" ] - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] + def _useAttributes(self, attributes): + if "sha" in attributes: # pragma no branch + assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"] + self._sha = attributes["sha"] + if "type" in attributes: # pragma no branch + assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"] + self._type = attributes["type"] + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] diff --git a/github/GitRef.py b/github/GitRef.py index b9cfee0c..ce6a0904 100644 --- a/github/GitRef.py +++ b/github/GitRef.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,27 +13,28 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import GitObject +import github.GitObject -class GitRef( GithubObject.GithubObject ): + +class GitRef(github.GithubObject.GithubObject): @property - def object( self ): - self._completeIfNotSet( self._object ) - return self._NoneIfNotSet( self._object ) + def object(self): + self._completeIfNotSet(self._object) + return self._NoneIfNotSet(self._object) @property - def ref( self ): - self._completeIfNotSet( self._ref ) - return self._NoneIfNotSet( self._ref ) + def ref(self): + self._completeIfNotSet(self._ref) + return self._NoneIfNotSet(self._ref) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) - def delete( self ): + def delete(self): headers, data = self._requester.requestAndCheck( "DELETE", self.url, @@ -39,34 +42,34 @@ class GitRef( GithubObject.GithubObject ): None ) - def edit( self, sha, force = GithubObject.NotSet ): - assert isinstance( sha, ( str, unicode ) ), sha - assert force is GithubObject.NotSet or isinstance( force, bool ), force + def edit(self, sha, force=github.GithubObject.NotSet): + assert isinstance(sha, (str, unicode)), sha + assert force is github.GithubObject.NotSet or isinstance(force, bool), force post_parameters = { "sha": sha, } - if force is not GithubObject.NotSet: - post_parameters[ "force" ] = force + if force is not github.GithubObject.NotSet: + post_parameters["force"] = force headers, data = self._requester.requestAndCheck( "PATCH", self.url, None, post_parameters ) - self._useAttributes( data ) + self._useAttributes(data) - def _initAttributes( self ): - self._object = GithubObject.NotSet - self._ref = GithubObject.NotSet - self._url = GithubObject.NotSet + def _initAttributes(self): + self._object = github.GithubObject.NotSet + self._ref = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "object" in attributes: # pragma no branch - assert attributes[ "object" ] is None or isinstance( attributes[ "object" ], dict ), attributes[ "object" ] - self._object = None if attributes[ "object" ] is None else GitObject.GitObject( self._requester, attributes[ "object" ], completed = False ) - if "ref" in attributes: # pragma no branch - assert attributes[ "ref" ] is None or isinstance( attributes[ "ref" ], ( str, unicode ) ), attributes[ "ref" ] - self._ref = attributes[ "ref" ] - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] + def _useAttributes(self, attributes): + if "object" in attributes: # pragma no branch + assert attributes["object"] is None or isinstance(attributes["object"], dict), attributes["object"] + self._object = None if attributes["object"] is None else github.GitObject.GitObject(self._requester, attributes["object"], completed=False) + if "ref" in attributes: # pragma no branch + assert attributes["ref"] is None or isinstance(attributes["ref"], (str, unicode)), attributes["ref"] + self._ref = attributes["ref"] + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] diff --git a/github/GitTag.py b/github/GitTag.py index 01594b33..fa16597e 100644 --- a/github/GitTag.py +++ b/github/GitTag.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,66 +13,67 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import GitAuthor -import GitObject +import github.GitAuthor +import github.GitObject -class GitTag( GithubObject.GithubObject ): + +class GitTag(github.GithubObject.GithubObject): @property - def message( self ): - self._completeIfNotSet( self._message ) - return self._NoneIfNotSet( self._message ) + def message(self): + self._completeIfNotSet(self._message) + return self._NoneIfNotSet(self._message) @property - def object( self ): - self._completeIfNotSet( self._object ) - return self._NoneIfNotSet( self._object ) + def object(self): + self._completeIfNotSet(self._object) + return self._NoneIfNotSet(self._object) @property - def sha( self ): - self._completeIfNotSet( self._sha ) - return self._NoneIfNotSet( self._sha ) + def sha(self): + self._completeIfNotSet(self._sha) + return self._NoneIfNotSet(self._sha) @property - def tag( self ): - self._completeIfNotSet( self._tag ) - return self._NoneIfNotSet( self._tag ) + def tag(self): + self._completeIfNotSet(self._tag) + return self._NoneIfNotSet(self._tag) @property - def tagger( self ): - self._completeIfNotSet( self._tagger ) - return self._NoneIfNotSet( self._tagger ) + def tagger(self): + self._completeIfNotSet(self._tagger) + return self._NoneIfNotSet(self._tagger) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) - def _initAttributes( self ): - self._message = GithubObject.NotSet - self._object = GithubObject.NotSet - self._sha = GithubObject.NotSet - self._tag = GithubObject.NotSet - self._tagger = GithubObject.NotSet - self._url = GithubObject.NotSet + def _initAttributes(self): + self._message = github.GithubObject.NotSet + self._object = github.GithubObject.NotSet + self._sha = github.GithubObject.NotSet + self._tag = github.GithubObject.NotSet + self._tagger = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "message" in attributes: # pragma no branch - assert attributes[ "message" ] is None or isinstance( attributes[ "message" ], ( str, unicode ) ), attributes[ "message" ] - self._message = attributes[ "message" ] - if "object" in attributes: # pragma no branch - assert attributes[ "object" ] is None or isinstance( attributes[ "object" ], dict ), attributes[ "object" ] - self._object = None if attributes[ "object" ] is None else GitObject.GitObject( self._requester, attributes[ "object" ], completed = False ) - if "sha" in attributes: # pragma no branch - assert attributes[ "sha" ] is None or isinstance( attributes[ "sha" ], ( str, unicode ) ), attributes[ "sha" ] - self._sha = attributes[ "sha" ] - if "tag" in attributes: # pragma no branch - assert attributes[ "tag" ] is None or isinstance( attributes[ "tag" ], ( str, unicode ) ), attributes[ "tag" ] - self._tag = attributes[ "tag" ] - if "tagger" in attributes: # pragma no branch - assert attributes[ "tagger" ] is None or isinstance( attributes[ "tagger" ], dict ), attributes[ "tagger" ] - self._tagger = None if attributes[ "tagger" ] is None else GitAuthor.GitAuthor( self._requester, attributes[ "tagger" ], completed = False ) - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] + def _useAttributes(self, attributes): + if "message" in attributes: # pragma no branch + assert attributes["message"] is None or isinstance(attributes["message"], (str, unicode)), attributes["message"] + self._message = attributes["message"] + if "object" in attributes: # pragma no branch + assert attributes["object"] is None or isinstance(attributes["object"], dict), attributes["object"] + self._object = None if attributes["object"] is None else github.GitObject.GitObject(self._requester, attributes["object"], completed=False) + if "sha" in attributes: # pragma no branch + assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"] + self._sha = attributes["sha"] + if "tag" in attributes: # pragma no branch + assert attributes["tag"] is None or isinstance(attributes["tag"], (str, unicode)), attributes["tag"] + self._tag = attributes["tag"] + if "tagger" in attributes: # pragma no branch + assert attributes["tagger"] is None or isinstance(attributes["tagger"], dict), attributes["tagger"] + self._tagger = None if attributes["tagger"] is None else github.GitAuthor.GitAuthor(self._requester, attributes["tagger"], completed=False) + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] diff --git a/github/GitTree.py b/github/GitTree.py index 690cb6c7..926776f9 100644 --- a/github/GitTree.py +++ b/github/GitTree.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,45 +13,46 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import GitTreeElement +import github.GitTreeElement -class GitTree( GithubObject.GithubObject ): + +class GitTree(github.GithubObject.GithubObject): @property - def sha( self ): - self._completeIfNotSet( self._sha ) - return self._NoneIfNotSet( self._sha ) + def sha(self): + self._completeIfNotSet(self._sha) + return self._NoneIfNotSet(self._sha) @property - def tree( self ): - self._completeIfNotSet( self._tree ) - return self._NoneIfNotSet( self._tree ) + def tree(self): + self._completeIfNotSet(self._tree) + return self._NoneIfNotSet(self._tree) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) @property - def _identity( self ): + def _identity(self): return self.sha - def _initAttributes( self ): - self._sha = GithubObject.NotSet - self._tree = GithubObject.NotSet - self._url = GithubObject.NotSet + def _initAttributes(self): + self._sha = github.GithubObject.NotSet + self._tree = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "sha" in attributes: # pragma no branch - assert attributes[ "sha" ] is None or isinstance( attributes[ "sha" ], ( str, unicode ) ), attributes[ "sha" ] - self._sha = attributes[ "sha" ] - if "tree" in attributes: # pragma no branch - assert attributes[ "tree" ] is None or all( isinstance( element, dict ) for element in attributes[ "tree" ] ), attributes[ "tree" ] - self._tree = None if attributes[ "tree" ] is None else [ - GitTreeElement.GitTreeElement( self._requester, element, completed = False ) - for element in attributes[ "tree" ] + def _useAttributes(self, attributes): + if "sha" in attributes: # pragma no branch + assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"] + self._sha = attributes["sha"] + if "tree" in attributes: # pragma no branch + assert attributes["tree"] is None or all(isinstance(element, dict) for element in attributes["tree"]), attributes["tree"] + self._tree = None if attributes["tree"] is None else [ + github.GitTreeElement.GitTreeElement(self._requester, element, completed=False) + for element in attributes["tree"] ] - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] diff --git a/github/GitTreeElement.py b/github/GitTreeElement.py index bb075cd3..d2ec2027 100644 --- a/github/GitTreeElement.py +++ b/github/GitTreeElement.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,57 +13,58 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class GitTreeElement( GithubObject.BasicGithubObject ): + +class GitTreeElement(github.GithubObject.BasicGithubObject): @property - def mode( self ): - return self._NoneIfNotSet( self._mode ) + def mode(self): + return self._NoneIfNotSet(self._mode) @property - def path( self ): - return self._NoneIfNotSet( self._path ) + def path(self): + return self._NoneIfNotSet(self._path) @property - def sha( self ): - return self._NoneIfNotSet( self._sha ) + def sha(self): + return self._NoneIfNotSet(self._sha) @property - def size( self ): - return self._NoneIfNotSet( self._size ) + def size(self): + return self._NoneIfNotSet(self._size) @property - def type( self ): - return self._NoneIfNotSet( self._type ) + def type(self): + return self._NoneIfNotSet(self._type) @property - def url( self ): - return self._NoneIfNotSet( self._url ) + def url(self): + return self._NoneIfNotSet(self._url) - def _initAttributes( self ): - self._mode = GithubObject.NotSet - self._path = GithubObject.NotSet - self._sha = GithubObject.NotSet - self._size = GithubObject.NotSet - self._type = GithubObject.NotSet - self._url = GithubObject.NotSet + def _initAttributes(self): + self._mode = github.GithubObject.NotSet + self._path = github.GithubObject.NotSet + self._sha = github.GithubObject.NotSet + self._size = github.GithubObject.NotSet + self._type = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "mode" in attributes: # pragma no branch - assert attributes[ "mode" ] is None or isinstance( attributes[ "mode" ], ( str, unicode ) ), attributes[ "mode" ] - self._mode = attributes[ "mode" ] - if "path" in attributes: # pragma no branch - assert attributes[ "path" ] is None or isinstance( attributes[ "path" ], ( str, unicode ) ), attributes[ "path" ] - self._path = attributes[ "path" ] - if "sha" in attributes: # pragma no branch - assert attributes[ "sha" ] is None or isinstance( attributes[ "sha" ], ( str, unicode ) ), attributes[ "sha" ] - self._sha = attributes[ "sha" ] - if "size" in attributes: # pragma no branch - assert attributes[ "size" ] is None or isinstance( attributes[ "size" ], int ), attributes[ "size" ] - self._size = attributes[ "size" ] - if "type" in attributes: # pragma no branch - assert attributes[ "type" ] is None or isinstance( attributes[ "type" ], ( str, unicode ) ), attributes[ "type" ] - self._type = attributes[ "type" ] - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] + def _useAttributes(self, attributes): + if "mode" in attributes: # pragma no branch + assert attributes["mode"] is None or isinstance(attributes["mode"], (str, unicode)), attributes["mode"] + self._mode = attributes["mode"] + if "path" in attributes: # pragma no branch + assert attributes["path"] is None or isinstance(attributes["path"], (str, unicode)), attributes["path"] + self._path = attributes["path"] + if "sha" in attributes: # pragma no branch + assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"] + self._sha = attributes["sha"] + if "size" in attributes: # pragma no branch + assert attributes["size"] is None or isinstance(attributes["size"], (int, long)), attributes["size"] + self._size = attributes["size"] + if "type" in attributes: # pragma no branch + assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"] + self._type = attributes["type"] + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] diff --git a/github/Github.py b/github/Github.py index 88b79fee..e4e548f6 100644 --- a/github/Github.py +++ b/github/Github.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -18,27 +20,37 @@ import AuthenticatedUser import NamedUser import Organization import Gist -import PaginatedList +import github.PaginatedList import Repository import Legacy -import GithubObject +import github.GithubObject import HookDescription + DEFAULT_BASE_URL = "https://api.github.com" DEFAULT_TIMEOUT = 10 -class Github( object ): - def __init__( self, login_or_token = None, password = None, base_url = DEFAULT_BASE_URL, timeout = DEFAULT_TIMEOUT ): - self.__requester = Requester( login_or_token, password, base_url, timeout ) + +class Github(object): + def __init__(self, login_or_token=None, password=None, base_url=DEFAULT_BASE_URL, timeout=DEFAULT_TIMEOUT, client_id=None, client_secret=None, user_agent=None): + self.__requester = Requester(login_or_token, password, base_url, timeout, client_id, client_secret, user_agent) + + def get_FIX_REPO_GET_GIT_REF(self): + return self.__requester.FIX_REPO_GET_GIT_REF + + def set_FIX_REPO_GET_GIT_REF(self, value): + self.__requester.FIX_REPO_GET_GIT_REF = value + + FIX_REPO_GET_GIT_REF = property(get_FIX_REPO_GET_GIT_REF, set_FIX_REPO_GET_GIT_REF) @property - def rate_limiting( self ): + def rate_limiting(self): return self.__requester.rate_limiting - def get_user( self, login = GithubObject.NotSet ): - assert login is GithubObject.NotSet or isinstance( login, ( str, unicode ) ), login - if login is GithubObject.NotSet: - return AuthenticatedUser.AuthenticatedUser( self.__requester, { "url": "/user" }, completed = False ) + def get_user(self, login=github.GithubObject.NotSet): + assert login is github.GithubObject.NotSet or isinstance(login, (str, unicode)), login + if login is github.GithubObject.NotSet: + return AuthenticatedUser.AuthenticatedUser(self.__requester, {"url": "/user"}, completed=False) else: headers, data = self.__requester.requestAndCheck( "GET", @@ -46,79 +58,79 @@ class Github( object ): None, None ) - return NamedUser.NamedUser( self.__requester, data, completed = True ) + return github.NamedUser.NamedUser(self.__requester, data, completed=True) - def get_organization( self, login ): - assert isinstance( login, ( str, unicode ) ), login + def get_organization(self, login): + assert isinstance(login, (str, unicode)), login headers, data = self.__requester.requestAndCheck( "GET", "/orgs/" + login, None, None ) - return Organization.Organization( self.__requester, data, completed = True ) + return github.Organization.Organization(self.__requester, data, completed=True) - def get_gist( self, id ): - assert isinstance( id, ( str, unicode ) ), id + def get_gist(self, id): + assert isinstance(id, (str, unicode)), id headers, data = self.__requester.requestAndCheck( "GET", "/gists/" + id, None, None ) - return Gist.Gist( self.__requester, data, completed = True ) + return github.Gist.Gist(self.__requester, data, completed=True) - def get_gists( self ): - return PaginatedList.PaginatedList( - Gist.Gist, + def get_gists(self): + return github.PaginatedList.PaginatedList( + github.Gist.Gist, self.__requester, "/gists/public", None ) - def legacy_search_repos( self, keyword, language = GithubObject.NotSet ): - assert isinstance( keyword, ( str, unicode ) ), keyword - assert language is GithubObject.NotSet or isinstance( language, ( str, unicode ) ), language - args = {} if language is GithubObject.NotSet else { "language": language } + def legacy_search_repos(self, keyword, language=github.GithubObject.NotSet): + assert isinstance(keyword, (str, unicode)), keyword + assert language is github.GithubObject.NotSet or isinstance(language, (str, unicode)), language + args = {} if language is github.GithubObject.NotSet else {"language": language} return Legacy.PaginatedList( - "/legacy/repos/search/" + urllib.quote( keyword ), + "/legacy/repos/search/" + urllib.quote(keyword), args, self.__requester, "repositories", Legacy.convertRepo, - Repository.Repository, + github.Repository.Repository, ) - def legacy_search_users( self, keyword ): - assert isinstance( keyword, ( str, unicode ) ), keyword + def legacy_search_users(self, keyword): + assert isinstance(keyword, (str, unicode)), keyword return Legacy.PaginatedList( - "/legacy/user/search/" + urllib.quote( keyword ), + "/legacy/user/search/" + urllib.quote(keyword), {}, self.__requester, "users", Legacy.convertUser, - NamedUser.NamedUser, + github.NamedUser.NamedUser, ) - def legacy_search_user_by_email( self, email ): - assert isinstance( email, ( str, unicode ) ), email + def legacy_search_user_by_email(self, email): + assert isinstance(email, (str, unicode)), email headers, data = self.__requester.requestAndCheck( "GET", "/legacy/user/email/" + email, None, None ) - return NamedUser.NamedUser( self.__requester, Legacy.convertUser( data[ "user" ] ), completed = False ) + return github.NamedUser.NamedUser(self.__requester, Legacy.convertUser(data["user"]), completed=False) - def render_markdown( self, text, context = GithubObject.NotSet ): - assert isinstance( text, ( str, unicode ) ), text - assert context is GithubObject.NotSet or isinstance( context, Repository.Repository ), context + def render_markdown(self, text, context=github.GithubObject.NotSet): + assert isinstance(text, (str, unicode)), text + assert context is github.GithubObject.NotSet or isinstance(context, github.Repository.Repository), context post_parameters = { "text": text } - if context is not GithubObject.NotSet: - post_parameters[ "mode" ] = "gfm" - post_parameters[ "context" ] = context._identity + if context is not github.GithubObject.NotSet: + post_parameters["mode"] = "gfm" + post_parameters["context"] = context._identity status, headers, data = self.__requester.requestRaw( "POST", "/markdown", @@ -127,11 +139,11 @@ class Github( object ): ) return data - def get_hooks( self ): + def get_hooks(self): headers, data = self.__requester.requestAndCheck( "GET", "/hooks", None, None ) - return [ HookDescription.HookDescription( self.__requester, attributes, completed = True ) for attributes in data ] + return [HookDescription.HookDescription(self.__requester, attributes, completed=True) for attributes in data] diff --git a/github/GithubException.py b/github/GithubException.py index daeb6463..11b615a5 100644 --- a/github/GithubException.py +++ b/github/GithubException.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,11 +13,12 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -class GithubException( Exception ): - def __init__( self, status, data ): - Exception.__init__( self ) + +class GithubException(Exception): + def __init__(self, status, data): + Exception.__init__(self) self.status = status self.data = data - def __str__( self ): - return str( self.status ) + " " + str( self.data ) + def __str__(self): + return str(self.status) + " " + str(self.data) diff --git a/github/GithubObject.py b/github/GithubObject.py index 0f612cf7..dcba0e81 100644 --- a/github/GithubObject.py +++ b/github/GithubObject.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -15,54 +17,57 @@ import datetime import GithubException + class _NotSetType: def __repr__( self ): return "NotSet" NotSet = _NotSetType() -class BasicGithubObject( object ): - def __init__( self, requester, attributes ): + +class BasicGithubObject(object): + def __init__(self, requester, attributes): self._requester = requester self._initAttributes() - self._useAttributes( attributes ) + self._useAttributes(attributes) @staticmethod - def _parentUrl( url ): - return "/".join( url.split( "/" )[ : -1 ] ) + def _parentUrl(url): + return "/".join(url.split("/")[: -1]) @staticmethod - def _NoneIfNotSet( value ): + def _NoneIfNotSet(value): if value is NotSet: return None else: return value @staticmethod - def _parseDatetime( s ): + def _parseDatetime(s): if s is None: return None - elif len( s ) == 24: - return datetime.datetime.strptime( s, "%Y-%m-%dT%H:%M:%S.000Z" ) - elif len( s ) == 25: - return datetime.datetime.strptime( s[ : 19 ], "%Y-%m-%dT%H:%M:%S" ) + ( 1 if s[ 19 ] == '-' else -1 ) * datetime.timedelta( hours = int( s[ 20 : 22 ] ), minutes = int( s[ 23 : 25 ] ) ) + elif len(s) == 24: + return datetime.datetime.strptime(s, "%Y-%m-%dT%H:%M:%S.000Z") + elif len(s) == 25: + return datetime.datetime.strptime(s[:19], "%Y-%m-%dT%H:%M:%S") + (1 if s[19] == '-' else -1) * datetime.timedelta(hours=int(s[20:22]), minutes=int(s[23:25])) else: - return datetime.datetime.strptime( s, "%Y-%m-%dT%H:%M:%SZ" ) + return datetime.datetime.strptime(s, "%Y-%m-%dT%H:%M:%SZ") -class GithubObject( BasicGithubObject ): - def __init__( self, requester, attributes, completed ): - BasicGithubObject.__init__( self, requester, attributes, completed ) + +class GithubObject(BasicGithubObject): + def __init__(self, requester, attributes, completed): + BasicGithubObject.__init__(self, requester, attributes, completed) self.__completed = completed - def _completeIfNotSet( self, value ): + def _completeIfNotSet(self, value): if not self.__completed and value is NotSet: self.__complete() - def __complete( self ): + def __complete(self): headers, data = self._requester.requestAndCheck( "GET", self._url, None, None ) - self._useAttributes( data ) + self._useAttributes(data) self._completed = True diff --git a/github/Hook.py b/github/Hook.py index ad7f49f2..a1faccb1 100644 --- a/github/Hook.py +++ b/github/Hook.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,57 +13,58 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import HookResponse +import github.HookResponse -class Hook( GithubObject.GithubObject ): + +class Hook(github.GithubObject.GithubObject): @property - def active( self ): - self._completeIfNotSet( self._active ) - return self._NoneIfNotSet( self._active ) + def active(self): + self._completeIfNotSet(self._active) + return self._NoneIfNotSet(self._active) @property - def config( self ): - self._completeIfNotSet( self._config ) - return self._NoneIfNotSet( self._config ) + def config(self): + self._completeIfNotSet(self._config) + return self._NoneIfNotSet(self._config) @property - def created_at( self ): - self._completeIfNotSet( self._created_at ) - return self._NoneIfNotSet( self._created_at ) + def created_at(self): + self._completeIfNotSet(self._created_at) + return self._NoneIfNotSet(self._created_at) @property - def events( self ): - self._completeIfNotSet( self._events ) - return self._NoneIfNotSet( self._events ) + def events(self): + self._completeIfNotSet(self._events) + return self._NoneIfNotSet(self._events) @property - def id( self ): - self._completeIfNotSet( self._id ) - return self._NoneIfNotSet( self._id ) + def id(self): + self._completeIfNotSet(self._id) + return self._NoneIfNotSet(self._id) @property - def last_response( self ): - self._completeIfNotSet( self._last_response ) - return self._NoneIfNotSet( self._last_response ) + def last_response(self): + self._completeIfNotSet(self._last_response) + return self._NoneIfNotSet(self._last_response) @property - def name( self ): - self._completeIfNotSet( self._name ) - return self._NoneIfNotSet( self._name ) + def name(self): + self._completeIfNotSet(self._name) + return self._NoneIfNotSet(self._name) @property - def updated_at( self ): - self._completeIfNotSet( self._updated_at ) - return self._NoneIfNotSet( self._updated_at ) + def updated_at(self): + self._completeIfNotSet(self._updated_at) + return self._NoneIfNotSet(self._updated_at) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) - def delete( self ): + def delete(self): headers, data = self._requester.requestAndCheck( "DELETE", self.url, @@ -69,34 +72,34 @@ class Hook( GithubObject.GithubObject ): None ) - def edit( self, name, config, events = GithubObject.NotSet, add_events = GithubObject.NotSet, remove_events = GithubObject.NotSet, active = GithubObject.NotSet ): - assert isinstance( name, ( str, unicode ) ), name - assert isinstance( config, dict ), config - assert events is GithubObject.NotSet or all( isinstance( element, ( str, unicode ) ) for element in events ), events - assert add_events is GithubObject.NotSet or all( isinstance( element, ( str, unicode ) ) for element in add_events ), add_events - assert remove_events is GithubObject.NotSet or all( isinstance( element, ( str, unicode ) ) for element in remove_events ), remove_events - assert active is GithubObject.NotSet or isinstance( active, bool ), active + def edit(self, name, config, events=github.GithubObject.NotSet, add_events=github.GithubObject.NotSet, remove_events=github.GithubObject.NotSet, active=github.GithubObject.NotSet): + assert isinstance(name, (str, unicode)), name + assert isinstance(config, dict), config + assert events is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in events), events + assert add_events is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in add_events), add_events + assert remove_events is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in remove_events), remove_events + assert active is github.GithubObject.NotSet or isinstance(active, bool), active post_parameters = { "name": name, "config": config, } - if events is not GithubObject.NotSet: - post_parameters[ "events" ] = events - if add_events is not GithubObject.NotSet: - post_parameters[ "add_events" ] = add_events - if remove_events is not GithubObject.NotSet: - post_parameters[ "remove_events" ] = remove_events - if active is not GithubObject.NotSet: - post_parameters[ "active" ] = active + if events is not github.GithubObject.NotSet: + post_parameters["events"] = events + if add_events is not github.GithubObject.NotSet: + post_parameters["add_events"] = add_events + if remove_events is not github.GithubObject.NotSet: + post_parameters["remove_events"] = remove_events + if active is not github.GithubObject.NotSet: + post_parameters["active"] = active headers, data = self._requester.requestAndCheck( "PATCH", self.url, None, post_parameters ) - self._useAttributes( data ) + self._useAttributes(data) - def test( self ): + def test(self): headers, data = self._requester.requestAndCheck( "POST", self.url + "/test", @@ -104,42 +107,42 @@ class Hook( GithubObject.GithubObject ): None ) - def _initAttributes( self ): - self._active = GithubObject.NotSet - self._config = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._events = GithubObject.NotSet - self._id = GithubObject.NotSet - self._last_response = GithubObject.NotSet - self._name = GithubObject.NotSet - self._updated_at = GithubObject.NotSet - self._url = GithubObject.NotSet + def _initAttributes(self): + self._active = github.GithubObject.NotSet + self._config = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._events = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._last_response = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "active" in attributes: # pragma no branch - assert attributes[ "active" ] is None or isinstance( attributes[ "active" ], bool ), attributes[ "active" ] - self._active = attributes[ "active" ] - if "config" in attributes: # pragma no branch - assert attributes[ "config" ] is None or isinstance( attributes[ "config" ], dict ), attributes[ "config" ] - self._config = attributes[ "config" ] - if "created_at" in attributes: # pragma no branch - assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = self._parseDatetime( attributes[ "created_at" ] ) - if "events" in attributes: # pragma no branch - assert attributes[ "events" ] is None or all( isinstance( element, ( str, unicode ) ) for element in attributes[ "events" ] ), attributes[ "events" ] - self._events = attributes[ "events" ] - if "id" in attributes: # pragma no branch - assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] - self._id = attributes[ "id" ] - if "last_response" in attributes: # pragma no branch - assert attributes[ "last_response" ] is None or isinstance( attributes[ "last_response" ], dict ), attributes[ "last_response" ] - self._last_response = None if attributes[ "last_response" ] is None else HookResponse.HookResponse( self._requester, attributes[ "last_response" ], completed = False ) - if "name" in attributes: # pragma no branch - assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ] - self._name = attributes[ "name" ] - if "updated_at" in attributes: # pragma no branch - assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ] - self._updated_at = self._parseDatetime( attributes[ "updated_at" ] ) - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] + def _useAttributes(self, attributes): + if "active" in attributes: # pragma no branch + assert attributes["active"] is None or isinstance(attributes["active"], bool), attributes["active"] + self._active = attributes["active"] + if "config" in attributes: # pragma no branch + assert attributes["config"] is None or isinstance(attributes["config"], dict), attributes["config"] + self._config = attributes["config"] + if "created_at" in attributes: # pragma no branch + assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"] + self._created_at = self._parseDatetime(attributes["created_at"]) + if "events" in attributes: # pragma no branch + assert attributes["events"] is None or all(isinstance(element, (str, unicode)) for element in attributes["events"]), attributes["events"] + self._events = attributes["events"] + if "id" in attributes: # pragma no branch + assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] + self._id = attributes["id"] + if "last_response" in attributes: # pragma no branch + assert attributes["last_response"] is None or isinstance(attributes["last_response"], dict), attributes["last_response"] + self._last_response = None if attributes["last_response"] is None else github.HookResponse.HookResponse(self._requester, attributes["last_response"], completed=False) + if "name" in attributes: # pragma no branch + assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] + self._name = attributes["name"] + if "updated_at" in attributes: # pragma no branch + assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], (str, unicode)), attributes["updated_at"] + self._updated_at = self._parseDatetime(attributes["updated_at"]) + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] diff --git a/github/HookDescription.py b/github/HookDescription.py index eb329fd4..68fd4269 100644 --- a/github/HookDescription.py +++ b/github/HookDescription.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,41 +13,42 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class HookDescription( GithubObject.BasicGithubObject ): + +class HookDescription(github.GithubObject.BasicGithubObject): @property - def events( self ): - return self._NoneIfNotSet( self._events ) + def events(self): + return self._NoneIfNotSet(self._events) @property - def name( self ): - return self._NoneIfNotSet( self._name ) + def name(self): + return self._NoneIfNotSet(self._name) @property - def schema( self ): - return self._NoneIfNotSet( self._schema ) + def schema(self): + return self._NoneIfNotSet(self._schema) @property - def supported_events( self ): - return self._NoneIfNotSet( self._supported_events ) + def supported_events(self): + return self._NoneIfNotSet(self._supported_events) - def _initAttributes( self ): - self._events = GithubObject.NotSet - self._name = GithubObject.NotSet - self._schema = GithubObject.NotSet - self._supported_events = GithubObject.NotSet + def _initAttributes(self): + self._events = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._schema = github.GithubObject.NotSet + self._supported_events = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "events" in attributes: # pragma no branch - assert attributes[ "events" ] is None or all( isinstance( element, ( str, unicode ) ) for element in attributes[ "events" ] ), attributes[ "events" ] - self._events = attributes[ "events" ] - if "name" in attributes: # pragma no branch - assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ] - self._name = attributes[ "name" ] - if "schema" in attributes: # pragma no branch - assert attributes[ "schema" ] is None or all( isinstance( element, list ) for element in attributes[ "schema" ] ), attributes[ "schema" ] - self._schema = attributes[ "schema" ] - if "supported_events" in attributes: # pragma no branch - assert attributes[ "supported_events" ] is None or all( isinstance( element, ( str, unicode ) ) for element in attributes[ "supported_events" ] ), attributes[ "supported_events" ] - self._supported_events = attributes[ "supported_events" ] + def _useAttributes(self, attributes): + if "events" in attributes: # pragma no branch + assert attributes["events"] is None or all(isinstance(element, (str, unicode)) for element in attributes["events"]), attributes["events"] + self._events = attributes["events"] + if "name" in attributes: # pragma no branch + assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] + self._name = attributes["name"] + if "schema" in attributes: # pragma no branch + assert attributes["schema"] is None or all(isinstance(element, list) for element in attributes["schema"]), attributes["schema"] + self._schema = attributes["schema"] + if "supported_events" in attributes: # pragma no branch + assert attributes["supported_events"] is None or all(isinstance(element, (str, unicode)) for element in attributes["supported_events"]), attributes["supported_events"] + self._supported_events = attributes["supported_events"] diff --git a/github/HookResponse.py b/github/HookResponse.py index 158bfb85..3554c481 100644 --- a/github/HookResponse.py +++ b/github/HookResponse.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,33 +13,34 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class HookResponse( GithubObject.BasicGithubObject ): + +class HookResponse(github.GithubObject.BasicGithubObject): @property - def code( self ): - return self._NoneIfNotSet( self._code ) + def code(self): + return self._NoneIfNotSet(self._code) @property - def message( self ): - return self._NoneIfNotSet( self._message ) + def message(self): + return self._NoneIfNotSet(self._message) @property - def status( self ): - return self._NoneIfNotSet( self._status ) + def status(self): + return self._NoneIfNotSet(self._status) - def _initAttributes( self ): - self._code = GithubObject.NotSet - self._message = GithubObject.NotSet - self._status = GithubObject.NotSet + def _initAttributes(self): + self._code = github.GithubObject.NotSet + self._message = github.GithubObject.NotSet + self._status = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "code" in attributes: # pragma no branch - assert attributes[ "code" ] is None or isinstance( attributes[ "code" ], int ), attributes[ "code" ] - self._code = attributes[ "code" ] - if "message" in attributes: # pragma no branch - assert attributes[ "message" ] is None or isinstance( attributes[ "message" ], ( str, unicode ) ), attributes[ "message" ] - self._message = attributes[ "message" ] - if "status" in attributes: # pragma no branch - assert attributes[ "status" ] is None or isinstance( attributes[ "status" ], ( str, unicode ) ), attributes[ "status" ] - self._status = attributes[ "status" ] + def _useAttributes(self, attributes): + if "code" in attributes: # pragma no branch + assert attributes["code"] is None or isinstance(attributes["code"], (int, long)), attributes["code"] + self._code = attributes["code"] + if "message" in attributes: # pragma no branch + assert attributes["message"] is None or isinstance(attributes["message"], (str, unicode)), attributes["message"] + self._message = attributes["message"] + if "status" in attributes: # pragma no branch + assert attributes["status"] is None or isinstance(attributes["status"], (str, unicode)), attributes["status"] + self._status = attributes["status"] diff --git a/github/InputFileContent.py b/github/InputFileContent.py index 2977b2fa..b3234622 100644 --- a/github/InputFileContent.py +++ b/github/InputFileContent.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,12 +13,13 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -class InputFileContent( object ): - def __init__( self, content ): + +class InputFileContent(object): + def __init__(self, content): self.__content = content @property - def _identity( self ): + def _identity(self): return { "content": self.__content, } diff --git a/github/InputGitAuthor.py b/github/InputGitAuthor.py index 24e340fd..4dbacb2c 100644 --- a/github/InputGitAuthor.py +++ b/github/InputGitAuthor.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,14 +13,15 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -class InputGitAuthor( object ): - def __init__( self, name, email, date ): + +class InputGitAuthor(object): + def __init__(self, name, email, date): self.__name = name self.__email = email self.__date = date @property - def _identity( self ): + def _identity(self): return { "name": self.__name, "email": self.__email, diff --git a/github/InputGitTreeElement.py b/github/InputGitTreeElement.py index 96274487..5211fa99 100644 --- a/github/InputGitTreeElement.py +++ b/github/InputGitTreeElement.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,10 +13,11 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class InputGitTreeElement( object ): - def __init__( self, path, mode, type, content = GithubObject.NotSet, sha = GithubObject.NotSet ): + +class InputGitTreeElement(object): + def __init__(self, path, mode, type, content=github.GithubObject.NotSet, sha=github.GithubObject.NotSet): self.__path = path self.__mode = mode self.__type = type @@ -22,14 +25,14 @@ class InputGitTreeElement( object ): self.__sha = sha @property - def _identity( self ): + def _identity(self): identity = { "path": self.__path, "mode": self.__mode, "type": self.__type, } - if self.__sha is not GithubObject.NotSet: - identity[ "sha" ] = self.__sha - if self.__content is not GithubObject.NotSet: - identity[ "content" ] = self.__content + if self.__sha is not github.GithubObject.NotSet: + identity["sha"] = self.__sha + if self.__content is not github.GithubObject.NotSet: + identity["content"] = self.__content return identity diff --git a/github/Issue.py b/github/Issue.py index 0a6288cb..c502f30e 100644 --- a/github/Issue.py +++ b/github/Issue.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,111 +13,112 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject -import PaginatedList +import github.GithubObject +import github.PaginatedList -import Repository -import IssueEvent -import Label -import NamedUser -import Milestone -import IssueComment -import IssuePullRequest +import github.Repository +import github.IssueEvent +import github.Label +import github.NamedUser +import github.Milestone +import github.IssueComment +import github.IssuePullRequest -class Issue( GithubObject.GithubObject ): + +class Issue(github.GithubObject.GithubObject): @property - def assignee( self ): - self._completeIfNotSet( self._assignee ) - return self._NoneIfNotSet( self._assignee ) + def assignee(self): + self._completeIfNotSet(self._assignee) + return self._NoneIfNotSet(self._assignee) @property - def body( self ): - self._completeIfNotSet( self._body ) - return self._NoneIfNotSet( self._body ) + def body(self): + self._completeIfNotSet(self._body) + return self._NoneIfNotSet(self._body) @property - def closed_at( self ): - self._completeIfNotSet( self._closed_at ) - return self._NoneIfNotSet( self._closed_at ) + def closed_at(self): + self._completeIfNotSet(self._closed_at) + return self._NoneIfNotSet(self._closed_at) @property - def closed_by( self ): - self._completeIfNotSet( self._closed_by ) - return self._NoneIfNotSet( self._closed_by ) + def closed_by(self): + self._completeIfNotSet(self._closed_by) + return self._NoneIfNotSet(self._closed_by) @property - def comments( self ): - self._completeIfNotSet( self._comments ) - return self._NoneIfNotSet( self._comments ) + def comments(self): + self._completeIfNotSet(self._comments) + return self._NoneIfNotSet(self._comments) @property - def created_at( self ): - self._completeIfNotSet( self._created_at ) - return self._NoneIfNotSet( self._created_at ) + def created_at(self): + self._completeIfNotSet(self._created_at) + return self._NoneIfNotSet(self._created_at) @property - def html_url( self ): - self._completeIfNotSet( self._html_url ) - return self._NoneIfNotSet( self._html_url ) + def html_url(self): + self._completeIfNotSet(self._html_url) + return self._NoneIfNotSet(self._html_url) @property - def id( self ): - self._completeIfNotSet( self._id ) - return self._NoneIfNotSet( self._id ) + def id(self): + self._completeIfNotSet(self._id) + return self._NoneIfNotSet(self._id) @property - def labels( self ): - self._completeIfNotSet( self._labels ) - return self._NoneIfNotSet( self._labels ) + def labels(self): + self._completeIfNotSet(self._labels) + return self._NoneIfNotSet(self._labels) @property - def milestone( self ): - self._completeIfNotSet( self._milestone ) - return self._NoneIfNotSet( self._milestone ) + def milestone(self): + self._completeIfNotSet(self._milestone) + return self._NoneIfNotSet(self._milestone) @property - def number( self ): - self._completeIfNotSet( self._number ) - return self._NoneIfNotSet( self._number ) + def number(self): + self._completeIfNotSet(self._number) + return self._NoneIfNotSet(self._number) @property - def pull_request( self ): - self._completeIfNotSet( self._pull_request ) - return self._NoneIfNotSet( self._pull_request ) + def pull_request(self): + self._completeIfNotSet(self._pull_request) + return self._NoneIfNotSet(self._pull_request) @property - def repository( self ): - self._completeIfNotSet( self._repository ) - return self._NoneIfNotSet( self._repository ) + def repository(self): + self._completeIfNotSet(self._repository) + return self._NoneIfNotSet(self._repository) @property - def state( self ): - self._completeIfNotSet( self._state ) - return self._NoneIfNotSet( self._state ) + def state(self): + self._completeIfNotSet(self._state) + return self._NoneIfNotSet(self._state) @property - def title( self ): - self._completeIfNotSet( self._title ) - return self._NoneIfNotSet( self._title ) + def title(self): + self._completeIfNotSet(self._title) + return self._NoneIfNotSet(self._title) @property - def updated_at( self ): - self._completeIfNotSet( self._updated_at ) - return self._NoneIfNotSet( self._updated_at ) + def updated_at(self): + self._completeIfNotSet(self._updated_at) + return self._NoneIfNotSet(self._updated_at) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) @property - def user( self ): - self._completeIfNotSet( self._user ) - return self._NoneIfNotSet( self._user ) + def user(self): + self._completeIfNotSet(self._user) + return self._NoneIfNotSet(self._user) - def add_to_labels( self, *labels ): - assert all( isinstance( element, Label.Label ) for element in labels ), labels - post_parameters = [ label.name for label in labels ] + def add_to_labels(self, *labels): + assert all(isinstance(element, github.Label.Label) for element in labels), labels + post_parameters = [label.name for label in labels] headers, data = self._requester.requestAndCheck( "POST", self.url + "/labels", @@ -123,8 +126,8 @@ class Issue( GithubObject.GithubObject ): post_parameters ) - def create_comment( self, body ): - assert isinstance( body, ( str, unicode ) ), body + def create_comment(self, body): + assert isinstance(body, (str, unicode)), body post_parameters = { "body": body, } @@ -134,9 +137,9 @@ class Issue( GithubObject.GithubObject ): None, post_parameters ) - return IssueComment.IssueComment( self._requester, data, completed = True ) + return github.IssueComment.IssueComment(self._requester, data, completed=True) - def delete_labels( self ): + def delete_labels(self): headers, data = self._requester.requestAndCheck( "DELETE", self.url + "/labels", @@ -144,70 +147,70 @@ class Issue( GithubObject.GithubObject ): None ) - def edit( self, title = GithubObject.NotSet, body = GithubObject.NotSet, assignee = GithubObject.NotSet, state = GithubObject.NotSet, milestone = GithubObject.NotSet, labels = GithubObject.NotSet ): - assert title is GithubObject.NotSet or isinstance( title, ( str, unicode ) ), title - assert body is GithubObject.NotSet or isinstance( body, ( str, unicode ) ), body - assert assignee is GithubObject.NotSet or assignee is None or isinstance( assignee, NamedUser.NamedUser ), assignee - assert state is GithubObject.NotSet or isinstance( state, ( str, unicode ) ), state - assert milestone is GithubObject.NotSet or milestone is None or isinstance( milestone, Milestone.Milestone ), milestone - assert labels is GithubObject.NotSet or all( isinstance( element, ( str, unicode ) ) for element in labels ), labels + def edit(self, title=github.GithubObject.NotSet, body=github.GithubObject.NotSet, assignee=github.GithubObject.NotSet, state=github.GithubObject.NotSet, milestone=github.GithubObject.NotSet, labels=github.GithubObject.NotSet): + assert title is github.GithubObject.NotSet or isinstance(title, (str, unicode)), title + assert body is github.GithubObject.NotSet or isinstance(body, (str, unicode)), body + assert assignee is github.GithubObject.NotSet or assignee is None or isinstance(assignee, github.NamedUser.NamedUser), assignee + assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state + assert milestone is github.GithubObject.NotSet or milestone is None or isinstance(milestone, github.Milestone.Milestone), milestone + assert labels is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in labels), labels post_parameters = dict() - if title is not GithubObject.NotSet: - post_parameters[ "title" ] = title - if body is not GithubObject.NotSet: - post_parameters[ "body" ] = body - if assignee is not GithubObject.NotSet: - post_parameters[ "assignee" ] = assignee._identity if assignee else '' - if state is not GithubObject.NotSet: - post_parameters[ "state" ] = state - if milestone is not GithubObject.NotSet: - post_parameters[ "milestone" ] = milestone._identity if milestone else '' - if labels is not GithubObject.NotSet: - post_parameters[ "labels" ] = labels + if title is not github.GithubObject.NotSet: + post_parameters["title"] = title + if body is not github.GithubObject.NotSet: + post_parameters["body"] = body + if assignee is not github.GithubObject.NotSet: + post_parameters["assignee"] = assignee._identity if assignee else '' + if state is not github.GithubObject.NotSet: + post_parameters["state"] = state + if milestone is not github.GithubObject.NotSet: + post_parameters["milestone"] = milestone._identity if milestone else '' + if labels is not github.GithubObject.NotSet: + post_parameters["labels"] = labels headers, data = self._requester.requestAndCheck( "PATCH", self.url, None, post_parameters ) - self._useAttributes( data ) + self._useAttributes(data) - def get_comment( self, id ): - assert isinstance( id, int ), id + def get_comment(self, id): + assert isinstance(id, (int, long)), id headers, data = self._requester.requestAndCheck( "GET", - self._parentUrl( self.url ) + "/comments/" + str( id ), + self._parentUrl(self.url) + "/comments/" + str(id), None, None ) - return IssueComment.IssueComment( self._requester, data, completed = True ) + return github.IssueComment.IssueComment(self._requester, data, completed=True) - def get_comments( self ): - return PaginatedList.PaginatedList( - IssueComment.IssueComment, + def get_comments(self): + return github.PaginatedList.PaginatedList( + github.IssueComment.IssueComment, self._requester, self.url + "/comments", None ) - def get_events( self ): - return PaginatedList.PaginatedList( - IssueEvent.IssueEvent, + def get_events(self): + return github.PaginatedList.PaginatedList( + github.IssueEvent.IssueEvent, self._requester, self.url + "/events", None ) - def get_labels( self ): - return PaginatedList.PaginatedList( - Label.Label, + def get_labels(self): + return github.PaginatedList.PaginatedList( + github.Label.Label, self._requester, self.url + "/labels", None ) - def remove_from_labels( self, label ): - assert isinstance( label, Label.Label ), label + def remove_from_labels(self, label): + assert isinstance(label, github.Label.Label), label headers, data = self._requester.requestAndCheck( "DELETE", self.url + "/labels/" + label._identity, @@ -215,9 +218,9 @@ class Issue( GithubObject.GithubObject ): None ) - def set_labels( self, *labels ): - assert all( isinstance( element, Label.Label ) for element in labels ), labels - post_parameters = [ label.name for label in labels ] + def set_labels(self, *labels): + assert all(isinstance(element, github.Label.Label) for element in labels), labels + post_parameters = [label.name for label in labels] headers, data = self._requester.requestAndCheck( "PUT", self.url + "/labels", @@ -226,84 +229,84 @@ class Issue( GithubObject.GithubObject ): ) @property - def _identity( self ): + def _identity(self): return self.number - def _initAttributes( self ): - self._assignee = GithubObject.NotSet - self._body = GithubObject.NotSet - self._closed_at = GithubObject.NotSet - self._closed_by = GithubObject.NotSet - self._comments = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._html_url = GithubObject.NotSet - self._id = GithubObject.NotSet - self._labels = GithubObject.NotSet - self._milestone = GithubObject.NotSet - self._number = GithubObject.NotSet - self._pull_request = GithubObject.NotSet - self._repository = GithubObject.NotSet - self._state = GithubObject.NotSet - self._title = GithubObject.NotSet - self._updated_at = GithubObject.NotSet - self._url = GithubObject.NotSet - self._user = GithubObject.NotSet + def _initAttributes(self): + self._assignee = github.GithubObject.NotSet + self._body = github.GithubObject.NotSet + self._closed_at = github.GithubObject.NotSet + self._closed_by = github.GithubObject.NotSet + self._comments = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._html_url = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._labels = github.GithubObject.NotSet + self._milestone = github.GithubObject.NotSet + self._number = github.GithubObject.NotSet + self._pull_request = github.GithubObject.NotSet + self._repository = github.GithubObject.NotSet + self._state = github.GithubObject.NotSet + self._title = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + self._user = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "assignee" in attributes: # pragma no branch - assert attributes[ "assignee" ] is None or isinstance( attributes[ "assignee" ], dict ), attributes[ "assignee" ] - self._assignee = None if attributes[ "assignee" ] is None else NamedUser.NamedUser( self._requester, attributes[ "assignee" ], completed = False ) - if "body" in attributes: # pragma no branch - assert attributes[ "body" ] is None or isinstance( attributes[ "body" ], ( str, unicode ) ), attributes[ "body" ] - self._body = attributes[ "body" ] - if "closed_at" in attributes: # pragma no branch - assert attributes[ "closed_at" ] is None or isinstance( attributes[ "closed_at" ], ( str, unicode ) ), attributes[ "closed_at" ] - self._closed_at = self._parseDatetime( attributes[ "closed_at" ] ) - if "closed_by" in attributes: # pragma no branch - assert attributes[ "closed_by" ] is None or isinstance( attributes[ "closed_by" ], dict ), attributes[ "closed_by" ] - self._closed_by = None if attributes[ "closed_by" ] is None else NamedUser.NamedUser( self._requester, attributes[ "closed_by" ], completed = False ) - if "comments" in attributes: # pragma no branch - assert attributes[ "comments" ] is None or isinstance( attributes[ "comments" ], int ), attributes[ "comments" ] - self._comments = attributes[ "comments" ] - if "created_at" in attributes: # pragma no branch - assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = self._parseDatetime( attributes[ "created_at" ] ) - if "html_url" in attributes: # pragma no branch - assert attributes[ "html_url" ] is None or isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ] - self._html_url = attributes[ "html_url" ] - if "id" in attributes: # pragma no branch - assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] - self._id = attributes[ "id" ] - if "labels" in attributes: # pragma no branch - assert attributes[ "labels" ] is None or all( isinstance( element, dict ) for element in attributes[ "labels" ] ), attributes[ "labels" ] - self._labels = None if attributes[ "labels" ] is None else [ - Label.Label( self._requester, element, completed = False ) - for element in attributes[ "labels" ] + def _useAttributes(self, attributes): + if "assignee" in attributes: # pragma no branch + assert attributes["assignee"] is None or isinstance(attributes["assignee"], dict), attributes["assignee"] + self._assignee = None if attributes["assignee"] is None else github.NamedUser.NamedUser(self._requester, attributes["assignee"], completed=False) + if "body" in attributes: # pragma no branch + assert attributes["body"] is None or isinstance(attributes["body"], (str, unicode)), attributes["body"] + self._body = attributes["body"] + if "closed_at" in attributes: # pragma no branch + assert attributes["closed_at"] is None or isinstance(attributes["closed_at"], (str, unicode)), attributes["closed_at"] + self._closed_at = self._parseDatetime(attributes["closed_at"]) + if "closed_by" in attributes: # pragma no branch + assert attributes["closed_by"] is None or isinstance(attributes["closed_by"], dict), attributes["closed_by"] + self._closed_by = None if attributes["closed_by"] is None else github.NamedUser.NamedUser(self._requester, attributes["closed_by"], completed=False) + if "comments" in attributes: # pragma no branch + assert attributes["comments"] is None or isinstance(attributes["comments"], (int, long)), attributes["comments"] + self._comments = attributes["comments"] + if "created_at" in attributes: # pragma no branch + assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"] + self._created_at = self._parseDatetime(attributes["created_at"]) + if "html_url" in attributes: # pragma no branch + assert attributes["html_url"] is None or isinstance(attributes["html_url"], (str, unicode)), attributes["html_url"] + self._html_url = attributes["html_url"] + if "id" in attributes: # pragma no branch + assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] + self._id = attributes["id"] + if "labels" in attributes: # pragma no branch + assert attributes["labels"] is None or all(isinstance(element, dict) for element in attributes["labels"]), attributes["labels"] + self._labels = None if attributes["labels"] is None else [ + github.Label.Label(self._requester, element, completed=False) + for element in attributes["labels"] ] - if "milestone" in attributes: # pragma no branch - assert attributes[ "milestone" ] is None or isinstance( attributes[ "milestone" ], dict ), attributes[ "milestone" ] - self._milestone = None if attributes[ "milestone" ] is None else Milestone.Milestone( self._requester, attributes[ "milestone" ], completed = False ) - if "number" in attributes: # pragma no branch - assert attributes[ "number" ] is None or isinstance( attributes[ "number" ], int ), attributes[ "number" ] - self._number = attributes[ "number" ] - if "pull_request" in attributes: # pragma no branch - assert attributes[ "pull_request" ] is None or isinstance( attributes[ "pull_request" ], dict ), attributes[ "pull_request" ] - self._pull_request = None if attributes[ "pull_request" ] is None else IssuePullRequest.IssuePullRequest( self._requester, attributes[ "pull_request" ], completed = False ) - if "repository" in attributes: # pragma no branch - assert attributes[ "repository" ] is None or isinstance( attributes[ "repository" ], dict ), attributes[ "repository" ] - self._repository = None if attributes[ "repository" ] is None else Repository.Repository( self._requester, attributes[ "repository" ], completed = False ) - if "state" in attributes: # pragma no branch - assert attributes[ "state" ] is None or isinstance( attributes[ "state" ], ( str, unicode ) ), attributes[ "state" ] - self._state = attributes[ "state" ] - if "title" in attributes: # pragma no branch - assert attributes[ "title" ] is None or isinstance( attributes[ "title" ], ( str, unicode ) ), attributes[ "title" ] - self._title = attributes[ "title" ] - if "updated_at" in attributes: # pragma no branch - assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ] - self._updated_at = self._parseDatetime( attributes[ "updated_at" ] ) - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] - if "user" in attributes: # pragma no branch - assert attributes[ "user" ] is None or isinstance( attributes[ "user" ], dict ), attributes[ "user" ] - self._user = None if attributes[ "user" ] is None else NamedUser.NamedUser( self._requester, attributes[ "user" ], completed = False ) + if "milestone" in attributes: # pragma no branch + assert attributes["milestone"] is None or isinstance(attributes["milestone"], dict), attributes["milestone"] + self._milestone = None if attributes["milestone"] is None else github.Milestone.Milestone(self._requester, attributes["milestone"], completed=False) + if "number" in attributes: # pragma no branch + assert attributes["number"] is None or isinstance(attributes["number"], (int, long)), attributes["number"] + self._number = attributes["number"] + if "pull_request" in attributes: # pragma no branch + assert attributes["pull_request"] is None or isinstance(attributes["pull_request"], dict), attributes["pull_request"] + self._pull_request = None if attributes["pull_request"] is None else github.IssuePullRequest.IssuePullRequest(self._requester, attributes["pull_request"], completed=False) + if "repository" in attributes: # pragma no branch + assert attributes["repository"] is None or isinstance(attributes["repository"], dict), attributes["repository"] + self._repository = None if attributes["repository"] is None else github.Repository.Repository(self._requester, attributes["repository"], completed=False) + if "state" in attributes: # pragma no branch + assert attributes["state"] is None or isinstance(attributes["state"], (str, unicode)), attributes["state"] + self._state = attributes["state"] + if "title" in attributes: # pragma no branch + assert attributes["title"] is None or isinstance(attributes["title"], (str, unicode)), attributes["title"] + self._title = attributes["title"] + if "updated_at" in attributes: # pragma no branch + assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], (str, unicode)), attributes["updated_at"] + self._updated_at = self._parseDatetime(attributes["updated_at"]) + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] + if "user" in attributes: # pragma no branch + assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"] + self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False) diff --git a/github/IssueComment.py b/github/IssueComment.py index d94e7d14..aab643a4 100644 --- a/github/IssueComment.py +++ b/github/IssueComment.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,42 +13,43 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import NamedUser +import github.NamedUser -class IssueComment( GithubObject.GithubObject ): + +class IssueComment(github.GithubObject.GithubObject): @property - def body( self ): - self._completeIfNotSet( self._body ) - return self._NoneIfNotSet( self._body ) + def body(self): + self._completeIfNotSet(self._body) + return self._NoneIfNotSet(self._body) @property - def created_at( self ): - self._completeIfNotSet( self._created_at ) - return self._NoneIfNotSet( self._created_at ) + def created_at(self): + self._completeIfNotSet(self._created_at) + return self._NoneIfNotSet(self._created_at) @property - def id( self ): - self._completeIfNotSet( self._id ) - return self._NoneIfNotSet( self._id ) + def id(self): + self._completeIfNotSet(self._id) + return self._NoneIfNotSet(self._id) @property - def updated_at( self ): - self._completeIfNotSet( self._updated_at ) - return self._NoneIfNotSet( self._updated_at ) + def updated_at(self): + self._completeIfNotSet(self._updated_at) + return self._NoneIfNotSet(self._updated_at) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) @property - def user( self ): - self._completeIfNotSet( self._user ) - return self._NoneIfNotSet( self._user ) + def user(self): + self._completeIfNotSet(self._user) + return self._NoneIfNotSet(self._user) - def delete( self ): + def delete(self): headers, data = self._requester.requestAndCheck( "DELETE", self.url, @@ -54,8 +57,8 @@ class IssueComment( GithubObject.GithubObject ): None ) - def edit( self, body ): - assert isinstance( body, ( str, unicode ) ), body + def edit(self, body): + assert isinstance(body, (str, unicode)), body post_parameters = { "body": body, } @@ -65,32 +68,32 @@ class IssueComment( GithubObject.GithubObject ): None, post_parameters ) - self._useAttributes( data ) + self._useAttributes(data) - def _initAttributes( self ): - self._body = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._id = GithubObject.NotSet - self._updated_at = GithubObject.NotSet - self._url = GithubObject.NotSet - self._user = GithubObject.NotSet + def _initAttributes(self): + self._body = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + self._user = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "body" in attributes: # pragma no branch - assert attributes[ "body" ] is None or isinstance( attributes[ "body" ], ( str, unicode ) ), attributes[ "body" ] - self._body = attributes[ "body" ] - if "created_at" in attributes: # pragma no branch - assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = self._parseDatetime( attributes[ "created_at" ] ) - if "id" in attributes: # pragma no branch - assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] - self._id = attributes[ "id" ] - if "updated_at" in attributes: # pragma no branch - assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ] - self._updated_at = self._parseDatetime( attributes[ "updated_at" ] ) - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] - if "user" in attributes: # pragma no branch - assert attributes[ "user" ] is None or isinstance( attributes[ "user" ], dict ), attributes[ "user" ] - self._user = None if attributes[ "user" ] is None else NamedUser.NamedUser( self._requester, attributes[ "user" ], completed = False ) + def _useAttributes(self, attributes): + if "body" in attributes: # pragma no branch + assert attributes["body"] is None or isinstance(attributes["body"], (str, unicode)), attributes["body"] + self._body = attributes["body"] + if "created_at" in attributes: # pragma no branch + assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"] + self._created_at = self._parseDatetime(attributes["created_at"]) + if "id" in attributes: # pragma no branch + assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] + self._id = attributes["id"] + if "updated_at" in attributes: # pragma no branch + assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], (str, unicode)), attributes["updated_at"] + self._updated_at = self._parseDatetime(attributes["updated_at"]) + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] + if "user" in attributes: # pragma no branch + assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"] + self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False) diff --git a/github/IssueEvent.py b/github/IssueEvent.py index c95b28e1..08992044 100644 --- a/github/IssueEvent.py +++ b/github/IssueEvent.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,75 +13,76 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import Issue -import NamedUser +import github.Issue +import github.NamedUser -class IssueEvent( GithubObject.GithubObject ): + +class IssueEvent(github.GithubObject.GithubObject): @property - def actor( self ): - self._completeIfNotSet( self._actor ) - return self._NoneIfNotSet( self._actor ) + def actor(self): + self._completeIfNotSet(self._actor) + return self._NoneIfNotSet(self._actor) @property - def commit_id( self ): - self._completeIfNotSet( self._commit_id ) - return self._NoneIfNotSet( self._commit_id ) + def commit_id(self): + self._completeIfNotSet(self._commit_id) + return self._NoneIfNotSet(self._commit_id) @property - def created_at( self ): - self._completeIfNotSet( self._created_at ) - return self._NoneIfNotSet( self._created_at ) + def created_at(self): + self._completeIfNotSet(self._created_at) + return self._NoneIfNotSet(self._created_at) @property - def event( self ): - self._completeIfNotSet( self._event ) - return self._NoneIfNotSet( self._event ) + def event(self): + self._completeIfNotSet(self._event) + return self._NoneIfNotSet(self._event) @property - def id( self ): - self._completeIfNotSet( self._id ) - return self._NoneIfNotSet( self._id ) + def id(self): + self._completeIfNotSet(self._id) + return self._NoneIfNotSet(self._id) @property - def issue( self ): - self._completeIfNotSet( self._issue ) - return self._NoneIfNotSet( self._issue ) + def issue(self): + self._completeIfNotSet(self._issue) + return self._NoneIfNotSet(self._issue) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) - def _initAttributes( self ): - self._actor = GithubObject.NotSet - self._commit_id = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._event = GithubObject.NotSet - self._id = GithubObject.NotSet - self._issue = GithubObject.NotSet - self._url = GithubObject.NotSet + def _initAttributes(self): + self._actor = github.GithubObject.NotSet + self._commit_id = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._event = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._issue = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "actor" in attributes: # pragma no branch - assert attributes[ "actor" ] is None or isinstance( attributes[ "actor" ], dict ), attributes[ "actor" ] - self._actor = None if attributes[ "actor" ] is None else NamedUser.NamedUser( self._requester, attributes[ "actor" ], completed = False ) - if "commit_id" in attributes: # pragma no branch - assert attributes[ "commit_id" ] is None or isinstance( attributes[ "commit_id" ], ( str, unicode ) ), attributes[ "commit_id" ] - self._commit_id = attributes[ "commit_id" ] - if "created_at" in attributes: # pragma no branch - assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = self._parseDatetime( attributes[ "created_at" ] ) - if "event" in attributes: # pragma no branch - assert attributes[ "event" ] is None or isinstance( attributes[ "event" ], ( str, unicode ) ), attributes[ "event" ] - self._event = attributes[ "event" ] - if "id" in attributes: # pragma no branch - assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] - self._id = attributes[ "id" ] - if "issue" in attributes: # pragma no branch - assert attributes[ "issue" ] is None or isinstance( attributes[ "issue" ], dict ), attributes[ "issue" ] - self._issue = None if attributes[ "issue" ] is None else Issue.Issue( self._requester, attributes[ "issue" ], completed = False ) - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] + def _useAttributes(self, attributes): + if "actor" in attributes: # pragma no branch + assert attributes["actor"] is None or isinstance(attributes["actor"], dict), attributes["actor"] + self._actor = None if attributes["actor"] is None else github.NamedUser.NamedUser(self._requester, attributes["actor"], completed=False) + if "commit_id" in attributes: # pragma no branch + assert attributes["commit_id"] is None or isinstance(attributes["commit_id"], (str, unicode)), attributes["commit_id"] + self._commit_id = attributes["commit_id"] + if "created_at" in attributes: # pragma no branch + assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"] + self._created_at = self._parseDatetime(attributes["created_at"]) + if "event" in attributes: # pragma no branch + assert attributes["event"] is None or isinstance(attributes["event"], (str, unicode)), attributes["event"] + self._event = attributes["event"] + if "id" in attributes: # pragma no branch + assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] + self._id = attributes["id"] + if "issue" in attributes: # pragma no branch + assert attributes["issue"] is None or isinstance(attributes["issue"], dict), attributes["issue"] + self._issue = None if attributes["issue"] is None else github.Issue.Issue(self._requester, attributes["issue"], completed=False) + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] diff --git a/github/IssuePullRequest.py b/github/IssuePullRequest.py index 2228e2a9..3ca15e69 100644 --- a/github/IssuePullRequest.py +++ b/github/IssuePullRequest.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,33 +13,34 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class IssuePullRequest( GithubObject.BasicGithubObject ): + +class IssuePullRequest(github.GithubObject.BasicGithubObject): @property - def diff_url( self ): - return self._NoneIfNotSet( self._diff_url ) + def diff_url(self): + return self._NoneIfNotSet(self._diff_url) @property - def html_url( self ): - return self._NoneIfNotSet( self._html_url ) + def html_url(self): + return self._NoneIfNotSet(self._html_url) @property - def patch_url( self ): - return self._NoneIfNotSet( self._patch_url ) + def patch_url(self): + return self._NoneIfNotSet(self._patch_url) - def _initAttributes( self ): - self._diff_url = GithubObject.NotSet - self._html_url = GithubObject.NotSet - self._patch_url = GithubObject.NotSet + def _initAttributes(self): + self._diff_url = github.GithubObject.NotSet + self._html_url = github.GithubObject.NotSet + self._patch_url = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "diff_url" in attributes: # pragma no branch - assert attributes[ "diff_url" ] is None or isinstance( attributes[ "diff_url" ], ( str, unicode ) ), attributes[ "diff_url" ] - self._diff_url = attributes[ "diff_url" ] - if "html_url" in attributes: # pragma no branch - assert attributes[ "html_url" ] is None or isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ] - self._html_url = attributes[ "html_url" ] - if "patch_url" in attributes: # pragma no branch - assert attributes[ "patch_url" ] is None or isinstance( attributes[ "patch_url" ], ( str, unicode ) ), attributes[ "patch_url" ] - self._patch_url = attributes[ "patch_url" ] + def _useAttributes(self, attributes): + if "diff_url" in attributes: # pragma no branch + assert attributes["diff_url"] is None or isinstance(attributes["diff_url"], (str, unicode)), attributes["diff_url"] + self._diff_url = attributes["diff_url"] + if "html_url" in attributes: # pragma no branch + assert attributes["html_url"] is None or isinstance(attributes["html_url"], (str, unicode)), attributes["html_url"] + self._html_url = attributes["html_url"] + if "patch_url" in attributes: # pragma no branch + assert attributes["patch_url"] is None or isinstance(attributes["patch_url"], (str, unicode)), attributes["patch_url"] + self._patch_url = attributes["patch_url"] diff --git a/github/Label.py b/github/Label.py index c3baf858..5e5410ee 100644 --- a/github/Label.py +++ b/github/Label.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -13,25 +15,26 @@ import urllib -import GithubObject +import github.GithubObject -class Label( GithubObject.GithubObject ): + +class Label(github.GithubObject.GithubObject): @property - def color( self ): - self._completeIfNotSet( self._color ) - return self._NoneIfNotSet( self._color ) + def color(self): + self._completeIfNotSet(self._color) + return self._NoneIfNotSet(self._color) @property - def name( self ): - self._completeIfNotSet( self._name ) - return self._NoneIfNotSet( self._name ) + def name(self): + self._completeIfNotSet(self._name) + return self._NoneIfNotSet(self._name) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) - def delete( self ): + def delete(self): headers, data = self._requester.requestAndCheck( "DELETE", self.url, @@ -39,9 +42,9 @@ class Label( GithubObject.GithubObject ): None ) - def edit( self, name, color ): - assert isinstance( name, ( str, unicode ) ), name - assert isinstance( color, ( str, unicode ) ), color + def edit(self, name, color): + assert isinstance(name, (str, unicode)), name + assert isinstance(color, (str, unicode)), color post_parameters = { "name": name, "color": color, @@ -52,24 +55,24 @@ class Label( GithubObject.GithubObject ): None, post_parameters ) - self._useAttributes( data ) + self._useAttributes(data) @property - def _identity( self ): - return urllib.quote( self.name ) + def _identity(self): + return urllib.quote(self.name) - def _initAttributes( self ): - self._color = GithubObject.NotSet - self._name = GithubObject.NotSet - self._url = GithubObject.NotSet + def _initAttributes(self): + self._color = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "color" in attributes: # pragma no branch - assert attributes[ "color" ] is None or isinstance( attributes[ "color" ], ( str, unicode ) ), attributes[ "color" ] - self._color = attributes[ "color" ] - if "name" in attributes: # pragma no branch - assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ] - self._name = attributes[ "name" ] - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] + def _useAttributes(self, attributes): + if "color" in attributes: # pragma no branch + assert attributes["color"] is None or isinstance(attributes["color"], (str, unicode)), attributes["color"] + self._color = attributes["color"] + if "name" in attributes: # pragma no branch + assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] + self._name = attributes["name"] + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] diff --git a/github/Legacy.py b/github/Legacy.py index c266c3d2..f9567610 100644 --- a/github/Legacy.py +++ b/github/Legacy.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -13,11 +15,12 @@ import urlparse -from PaginatedList import PaginatedListBase +import github.PaginatedList -class PaginatedList( PaginatedListBase ): - def __init__( self, url, args, requester, key, convert, contentClass ): - PaginatedListBase.__init__( self ) + +class PaginatedList(github.PaginatedList.PaginatedListBase): + def __init__(self, url, args, requester, key, convert, contentClass): + github.PaginatedList.PaginatedListBase.__init__(self) self.__url = url self.__args = args self.__requester = requester @@ -27,77 +30,108 @@ class PaginatedList( PaginatedListBase ): self.__nextPage = 0 self.__continue = True - def _couldGrow( self ): + def _couldGrow(self): return self.__continue - def _fetchNextPage( self ): + def _fetchNextPage(self): page = self.__nextPage self.__nextPage += 1 - return self.get_page( page ) + return self.get_page(page) - def get_page( self, page ): - assert isinstance( page, int ), page - args = dict( self.__args ) + def get_page(self, page): + assert isinstance(page, (int, long)), page + args = dict(self.__args) if page != 0: - args[ "start_page" ] = page + 1 + args["start_page"] = page + 1 headers, data = self.__requester.requestAndCheck( "GET", self.__url, args, None ) - self.__continue = len( data[ self.__key ] ) > 0 + self.__continue = len(data[self.__key]) > 0 return [ - self.__contentClass( self.__requester, self.__convert( element ), completed = False ) - for element in data[ self.__key ] + self.__contentClass(self.__requester, self.__convert(element), completed=False) + for element in data[self.__key] ] -def convertUser( attributes ): + +def convertUser(attributes): convertedAttributes = { - "login": attributes[ "login" ], - "url": "/users/" + attributes[ "login" ], + "login": attributes["login"], + "url": "/users/" + attributes["login"], } - if "gravatar_id" in attributes: convertedAttributes[ "gravatar_id" ] = attributes[ "gravatar_id" ] - if "followers" in attributes: convertedAttributes[ "followers" ] = attributes[ "followers" ] - if "repos" in attributes: convertedAttributes[ "public_repos" ] = attributes[ "repos" ] - if "name" in attributes: convertedAttributes[ "name" ] = attributes[ "name" ] - if "created_at" in attributes: convertedAttributes[ "created_at" ] = attributes[ "created_at" ] - if "location" in attributes: convertedAttributes[ "location" ] = attributes[ "location" ] + if "gravatar_id" in attributes: # pragma no branch + convertedAttributes["gravatar_id"] = attributes["gravatar_id"] + if "followers" in attributes: # pragma no branch + convertedAttributes["followers"] = attributes["followers"] + if "repos" in attributes: # pragma no branch + convertedAttributes["public_repos"] = attributes["repos"] + if "name" in attributes: # pragma no branch + convertedAttributes["name"] = attributes["name"] + if "created_at" in attributes: # pragma no branch + convertedAttributes["created_at"] = attributes["created_at"] + if "location" in attributes: # pragma no branch + convertedAttributes["location"] = attributes["location"] return convertedAttributes -def convertRepo( attributes ): + +def convertRepo(attributes): convertedAttributes = { - "owner": { "login": attributes[ "owner" ], "url": "/users/" + attributes[ "owner" ] }, - "url": "/repos/" + attributes[ "owner" ] + "/" + attributes[ "name" ], + "owner": {"login": attributes["owner"], "url": "/users/" + attributes["owner"]}, + "url": "/repos/" + attributes["owner"] + "/" + attributes["name"], } - if "pushed_at" in attributes: convertedAttributes[ "pushed_at" ] = attributes[ "pushed_at" ] - if "homepage" in attributes: convertedAttributes[ "homepage" ] = attributes[ "homepage" ] - if "created_at" in attributes: convertedAttributes[ "created_at" ] = attributes[ "created_at" ] - if "watchers" in attributes: convertedAttributes[ "watchers" ] = attributes[ "watchers" ] - if "has_downloads" in attributes: convertedAttributes[ "has_downloads" ] = attributes[ "has_downloads" ] - if "fork" in attributes: convertedAttributes[ "fork" ] = attributes[ "fork" ] - if "has_issues" in attributes: convertedAttributes[ "has_issues" ] = attributes[ "has_issues" ] - if "has_wiki" in attributes: convertedAttributes[ "has_wiki" ] = attributes[ "has_wiki" ] - if "forks" in attributes: convertedAttributes[ "forks" ] = attributes[ "forks" ] - if "size" in attributes: convertedAttributes[ "size" ] = attributes[ "size" ] - if "private" in attributes: convertedAttributes[ "private" ] = attributes[ "private" ] - if "open_issues" in attributes: convertedAttributes[ "open_issues" ] = attributes[ "open_issues" ] - if "description" in attributes: convertedAttributes[ "description" ] = attributes[ "description" ] - if "language" in attributes: convertedAttributes[ "language" ] = attributes[ "language" ] - if "name" in attributes: convertedAttributes[ "name" ] = attributes[ "name" ] + if "pushed_at" in attributes: # pragma no branch + convertedAttributes["pushed_at"] = attributes["pushed_at"] + if "homepage" in attributes: # pragma no branch + convertedAttributes["homepage"] = attributes["homepage"] + if "created_at" in attributes: # pragma no branch + convertedAttributes["created_at"] = attributes["created_at"] + if "watchers" in attributes: # pragma no branch + convertedAttributes["watchers"] = attributes["watchers"] + if "has_downloads" in attributes: # pragma no branch + convertedAttributes["has_downloads"] = attributes["has_downloads"] + if "fork" in attributes: # pragma no branch + convertedAttributes["fork"] = attributes["fork"] + if "has_issues" in attributes: # pragma no branch + convertedAttributes["has_issues"] = attributes["has_issues"] + if "has_wiki" in attributes: # pragma no branch + convertedAttributes["has_wiki"] = attributes["has_wiki"] + if "forks" in attributes: # pragma no branch + convertedAttributes["forks"] = attributes["forks"] + if "size" in attributes: # pragma no branch + convertedAttributes["size"] = attributes["size"] + if "private" in attributes: # pragma no branch + convertedAttributes["private"] = attributes["private"] + if "open_issues" in attributes: # pragma no branch + convertedAttributes["open_issues"] = attributes["open_issues"] + if "description" in attributes: # pragma no branch + convertedAttributes["description"] = attributes["description"] + if "language" in attributes: # pragma no branch + convertedAttributes["language"] = attributes["language"] + if "name" in attributes: # pragma no branch + convertedAttributes["name"] = attributes["name"] return convertedAttributes -def convertIssue( attributes ): + +def convertIssue(attributes): convertedAttributes = { - "number": attributes[ "number" ], - "url": "/repos" + urlparse.urlparse( attributes[ "html_url" ] ).path, - "user": { "login": attributes[ "user" ], "url": "/users/" + attributes[ "user" ] }, + "number": attributes["number"], + "url": "/repos" + urlparse.urlparse(attributes["html_url"]).path, + "user": {"login": attributes["user"], "url": "/users/" + attributes["user"]}, } - if "labels" in attributes: convertedAttributes[ "labels" ] = [ { "name": label } for label in attributes[ "labels" ] ] - if "title" in attributes: convertedAttributes[ "title" ] = attributes[ "title" ] - if "created_at" in attributes: convertedAttributes[ "created_at" ] = attributes[ "created_at" ] - if "comments" in attributes: convertedAttributes[ "comments" ] = attributes[ "comments" ] - if "body" in attributes: convertedAttributes[ "body" ] = attributes[ "body" ] - if "updated_at" in attributes: convertedAttributes[ "updated_at" ] = attributes[ "updated_at" ] - if "state" in attributes: convertedAttributes[ "state" ] = attributes[ "state" ] + if "labels" in attributes: # pragma no branch + convertedAttributes["labels"] = [{"name": label} for label in attributes["labels"]] + if "title" in attributes: # pragma no branch + convertedAttributes["title"] = attributes["title"] + if "created_at" in attributes: # pragma no branch + convertedAttributes["created_at"] = attributes["created_at"] + if "comments" in attributes: # pragma no branch + convertedAttributes["comments"] = attributes["comments"] + if "body" in attributes: # pragma no branch + convertedAttributes["body"] = attributes["body"] + if "updated_at" in attributes: # pragma no branch + convertedAttributes["updated_at"] = attributes["updated_at"] + if "state" in attributes: # pragma no branch + convertedAttributes["state"] = attributes["state"] return convertedAttributes diff --git a/github/Milestone.py b/github/Milestone.py index 47afe173..e646a225 100644 --- a/github/Milestone.py +++ b/github/Milestone.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -13,69 +15,70 @@ import datetime -import GithubObject -import PaginatedList +import github.GithubObject +import github.PaginatedList -import NamedUser -import Label +import github.NamedUser +import github.Label -class Milestone( GithubObject.GithubObject ): + +class Milestone(github.GithubObject.GithubObject): @property - def closed_issues( self ): - self._completeIfNotSet( self._closed_issues ) - return self._NoneIfNotSet( self._closed_issues ) + def closed_issues(self): + self._completeIfNotSet(self._closed_issues) + return self._NoneIfNotSet(self._closed_issues) @property - def created_at( self ): - self._completeIfNotSet( self._created_at ) - return self._NoneIfNotSet( self._created_at ) + def created_at(self): + self._completeIfNotSet(self._created_at) + return self._NoneIfNotSet(self._created_at) @property - def creator( self ): - self._completeIfNotSet( self._creator ) - return self._NoneIfNotSet( self._creator ) + def creator(self): + self._completeIfNotSet(self._creator) + return self._NoneIfNotSet(self._creator) @property - def description( self ): - self._completeIfNotSet( self._description ) - return self._NoneIfNotSet( self._description ) + def description(self): + self._completeIfNotSet(self._description) + return self._NoneIfNotSet(self._description) @property - def due_on( self ): - self._completeIfNotSet( self._due_on ) - return self._NoneIfNotSet( self._due_on ) + def due_on(self): + self._completeIfNotSet(self._due_on) + return self._NoneIfNotSet(self._due_on) @property - def id( self ): - self._completeIfNotSet( self._id ) - return self._NoneIfNotSet( self._id ) + def id(self): + self._completeIfNotSet(self._id) + return self._NoneIfNotSet(self._id) @property - def number( self ): - self._completeIfNotSet( self._number ) - return self._NoneIfNotSet( self._number ) + def number(self): + self._completeIfNotSet(self._number) + return self._NoneIfNotSet(self._number) @property - def open_issues( self ): - self._completeIfNotSet( self._open_issues ) - return self._NoneIfNotSet( self._open_issues ) + def open_issues(self): + self._completeIfNotSet(self._open_issues) + return self._NoneIfNotSet(self._open_issues) @property - def state( self ): - self._completeIfNotSet( self._state ) - return self._NoneIfNotSet( self._state ) + def state(self): + self._completeIfNotSet(self._state) + return self._NoneIfNotSet(self._state) @property - def title( self ): - self._completeIfNotSet( self._title ) - return self._NoneIfNotSet( self._title ) + def title(self): + self._completeIfNotSet(self._title) + return self._NoneIfNotSet(self._title) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) - def delete( self ): + def delete(self): headers, data = self._requester.requestAndCheck( "DELETE", self.url, @@ -83,84 +86,84 @@ class Milestone( GithubObject.GithubObject ): None ) - def edit( self, title, state = GithubObject.NotSet, description = GithubObject.NotSet, due_on = GithubObject.NotSet ): - assert isinstance( title, ( str, unicode ) ), title - assert state is GithubObject.NotSet or isinstance( state, ( str, unicode ) ), state - assert description is GithubObject.NotSet or isinstance( description, ( str, unicode ) ), description - assert due_on is GithubObject.NotSet or isinstance( due_on, datetime.date ), due_on + def edit(self, title, state=github.GithubObject.NotSet, description=github.GithubObject.NotSet, due_on=github.GithubObject.NotSet): + assert isinstance(title, (str, unicode)), title + assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state + assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description + assert due_on is github.GithubObject.NotSet or isinstance(due_on, datetime.date), due_on post_parameters = { "title": title, } - if state is not GithubObject.NotSet: - post_parameters[ "state" ] = state - if description is not GithubObject.NotSet: - post_parameters[ "description" ] = description - if due_on is not GithubObject.NotSet: - post_parameters[ "due_on" ] = due_on.strftime( "%Y-%m-%d" ) + if state is not github.GithubObject.NotSet: + post_parameters["state"] = state + if description is not github.GithubObject.NotSet: + post_parameters["description"] = description + if due_on is not github.GithubObject.NotSet: + post_parameters["due_on"] = due_on.strftime("%Y-%m-%d") headers, data = self._requester.requestAndCheck( "PATCH", self.url, None, post_parameters ) - self._useAttributes( data ) + self._useAttributes(data) - def get_labels( self ): - return PaginatedList.PaginatedList( - Label.Label, + def get_labels(self): + return github.PaginatedList.PaginatedList( + github.Label.Label, self._requester, self.url + "/labels", None ) @property - def _identity( self ): + def _identity(self): return self.number - def _initAttributes( self ): - self._closed_issues = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._creator = GithubObject.NotSet - self._description = GithubObject.NotSet - self._due_on = GithubObject.NotSet - self._id = GithubObject.NotSet - self._number = GithubObject.NotSet - self._open_issues = GithubObject.NotSet - self._state = GithubObject.NotSet - self._title = GithubObject.NotSet - self._url = GithubObject.NotSet + def _initAttributes(self): + self._closed_issues = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._creator = github.GithubObject.NotSet + self._description = github.GithubObject.NotSet + self._due_on = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._number = github.GithubObject.NotSet + self._open_issues = github.GithubObject.NotSet + self._state = github.GithubObject.NotSet + self._title = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "closed_issues" in attributes: # pragma no branch - assert attributes[ "closed_issues" ] is None or isinstance( attributes[ "closed_issues" ], int ), attributes[ "closed_issues" ] - self._closed_issues = attributes[ "closed_issues" ] - if "created_at" in attributes: # pragma no branch - assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = self._parseDatetime( attributes[ "created_at" ] ) - if "creator" in attributes: # pragma no branch - assert attributes[ "creator" ] is None or isinstance( attributes[ "creator" ], dict ), attributes[ "creator" ] - self._creator = None if attributes[ "creator" ] is None else NamedUser.NamedUser( self._requester, attributes[ "creator" ], completed = False ) - if "description" in attributes: # pragma no branch - assert attributes[ "description" ] is None or isinstance( attributes[ "description" ], ( str, unicode ) ), attributes[ "description" ] - self._description = attributes[ "description" ] - if "due_on" in attributes: # pragma no branch - assert attributes[ "due_on" ] is None or isinstance( attributes[ "due_on" ], ( str, unicode ) ), attributes[ "due_on" ] - self._due_on = self._parseDatetime( attributes[ "due_on" ] ) - if "id" in attributes: # pragma no branch - assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] - self._id = attributes[ "id" ] - if "number" in attributes: # pragma no branch - assert attributes[ "number" ] is None or isinstance( attributes[ "number" ], int ), attributes[ "number" ] - self._number = attributes[ "number" ] - if "open_issues" in attributes: # pragma no branch - assert attributes[ "open_issues" ] is None or isinstance( attributes[ "open_issues" ], int ), attributes[ "open_issues" ] - self._open_issues = attributes[ "open_issues" ] - if "state" in attributes: # pragma no branch - assert attributes[ "state" ] is None or isinstance( attributes[ "state" ], ( str, unicode ) ), attributes[ "state" ] - self._state = attributes[ "state" ] - if "title" in attributes: # pragma no branch - assert attributes[ "title" ] is None or isinstance( attributes[ "title" ], ( str, unicode ) ), attributes[ "title" ] - self._title = attributes[ "title" ] - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] + def _useAttributes(self, attributes): + if "closed_issues" in attributes: # pragma no branch + assert attributes["closed_issues"] is None or isinstance(attributes["closed_issues"], (int, long)), attributes["closed_issues"] + self._closed_issues = attributes["closed_issues"] + if "created_at" in attributes: # pragma no branch + assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"] + self._created_at = self._parseDatetime(attributes["created_at"]) + if "creator" in attributes: # pragma no branch + assert attributes["creator"] is None or isinstance(attributes["creator"], dict), attributes["creator"] + self._creator = None if attributes["creator"] is None else github.NamedUser.NamedUser(self._requester, attributes["creator"], completed=False) + if "description" in attributes: # pragma no branch + assert attributes["description"] is None or isinstance(attributes["description"], (str, unicode)), attributes["description"] + self._description = attributes["description"] + if "due_on" in attributes: # pragma no branch + assert attributes["due_on"] is None or isinstance(attributes["due_on"], (str, unicode)), attributes["due_on"] + self._due_on = self._parseDatetime(attributes["due_on"]) + if "id" in attributes: # pragma no branch + assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] + self._id = attributes["id"] + if "number" in attributes: # pragma no branch + assert attributes["number"] is None or isinstance(attributes["number"], (int, long)), attributes["number"] + self._number = attributes["number"] + if "open_issues" in attributes: # pragma no branch + assert attributes["open_issues"] is None or isinstance(attributes["open_issues"], (int, long)), attributes["open_issues"] + self._open_issues = attributes["open_issues"] + if "state" in attributes: # pragma no branch + assert attributes["state"] is None or isinstance(attributes["state"], (str, unicode)), attributes["state"] + self._state = attributes["state"] + if "title" in attributes: # pragma no branch + assert attributes["title"] is None or isinstance(attributes["title"], (str, unicode)), attributes["title"] + self._title = attributes["title"] + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] diff --git a/github/NamedUser.py b/github/NamedUser.py index 03a66e4b..15df5907 100644 --- a/github/NamedUser.py +++ b/github/NamedUser.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,384 +13,384 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject -import PaginatedList +import github.GithubObject +import github.PaginatedList -import Gist -import Repository -import NamedUser -import Plan -import Organization -import InputFileContent -import Event +import github.Gist +import github.Repository +import github.NamedUser +import github.Plan +import github.Organization +import github.Event -class NamedUser( GithubObject.GithubObject ): + +class NamedUser(github.GithubObject.GithubObject): @property - def avatar_url( self ): - self._completeIfNotSet( self._avatar_url ) - return self._NoneIfNotSet( self._avatar_url ) + def avatar_url(self): + self._completeIfNotSet(self._avatar_url) + return self._NoneIfNotSet(self._avatar_url) @property - def bio( self ): - self._completeIfNotSet( self._bio ) - return self._NoneIfNotSet( self._bio ) + def bio(self): + self._completeIfNotSet(self._bio) + return self._NoneIfNotSet(self._bio) @property - def blog( self ): - self._completeIfNotSet( self._blog ) - return self._NoneIfNotSet( self._blog ) + def blog(self): + self._completeIfNotSet(self._blog) + return self._NoneIfNotSet(self._blog) @property - def collaborators( self ): - self._completeIfNotSet( self._collaborators ) - return self._NoneIfNotSet( self._collaborators ) + def collaborators(self): + self._completeIfNotSet(self._collaborators) + return self._NoneIfNotSet(self._collaborators) @property - def company( self ): - self._completeIfNotSet( self._company ) - return self._NoneIfNotSet( self._company ) + def company(self): + self._completeIfNotSet(self._company) + return self._NoneIfNotSet(self._company) @property - def contributions( self ): - self._completeIfNotSet( self._contributions ) - return self._NoneIfNotSet( self._contributions ) + def contributions(self): + self._completeIfNotSet(self._contributions) + return self._NoneIfNotSet(self._contributions) @property - def created_at( self ): - self._completeIfNotSet( self._created_at ) - return self._NoneIfNotSet( self._created_at ) + def created_at(self): + self._completeIfNotSet(self._created_at) + return self._NoneIfNotSet(self._created_at) @property - def disk_usage( self ): - self._completeIfNotSet( self._disk_usage ) - return self._NoneIfNotSet( self._disk_usage ) + def disk_usage(self): + self._completeIfNotSet(self._disk_usage) + return self._NoneIfNotSet(self._disk_usage) @property - def email( self ): - self._completeIfNotSet( self._email ) - return self._NoneIfNotSet( self._email ) + def email(self): + self._completeIfNotSet(self._email) + return self._NoneIfNotSet(self._email) @property - def followers( self ): - self._completeIfNotSet( self._followers ) - return self._NoneIfNotSet( self._followers ) + def followers(self): + self._completeIfNotSet(self._followers) + return self._NoneIfNotSet(self._followers) @property - def following( self ): - self._completeIfNotSet( self._following ) - return self._NoneIfNotSet( self._following ) + def following(self): + self._completeIfNotSet(self._following) + return self._NoneIfNotSet(self._following) @property - def gravatar_id( self ): - self._completeIfNotSet( self._gravatar_id ) - return self._NoneIfNotSet( self._gravatar_id ) + def gravatar_id(self): + self._completeIfNotSet(self._gravatar_id) + return self._NoneIfNotSet(self._gravatar_id) @property - def hireable( self ): - self._completeIfNotSet( self._hireable ) - return self._NoneIfNotSet( self._hireable ) + def hireable(self): + self._completeIfNotSet(self._hireable) + return self._NoneIfNotSet(self._hireable) @property - def html_url( self ): - self._completeIfNotSet( self._html_url ) - return self._NoneIfNotSet( self._html_url ) + def html_url(self): + self._completeIfNotSet(self._html_url) + return self._NoneIfNotSet(self._html_url) @property - def id( self ): - self._completeIfNotSet( self._id ) - return self._NoneIfNotSet( self._id ) + def id(self): + self._completeIfNotSet(self._id) + return self._NoneIfNotSet(self._id) @property - def location( self ): - self._completeIfNotSet( self._location ) - return self._NoneIfNotSet( self._location ) + def location(self): + self._completeIfNotSet(self._location) + return self._NoneIfNotSet(self._location) @property - def login( self ): - self._completeIfNotSet( self._login ) - return self._NoneIfNotSet( self._login ) + def login(self): + self._completeIfNotSet(self._login) + return self._NoneIfNotSet(self._login) @property - def name( self ): - self._completeIfNotSet( self._name ) - return self._NoneIfNotSet( self._name ) + def name(self): + self._completeIfNotSet(self._name) + return self._NoneIfNotSet(self._name) @property - def owned_private_repos( self ): - self._completeIfNotSet( self._owned_private_repos ) - return self._NoneIfNotSet( self._owned_private_repos ) + def owned_private_repos(self): + self._completeIfNotSet(self._owned_private_repos) + return self._NoneIfNotSet(self._owned_private_repos) @property - def plan( self ): - self._completeIfNotSet( self._plan ) - return self._NoneIfNotSet( self._plan ) + def plan(self): + self._completeIfNotSet(self._plan) + return self._NoneIfNotSet(self._plan) @property - def private_gists( self ): - self._completeIfNotSet( self._private_gists ) - return self._NoneIfNotSet( self._private_gists ) + def private_gists(self): + self._completeIfNotSet(self._private_gists) + return self._NoneIfNotSet(self._private_gists) @property - def public_gists( self ): - self._completeIfNotSet( self._public_gists ) - return self._NoneIfNotSet( self._public_gists ) + def public_gists(self): + self._completeIfNotSet(self._public_gists) + return self._NoneIfNotSet(self._public_gists) @property - def public_repos( self ): - self._completeIfNotSet( self._public_repos ) - return self._NoneIfNotSet( self._public_repos ) + def public_repos(self): + self._completeIfNotSet(self._public_repos) + return self._NoneIfNotSet(self._public_repos) @property - def total_private_repos( self ): - self._completeIfNotSet( self._total_private_repos ) - return self._NoneIfNotSet( self._total_private_repos ) + def total_private_repos(self): + self._completeIfNotSet(self._total_private_repos) + return self._NoneIfNotSet(self._total_private_repos) @property - def type( self ): - self._completeIfNotSet( self._type ) - return self._NoneIfNotSet( self._type ) + def type(self): + self._completeIfNotSet(self._type) + return self._NoneIfNotSet(self._type) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) - def create_gist( self, public, files, description = GithubObject.NotSet ): - assert isinstance( public, bool ), public - assert all( isinstance( element, InputFileContent.InputFileContent ) for element in files.itervalues() ), files - assert description is GithubObject.NotSet or isinstance( description, ( str, unicode ) ), description + def create_gist(self, public, files, description=github.GithubObject.NotSet): + assert isinstance(public, bool), public + assert all(isinstance(element, github.InputFileContent) for element in files.itervalues()), files + assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description post_parameters = { "public": public, - "files": dict( ( key, value._identity ) for key, value in files.iteritems() ), + "files": dict((key, value._identity) for key, value in files.iteritems()), } - if description is not GithubObject.NotSet: - post_parameters[ "description" ] = description + if description is not github.GithubObject.NotSet: + post_parameters["description"] = description headers, data = self._requester.requestAndCheck( "POST", self.url + "/gists", None, post_parameters ) - return Gist.Gist( self._requester, data, completed = True ) + return github.Gist.Gist(self._requester, data, completed=True) - def get_events( self ): - return PaginatedList.PaginatedList( - Event.Event, + def get_events(self): + return github.PaginatedList.PaginatedList( + github.Event.Event, self._requester, self.url + "/events", None ) - def get_followers( self ): - return PaginatedList.PaginatedList( + def get_followers(self): + return github.PaginatedList.PaginatedList( NamedUser, self._requester, self.url + "/followers", None ) - def get_following( self ): - return PaginatedList.PaginatedList( + def get_following(self): + return github.PaginatedList.PaginatedList( NamedUser, self._requester, self.url + "/following", None ) - def get_gists( self ): - return PaginatedList.PaginatedList( - Gist.Gist, + def get_gists(self): + return github.PaginatedList.PaginatedList( + github.Gist.Gist, self._requester, self.url + "/gists", None ) - def get_orgs( self ): - return PaginatedList.PaginatedList( - Organization.Organization, + def get_orgs(self): + return github.PaginatedList.PaginatedList( + github.Organization.Organization, self._requester, self.url + "/orgs", None ) - def get_public_events( self ): - return PaginatedList.PaginatedList( - Event.Event, + def get_public_events(self): + return github.PaginatedList.PaginatedList( + github.Event.Event, self._requester, self.url + "/events/public", None ) - def get_public_received_events( self ): - return PaginatedList.PaginatedList( - Event.Event, + def get_public_received_events(self): + return github.PaginatedList.PaginatedList( + github.Event.Event, self._requester, self.url + "/received_events/public", None ) - def get_received_events( self ): - return PaginatedList.PaginatedList( - Event.Event, + def get_received_events(self): + return github.PaginatedList.PaginatedList( + github.Event.Event, self._requester, self.url + "/received_events", None ) - def get_repo( self, name ): - assert isinstance( name, ( str, unicode ) ), name + def get_repo(self, name): + assert isinstance(name, (str, unicode)), name headers, data = self._requester.requestAndCheck( "GET", "/repos/" + self.login + "/" + name, None, None ) - return Repository.Repository( self._requester, data, completed = True ) + return github.Repository.Repository(self._requester, data, completed=True) - def get_repos( self, type = GithubObject.NotSet ): - assert type is GithubObject.NotSet or isinstance( type, ( str, unicode ) ), type + def get_repos(self, type=github.GithubObject.NotSet): + assert type is github.GithubObject.NotSet or isinstance(type, (str, unicode)), type url_parameters = dict() - if type is not GithubObject.NotSet: - url_parameters[ "type" ] = type - return PaginatedList.PaginatedList( - Repository.Repository, + if type is not github.GithubObject.NotSet: + url_parameters["type"] = type + return github.PaginatedList.PaginatedList( + github.Repository.Repository, self._requester, self.url + "/repos", url_parameters ) - def get_starred( self ): - return PaginatedList.PaginatedList( - Repository.Repository, + def get_starred(self): + return github.PaginatedList.PaginatedList( + github.Repository.Repository, self._requester, self.url + "/starred", None ) - def get_subscriptions( self ): - return PaginatedList.PaginatedList( - Repository.Repository, + def get_subscriptions(self): + return github.PaginatedList.PaginatedList( + github.Repository.Repository, self._requester, self.url + "/subscriptions", None ) - def get_watched( self ): - return PaginatedList.PaginatedList( - Repository.Repository, + def get_watched(self): + return github.PaginatedList.PaginatedList( + github.Repository.Repository, self._requester, self.url + "/watched", None ) @property - def _identity( self ): + def _identity(self): return self.login - def _initAttributes( self ): - self._avatar_url = GithubObject.NotSet - self._bio = GithubObject.NotSet - self._blog = GithubObject.NotSet - self._collaborators = GithubObject.NotSet - self._company = GithubObject.NotSet - self._contributions = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._disk_usage = GithubObject.NotSet - self._email = GithubObject.NotSet - self._followers = GithubObject.NotSet - self._following = GithubObject.NotSet - self._gravatar_id = GithubObject.NotSet - self._hireable = GithubObject.NotSet - self._html_url = GithubObject.NotSet - self._id = GithubObject.NotSet - self._location = GithubObject.NotSet - self._login = GithubObject.NotSet - self._name = GithubObject.NotSet - self._owned_private_repos = GithubObject.NotSet - self._plan = GithubObject.NotSet - self._private_gists = GithubObject.NotSet - self._public_gists = GithubObject.NotSet - self._public_repos = GithubObject.NotSet - self._total_private_repos = GithubObject.NotSet - self._type = GithubObject.NotSet - self._url = GithubObject.NotSet + def _initAttributes(self): + self._avatar_url = github.GithubObject.NotSet + self._bio = github.GithubObject.NotSet + self._blog = github.GithubObject.NotSet + self._collaborators = github.GithubObject.NotSet + self._company = github.GithubObject.NotSet + self._contributions = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._disk_usage = github.GithubObject.NotSet + self._email = github.GithubObject.NotSet + self._followers = github.GithubObject.NotSet + self._following = github.GithubObject.NotSet + self._gravatar_id = github.GithubObject.NotSet + self._hireable = github.GithubObject.NotSet + self._html_url = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._location = github.GithubObject.NotSet + self._login = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._owned_private_repos = github.GithubObject.NotSet + self._plan = github.GithubObject.NotSet + self._private_gists = github.GithubObject.NotSet + self._public_gists = github.GithubObject.NotSet + self._public_repos = github.GithubObject.NotSet + self._total_private_repos = github.GithubObject.NotSet + self._type = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "avatar_url" in attributes: # pragma no branch - assert attributes[ "avatar_url" ] is None or isinstance( attributes[ "avatar_url" ], ( str, unicode ) ), attributes[ "avatar_url" ] - self._avatar_url = attributes[ "avatar_url" ] - if "bio" in attributes: # pragma no branch - assert attributes[ "bio" ] is None or isinstance( attributes[ "bio" ], ( str, unicode ) ), attributes[ "bio" ] - self._bio = attributes[ "bio" ] - if "blog" in attributes: # pragma no branch - assert attributes[ "blog" ] is None or isinstance( attributes[ "blog" ], ( str, unicode ) ), attributes[ "blog" ] - self._blog = attributes[ "blog" ] - if "collaborators" in attributes: # pragma no branch - assert attributes[ "collaborators" ] is None or isinstance( attributes[ "collaborators" ], int ), attributes[ "collaborators" ] - self._collaborators = attributes[ "collaborators" ] - if "company" in attributes: # pragma no branch - assert attributes[ "company" ] is None or isinstance( attributes[ "company" ], ( str, unicode ) ), attributes[ "company" ] - self._company = attributes[ "company" ] - if "contributions" in attributes: # pragma no branch - assert attributes[ "contributions" ] is None or isinstance( attributes[ "contributions" ], int ), attributes[ "contributions" ] - self._contributions = attributes[ "contributions" ] - if "created_at" in attributes: # pragma no branch - assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = self._parseDatetime( attributes[ "created_at" ] ) - if "disk_usage" in attributes: # pragma no branch - assert attributes[ "disk_usage" ] is None or isinstance( attributes[ "disk_usage" ], int ), attributes[ "disk_usage" ] - self._disk_usage = attributes[ "disk_usage" ] - if "email" in attributes: # pragma no branch - assert attributes[ "email" ] is None or isinstance( attributes[ "email" ], ( str, unicode ) ), attributes[ "email" ] - self._email = attributes[ "email" ] - if "followers" in attributes: # pragma no branch - assert attributes[ "followers" ] is None or isinstance( attributes[ "followers" ], int ), attributes[ "followers" ] - self._followers = attributes[ "followers" ] - if "following" in attributes: # pragma no branch - assert attributes[ "following" ] is None or isinstance( attributes[ "following" ], int ), attributes[ "following" ] - self._following = attributes[ "following" ] - if "gravatar_id" in attributes: # pragma no branch - assert attributes[ "gravatar_id" ] is None or isinstance( attributes[ "gravatar_id" ], ( str, unicode ) ), attributes[ "gravatar_id" ] - self._gravatar_id = attributes[ "gravatar_id" ] - if "hireable" in attributes: # pragma no branch - assert attributes[ "hireable" ] is None or isinstance( attributes[ "hireable" ], bool ), attributes[ "hireable" ] - self._hireable = attributes[ "hireable" ] - if "html_url" in attributes: # pragma no branch - assert attributes[ "html_url" ] is None or isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ] - self._html_url = attributes[ "html_url" ] - if "id" in attributes: # pragma no branch - assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] - self._id = attributes[ "id" ] - if "location" in attributes: # pragma no branch - assert attributes[ "location" ] is None or isinstance( attributes[ "location" ], ( str, unicode ) ), attributes[ "location" ] - self._location = attributes[ "location" ] - if "login" in attributes: # pragma no branch - assert attributes[ "login" ] is None or isinstance( attributes[ "login" ], ( str, unicode ) ), attributes[ "login" ] - self._login = attributes[ "login" ] - if "name" in attributes: # pragma no branch - assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ] - self._name = attributes[ "name" ] - if "owned_private_repos" in attributes: # pragma no branch - assert attributes[ "owned_private_repos" ] is None or isinstance( attributes[ "owned_private_repos" ], int ), attributes[ "owned_private_repos" ] - self._owned_private_repos = attributes[ "owned_private_repos" ] - if "plan" in attributes: # pragma no branch - assert attributes[ "plan" ] is None or isinstance( attributes[ "plan" ], dict ), attributes[ "plan" ] - self._plan = None if attributes[ "plan" ] is None else Plan.Plan( self._requester, attributes[ "plan" ], completed = False ) - if "private_gists" in attributes: # pragma no branch - assert attributes[ "private_gists" ] is None or isinstance( attributes[ "private_gists" ], int ), attributes[ "private_gists" ] - self._private_gists = attributes[ "private_gists" ] - if "public_gists" in attributes: # pragma no branch - assert attributes[ "public_gists" ] is None or isinstance( attributes[ "public_gists" ], int ), attributes[ "public_gists" ] - self._public_gists = attributes[ "public_gists" ] - if "public_repos" in attributes: # pragma no branch - assert attributes[ "public_repos" ] is None or isinstance( attributes[ "public_repos" ], int ), attributes[ "public_repos" ] - self._public_repos = attributes[ "public_repos" ] - if "total_private_repos" in attributes: # pragma no branch - assert attributes[ "total_private_repos" ] is None or isinstance( attributes[ "total_private_repos" ], int ), attributes[ "total_private_repos" ] - self._total_private_repos = attributes[ "total_private_repos" ] - if "type" in attributes: # pragma no branch - assert attributes[ "type" ] is None or isinstance( attributes[ "type" ], ( str, unicode ) ), attributes[ "type" ] - self._type = attributes[ "type" ] - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] + def _useAttributes(self, attributes): + if "avatar_url" in attributes: # pragma no branch + assert attributes["avatar_url"] is None or isinstance(attributes["avatar_url"], (str, unicode)), attributes["avatar_url"] + self._avatar_url = attributes["avatar_url"] + if "bio" in attributes: # pragma no branch + assert attributes["bio"] is None or isinstance(attributes["bio"], (str, unicode)), attributes["bio"] + self._bio = attributes["bio"] + if "blog" in attributes: # pragma no branch + assert attributes["blog"] is None or isinstance(attributes["blog"], (str, unicode)), attributes["blog"] + self._blog = attributes["blog"] + if "collaborators" in attributes: # pragma no branch + assert attributes["collaborators"] is None or isinstance(attributes["collaborators"], (int, long)), attributes["collaborators"] + self._collaborators = attributes["collaborators"] + if "company" in attributes: # pragma no branch + assert attributes["company"] is None or isinstance(attributes["company"], (str, unicode)), attributes["company"] + self._company = attributes["company"] + if "contributions" in attributes: # pragma no branch + assert attributes["contributions"] is None or isinstance(attributes["contributions"], (int, long)), attributes["contributions"] + self._contributions = attributes["contributions"] + if "created_at" in attributes: # pragma no branch + assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"] + self._created_at = self._parseDatetime(attributes["created_at"]) + if "disk_usage" in attributes: # pragma no branch + assert attributes["disk_usage"] is None or isinstance(attributes["disk_usage"], (int, long)), attributes["disk_usage"] + self._disk_usage = attributes["disk_usage"] + if "email" in attributes: # pragma no branch + assert attributes["email"] is None or isinstance(attributes["email"], (str, unicode)), attributes["email"] + self._email = attributes["email"] + if "followers" in attributes: # pragma no branch + assert attributes["followers"] is None or isinstance(attributes["followers"], (int, long)), attributes["followers"] + self._followers = attributes["followers"] + if "following" in attributes: # pragma no branch + assert attributes["following"] is None or isinstance(attributes["following"], (int, long)), attributes["following"] + self._following = attributes["following"] + if "gravatar_id" in attributes: # pragma no branch + assert attributes["gravatar_id"] is None or isinstance(attributes["gravatar_id"], (str, unicode)), attributes["gravatar_id"] + self._gravatar_id = attributes["gravatar_id"] + if "hireable" in attributes: # pragma no branch + assert attributes["hireable"] is None or isinstance(attributes["hireable"], bool), attributes["hireable"] + self._hireable = attributes["hireable"] + if "html_url" in attributes: # pragma no branch + assert attributes["html_url"] is None or isinstance(attributes["html_url"], (str, unicode)), attributes["html_url"] + self._html_url = attributes["html_url"] + if "id" in attributes: # pragma no branch + assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] + self._id = attributes["id"] + if "location" in attributes: # pragma no branch + assert attributes["location"] is None or isinstance(attributes["location"], (str, unicode)), attributes["location"] + self._location = attributes["location"] + if "login" in attributes: # pragma no branch + assert attributes["login"] is None or isinstance(attributes["login"], (str, unicode)), attributes["login"] + self._login = attributes["login"] + if "name" in attributes: # pragma no branch + assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] + self._name = attributes["name"] + if "owned_private_repos" in attributes: # pragma no branch + assert attributes["owned_private_repos"] is None or isinstance(attributes["owned_private_repos"], (int, long)), attributes["owned_private_repos"] + self._owned_private_repos = attributes["owned_private_repos"] + if "plan" in attributes: # pragma no branch + assert attributes["plan"] is None or isinstance(attributes["plan"], dict), attributes["plan"] + self._plan = None if attributes["plan"] is None else github.Plan.Plan(self._requester, attributes["plan"], completed=False) + if "private_gists" in attributes: # pragma no branch + assert attributes["private_gists"] is None or isinstance(attributes["private_gists"], (int, long)), attributes["private_gists"] + self._private_gists = attributes["private_gists"] + if "public_gists" in attributes: # pragma no branch + assert attributes["public_gists"] is None or isinstance(attributes["public_gists"], (int, long)), attributes["public_gists"] + self._public_gists = attributes["public_gists"] + if "public_repos" in attributes: # pragma no branch + assert attributes["public_repos"] is None or isinstance(attributes["public_repos"], (int, long)), attributes["public_repos"] + self._public_repos = attributes["public_repos"] + if "total_private_repos" in attributes: # pragma no branch + assert attributes["total_private_repos"] is None or isinstance(attributes["total_private_repos"], (int, long)), attributes["total_private_repos"] + self._total_private_repos = attributes["total_private_repos"] + if "type" in attributes: # pragma no branch + assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"] + self._type = attributes["type"] + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] diff --git a/github/Organization.py b/github/Organization.py index 896d99cf..c6aadb54 100644 --- a/github/Organization.py +++ b/github/Organization.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,138 +13,139 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject -import PaginatedList +import github.GithubObject +import github.PaginatedList -import Plan -import Team -import Event -import Repository -import NamedUser +import github.Plan +import github.Team +import github.Event +import github.Repository +import github.NamedUser -class Organization( GithubObject.GithubObject ): + +class Organization(github.GithubObject.GithubObject): @property - def avatar_url( self ): - self._completeIfNotSet( self._avatar_url ) - return self._NoneIfNotSet( self._avatar_url ) + def avatar_url(self): + self._completeIfNotSet(self._avatar_url) + return self._NoneIfNotSet(self._avatar_url) @property - def billing_email( self ): - self._completeIfNotSet( self._billing_email ) - return self._NoneIfNotSet( self._billing_email ) + def billing_email(self): + self._completeIfNotSet(self._billing_email) + return self._NoneIfNotSet(self._billing_email) @property - def blog( self ): - self._completeIfNotSet( self._blog ) - return self._NoneIfNotSet( self._blog ) + def blog(self): + self._completeIfNotSet(self._blog) + return self._NoneIfNotSet(self._blog) @property - def collaborators( self ): - self._completeIfNotSet( self._collaborators ) - return self._NoneIfNotSet( self._collaborators ) + def collaborators(self): + self._completeIfNotSet(self._collaborators) + return self._NoneIfNotSet(self._collaborators) @property - def company( self ): - self._completeIfNotSet( self._company ) - return self._NoneIfNotSet( self._company ) + def company(self): + self._completeIfNotSet(self._company) + return self._NoneIfNotSet(self._company) @property - def created_at( self ): - self._completeIfNotSet( self._created_at ) - return self._NoneIfNotSet( self._created_at ) + def created_at(self): + self._completeIfNotSet(self._created_at) + return self._NoneIfNotSet(self._created_at) @property - def disk_usage( self ): - self._completeIfNotSet( self._disk_usage ) - return self._NoneIfNotSet( self._disk_usage ) + def disk_usage(self): + self._completeIfNotSet(self._disk_usage) + return self._NoneIfNotSet(self._disk_usage) @property - def email( self ): - self._completeIfNotSet( self._email ) - return self._NoneIfNotSet( self._email ) + def email(self): + self._completeIfNotSet(self._email) + return self._NoneIfNotSet(self._email) @property - def followers( self ): - self._completeIfNotSet( self._followers ) - return self._NoneIfNotSet( self._followers ) + def followers(self): + self._completeIfNotSet(self._followers) + return self._NoneIfNotSet(self._followers) @property - def following( self ): - self._completeIfNotSet( self._following ) - return self._NoneIfNotSet( self._following ) + def following(self): + self._completeIfNotSet(self._following) + return self._NoneIfNotSet(self._following) @property - def gravatar_id( self ): - self._completeIfNotSet( self._gravatar_id ) - return self._NoneIfNotSet( self._gravatar_id ) + def gravatar_id(self): + self._completeIfNotSet(self._gravatar_id) + return self._NoneIfNotSet(self._gravatar_id) @property - def html_url( self ): - self._completeIfNotSet( self._html_url ) - return self._NoneIfNotSet( self._html_url ) + def html_url(self): + self._completeIfNotSet(self._html_url) + return self._NoneIfNotSet(self._html_url) @property - def id( self ): - self._completeIfNotSet( self._id ) - return self._NoneIfNotSet( self._id ) + def id(self): + self._completeIfNotSet(self._id) + return self._NoneIfNotSet(self._id) @property - def location( self ): - self._completeIfNotSet( self._location ) - return self._NoneIfNotSet( self._location ) + def location(self): + self._completeIfNotSet(self._location) + return self._NoneIfNotSet(self._location) @property - def login( self ): - self._completeIfNotSet( self._login ) - return self._NoneIfNotSet( self._login ) + def login(self): + self._completeIfNotSet(self._login) + return self._NoneIfNotSet(self._login) @property - def name( self ): - self._completeIfNotSet( self._name ) - return self._NoneIfNotSet( self._name ) + def name(self): + self._completeIfNotSet(self._name) + return self._NoneIfNotSet(self._name) @property - def owned_private_repos( self ): - self._completeIfNotSet( self._owned_private_repos ) - return self._NoneIfNotSet( self._owned_private_repos ) + def owned_private_repos(self): + self._completeIfNotSet(self._owned_private_repos) + return self._NoneIfNotSet(self._owned_private_repos) @property - def plan( self ): - self._completeIfNotSet( self._plan ) - return self._NoneIfNotSet( self._plan ) + def plan(self): + self._completeIfNotSet(self._plan) + return self._NoneIfNotSet(self._plan) @property - def private_gists( self ): - self._completeIfNotSet( self._private_gists ) - return self._NoneIfNotSet( self._private_gists ) + def private_gists(self): + self._completeIfNotSet(self._private_gists) + return self._NoneIfNotSet(self._private_gists) @property - def public_gists( self ): - self._completeIfNotSet( self._public_gists ) - return self._NoneIfNotSet( self._public_gists ) + def public_gists(self): + self._completeIfNotSet(self._public_gists) + return self._NoneIfNotSet(self._public_gists) @property - def public_repos( self ): - self._completeIfNotSet( self._public_repos ) - return self._NoneIfNotSet( self._public_repos ) + def public_repos(self): + self._completeIfNotSet(self._public_repos) + return self._NoneIfNotSet(self._public_repos) @property - def total_private_repos( self ): - self._completeIfNotSet( self._total_private_repos ) - return self._NoneIfNotSet( self._total_private_repos ) + def total_private_repos(self): + self._completeIfNotSet(self._total_private_repos) + return self._NoneIfNotSet(self._total_private_repos) @property - def type( self ): - self._completeIfNotSet( self._type ) - return self._NoneIfNotSet( self._type ) + def type(self): + self._completeIfNotSet(self._type) + return self._NoneIfNotSet(self._type) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) - def add_to_public_members( self, public_member ): - assert isinstance( public_member, NamedUser.NamedUser ), public_member + def add_to_public_members(self, public_member): + assert isinstance(public_member, github.NamedUser.NamedUser), public_member headers, data = self._requester.requestAndCheck( "PUT", self.url + "/public_members/" + public_member._identity, @@ -150,8 +153,8 @@ class Organization( GithubObject.GithubObject ): None ) - def create_fork( self, repo ): - assert isinstance( repo, Repository.Repository ), repo + def create_fork(self, repo): + assert isinstance(repo, github.Repository.Repository), repo url_parameters = { "org": self.login, } @@ -161,155 +164,161 @@ class Organization( GithubObject.GithubObject ): url_parameters, None ) - return Repository.Repository( self._requester, data, completed = True ) + return github.Repository.Repository(self._requester, data, completed=True) - def create_repo( self, name, description = GithubObject.NotSet, homepage = GithubObject.NotSet, private = GithubObject.NotSet, has_issues = GithubObject.NotSet, has_wiki = GithubObject.NotSet, has_downloads = GithubObject.NotSet, team_id = GithubObject.NotSet ): - assert isinstance( name, ( str, unicode ) ), name - assert description is GithubObject.NotSet or isinstance( description, ( str, unicode ) ), description - assert homepage is GithubObject.NotSet or isinstance( homepage, ( str, unicode ) ), homepage - assert private is GithubObject.NotSet or isinstance( private, bool ), private - 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, Team.Team ), team_id + def create_repo(self, name, description=github.GithubObject.NotSet, homepage=github.GithubObject.NotSet, private=github.GithubObject.NotSet, has_issues=github.GithubObject.NotSet, has_wiki=github.GithubObject.NotSet, has_downloads=github.GithubObject.NotSet, team_id=github.GithubObject.NotSet, auto_init=github.GithubObject.NotSet, gitignore_template=github.GithubObject.NotSet): + assert isinstance(name, (str, unicode)), name + assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description + assert homepage is github.GithubObject.NotSet or isinstance(homepage, (str, unicode)), homepage + assert private is github.GithubObject.NotSet or isinstance(private, bool), private + assert has_issues is github.GithubObject.NotSet or isinstance(has_issues, bool), has_issues + assert has_wiki is github.GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki + assert has_downloads is github.GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads + assert team_id is github.GithubObject.NotSet or isinstance(team_id, github.Team.Team), team_id + assert auto_init is github.GithubObject.NotSet or isinstance(auto_init, bool), auto_init + assert gitignore_template is github.GithubObject.NotSet or isinstance(gitignore_template, (str, unicode)), gitignore_template post_parameters = { "name": name, } - if description is not GithubObject.NotSet: - post_parameters[ "description" ] = description - if homepage is not GithubObject.NotSet: - post_parameters[ "homepage" ] = homepage - if private is not GithubObject.NotSet: - post_parameters[ "private" ] = private - if has_issues is not GithubObject.NotSet: - post_parameters[ "has_issues" ] = has_issues - if has_wiki is not GithubObject.NotSet: - post_parameters[ "has_wiki" ] = has_wiki - 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._identity + if description is not github.GithubObject.NotSet: + post_parameters["description"] = description + if homepage is not github.GithubObject.NotSet: + post_parameters["homepage"] = homepage + if private is not github.GithubObject.NotSet: + post_parameters["private"] = private + if has_issues is not github.GithubObject.NotSet: + post_parameters["has_issues"] = has_issues + if has_wiki is not github.GithubObject.NotSet: + post_parameters["has_wiki"] = has_wiki + if has_downloads is not github.GithubObject.NotSet: + post_parameters["has_downloads"] = has_downloads + if team_id is not github.GithubObject.NotSet: + post_parameters["team_id"] = team_id._identity + if auto_init is not github.GithubObject.NotSet: + post_parameters["auto_init"] = auto_init + if gitignore_template is not github.GithubObject.NotSet: + post_parameters["gitignore_template"] = gitignore_template headers, data = self._requester.requestAndCheck( "POST", self.url + "/repos", None, post_parameters ) - return Repository.Repository( self._requester, data, completed = True ) + return github.Repository.Repository(self._requester, data, completed=True) - 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, Repository.Repository ) for element in repo_names ), repo_names - assert permission is GithubObject.NotSet or isinstance( permission, ( str, unicode ) ), permission + def create_team(self, name, repo_names=github.GithubObject.NotSet, permission=github.GithubObject.NotSet): + assert isinstance(name, (str, unicode)), name + assert repo_names is github.GithubObject.NotSet or all(isinstance(element, github.Repository.Repository) for element in repo_names), repo_names + assert permission is github.GithubObject.NotSet or isinstance(permission, (str, unicode)), permission post_parameters = { "name": name, } - if repo_names is not GithubObject.NotSet: - post_parameters[ "repo_names" ] = [ element._identity for element in repo_names ] - if permission is not GithubObject.NotSet: - post_parameters[ "permission" ] = permission + if repo_names is not github.GithubObject.NotSet: + post_parameters["repo_names"] = [element._identity for element in repo_names] + if permission is not github.GithubObject.NotSet: + post_parameters["permission"] = permission headers, data = self._requester.requestAndCheck( "POST", self.url + "/teams", None, post_parameters ) - return Team.Team( self._requester, data, completed = True ) + return github.Team.Team(self._requester, data, completed=True) - def edit( self, billing_email = GithubObject.NotSet, blog = GithubObject.NotSet, company = GithubObject.NotSet, email = GithubObject.NotSet, location = GithubObject.NotSet, name = GithubObject.NotSet ): - assert billing_email is GithubObject.NotSet or isinstance( billing_email, ( str, unicode ) ), billing_email - assert blog is GithubObject.NotSet or isinstance( blog, ( str, unicode ) ), blog - assert company is GithubObject.NotSet or isinstance( company, ( str, unicode ) ), company - assert email is GithubObject.NotSet or isinstance( email, ( str, unicode ) ), email - assert location is GithubObject.NotSet or isinstance( location, ( str, unicode ) ), location - assert name is GithubObject.NotSet or isinstance( name, ( str, unicode ) ), name + def edit(self, billing_email=github.GithubObject.NotSet, blog=github.GithubObject.NotSet, company=github.GithubObject.NotSet, email=github.GithubObject.NotSet, location=github.GithubObject.NotSet, name=github.GithubObject.NotSet): + assert billing_email is github.GithubObject.NotSet or isinstance(billing_email, (str, unicode)), billing_email + assert blog is github.GithubObject.NotSet or isinstance(blog, (str, unicode)), blog + assert company is github.GithubObject.NotSet or isinstance(company, (str, unicode)), company + assert email is github.GithubObject.NotSet or isinstance(email, (str, unicode)), email + assert location is github.GithubObject.NotSet or isinstance(location, (str, unicode)), location + assert name is github.GithubObject.NotSet or isinstance(name, (str, unicode)), name post_parameters = dict() - if billing_email is not GithubObject.NotSet: - post_parameters[ "billing_email" ] = billing_email - if blog is not GithubObject.NotSet: - post_parameters[ "blog" ] = blog - if company is not GithubObject.NotSet: - post_parameters[ "company" ] = company - if email is not GithubObject.NotSet: - post_parameters[ "email" ] = email - if location is not GithubObject.NotSet: - post_parameters[ "location" ] = location - if name is not GithubObject.NotSet: - post_parameters[ "name" ] = name + if billing_email is not github.GithubObject.NotSet: + post_parameters["billing_email"] = billing_email + if blog is not github.GithubObject.NotSet: + post_parameters["blog"] = blog + if company is not github.GithubObject.NotSet: + post_parameters["company"] = company + if email is not github.GithubObject.NotSet: + post_parameters["email"] = email + if location is not github.GithubObject.NotSet: + post_parameters["location"] = location + if name is not github.GithubObject.NotSet: + post_parameters["name"] = name headers, data = self._requester.requestAndCheck( "PATCH", self.url, None, post_parameters ) - self._useAttributes( data ) + self._useAttributes(data) - def get_events( self ): - return PaginatedList.PaginatedList( - Event.Event, + def get_events(self): + return github.PaginatedList.PaginatedList( + github.Event.Event, self._requester, self.url + "/events", None ) - def get_members( self ): - return PaginatedList.PaginatedList( - NamedUser.NamedUser, + def get_members(self): + return github.PaginatedList.PaginatedList( + github.NamedUser.NamedUser, self._requester, self.url + "/members", None ) - def get_public_members( self ): - return PaginatedList.PaginatedList( - NamedUser.NamedUser, + def get_public_members(self): + return github.PaginatedList.PaginatedList( + github.NamedUser.NamedUser, self._requester, self.url + "/public_members", None ) - def get_repo( self, name ): - assert isinstance( name, ( str, unicode ) ), name + def get_repo(self, name): + assert isinstance(name, (str, unicode)), name headers, data = self._requester.requestAndCheck( "GET", "/repos/" + self.login + "/" + name, None, None ) - return Repository.Repository( self._requester, data, completed = True ) + return github.Repository.Repository(self._requester, data, completed=True) - def get_repos( self, type = GithubObject.NotSet ): - assert type is GithubObject.NotSet or isinstance( type, ( str, unicode ) ), type + def get_repos(self, type=github.GithubObject.NotSet): + assert type is github.GithubObject.NotSet or isinstance(type, (str, unicode)), type url_parameters = dict() - if type is not GithubObject.NotSet: - url_parameters[ "type" ] = type - return PaginatedList.PaginatedList( - Repository.Repository, + if type is not github.GithubObject.NotSet: + url_parameters["type"] = type + return github.PaginatedList.PaginatedList( + github.Repository.Repository, self._requester, self.url + "/repos", url_parameters ) - def get_team( self, id ): - assert isinstance( id, int ), id + def get_team(self, id): + assert isinstance(id, (int, long)), id headers, data = self._requester.requestAndCheck( "GET", - "/teams/" + str( id ), + "/teams/" + str(id), None, None ) - return Team.Team( self._requester, data, completed = True ) + return github.Team.Team(self._requester, data, completed=True) - def get_teams( self ): - return PaginatedList.PaginatedList( - Team.Team, + def get_teams(self): + return github.PaginatedList.PaginatedList( + github.Team.Team, self._requester, self.url + "/teams", None ) - def has_in_members( self, member ): - assert isinstance( member, NamedUser.NamedUser ), member + def has_in_members(self, member): + assert isinstance(member, github.NamedUser.NamedUser), member status, headers, data = self._requester.requestRaw( "GET", self.url + "/members/" + member._identity, @@ -318,8 +327,8 @@ class Organization( GithubObject.GithubObject ): ) return status == 204 - def has_in_public_members( self, public_member ): - assert isinstance( public_member, NamedUser.NamedUser ), public_member + def has_in_public_members(self, public_member): + assert isinstance(public_member, github.NamedUser.NamedUser), public_member status, headers, data = self._requester.requestRaw( "GET", self.url + "/public_members/" + public_member._identity, @@ -328,8 +337,8 @@ class Organization( GithubObject.GithubObject ): ) return status == 204 - def remove_from_members( self, member ): - assert isinstance( member, NamedUser.NamedUser ), member + def remove_from_members(self, member): + assert isinstance(member, github.NamedUser.NamedUser), member headers, data = self._requester.requestAndCheck( "DELETE", self.url + "/members/" + member._identity, @@ -337,8 +346,8 @@ class Organization( GithubObject.GithubObject ): None ) - def remove_from_public_members( self, public_member ): - assert isinstance( public_member, NamedUser.NamedUser ), public_member + def remove_from_public_members(self, public_member): + assert isinstance(public_member, github.NamedUser.NamedUser), public_member headers, data = self._requester.requestAndCheck( "DELETE", self.url + "/public_members/" + public_member._identity, @@ -346,102 +355,102 @@ class Organization( GithubObject.GithubObject ): None ) - def _initAttributes( self ): - self._avatar_url = GithubObject.NotSet - self._billing_email = GithubObject.NotSet - self._blog = GithubObject.NotSet - self._collaborators = GithubObject.NotSet - self._company = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._disk_usage = GithubObject.NotSet - self._email = GithubObject.NotSet - self._followers = GithubObject.NotSet - self._following = GithubObject.NotSet - self._gravatar_id = GithubObject.NotSet - self._html_url = GithubObject.NotSet - self._id = GithubObject.NotSet - self._location = GithubObject.NotSet - self._login = GithubObject.NotSet - self._name = GithubObject.NotSet - self._owned_private_repos = GithubObject.NotSet - self._plan = GithubObject.NotSet - self._private_gists = GithubObject.NotSet - self._public_gists = GithubObject.NotSet - self._public_repos = GithubObject.NotSet - self._total_private_repos = GithubObject.NotSet - self._type = GithubObject.NotSet - self._url = GithubObject.NotSet + def _initAttributes(self): + self._avatar_url = github.GithubObject.NotSet + self._billing_email = github.GithubObject.NotSet + self._blog = github.GithubObject.NotSet + self._collaborators = github.GithubObject.NotSet + self._company = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._disk_usage = github.GithubObject.NotSet + self._email = github.GithubObject.NotSet + self._followers = github.GithubObject.NotSet + self._following = github.GithubObject.NotSet + self._gravatar_id = github.GithubObject.NotSet + self._html_url = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._location = github.GithubObject.NotSet + self._login = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._owned_private_repos = github.GithubObject.NotSet + self._plan = github.GithubObject.NotSet + self._private_gists = github.GithubObject.NotSet + self._public_gists = github.GithubObject.NotSet + self._public_repos = github.GithubObject.NotSet + self._total_private_repos = github.GithubObject.NotSet + self._type = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "avatar_url" in attributes: # pragma no branch - assert attributes[ "avatar_url" ] is None or isinstance( attributes[ "avatar_url" ], ( str, unicode ) ), attributes[ "avatar_url" ] - self._avatar_url = attributes[ "avatar_url" ] - if "billing_email" in attributes: # pragma no branch - assert attributes[ "billing_email" ] is None or isinstance( attributes[ "billing_email" ], ( str, unicode ) ), attributes[ "billing_email" ] - self._billing_email = attributes[ "billing_email" ] - if "blog" in attributes: # pragma no branch - assert attributes[ "blog" ] is None or isinstance( attributes[ "blog" ], ( str, unicode ) ), attributes[ "blog" ] - self._blog = attributes[ "blog" ] - if "collaborators" in attributes: # pragma no branch - assert attributes[ "collaborators" ] is None or isinstance( attributes[ "collaborators" ], int ), attributes[ "collaborators" ] - self._collaborators = attributes[ "collaborators" ] - if "company" in attributes: # pragma no branch - assert attributes[ "company" ] is None or isinstance( attributes[ "company" ], ( str, unicode ) ), attributes[ "company" ] - self._company = attributes[ "company" ] - if "created_at" in attributes: # pragma no branch - assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = self._parseDatetime( attributes[ "created_at" ] ) - if "disk_usage" in attributes: # pragma no branch - assert attributes[ "disk_usage" ] is None or isinstance( attributes[ "disk_usage" ], int ), attributes[ "disk_usage" ] - self._disk_usage = attributes[ "disk_usage" ] - if "email" in attributes: # pragma no branch - assert attributes[ "email" ] is None or isinstance( attributes[ "email" ], ( str, unicode ) ), attributes[ "email" ] - self._email = attributes[ "email" ] - if "followers" in attributes: # pragma no branch - assert attributes[ "followers" ] is None or isinstance( attributes[ "followers" ], int ), attributes[ "followers" ] - self._followers = attributes[ "followers" ] - if "following" in attributes: # pragma no branch - assert attributes[ "following" ] is None or isinstance( attributes[ "following" ], int ), attributes[ "following" ] - self._following = attributes[ "following" ] - if "gravatar_id" in attributes: # pragma no branch - assert attributes[ "gravatar_id" ] is None or isinstance( attributes[ "gravatar_id" ], ( str, unicode ) ), attributes[ "gravatar_id" ] - self._gravatar_id = attributes[ "gravatar_id" ] - if "html_url" in attributes: # pragma no branch - assert attributes[ "html_url" ] is None or isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ] - self._html_url = attributes[ "html_url" ] - if "id" in attributes: # pragma no branch - assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] - self._id = attributes[ "id" ] - if "location" in attributes: # pragma no branch - assert attributes[ "location" ] is None or isinstance( attributes[ "location" ], ( str, unicode ) ), attributes[ "location" ] - self._location = attributes[ "location" ] - if "login" in attributes: # pragma no branch - assert attributes[ "login" ] is None or isinstance( attributes[ "login" ], ( str, unicode ) ), attributes[ "login" ] - self._login = attributes[ "login" ] - if "name" in attributes: # pragma no branch - assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ] - self._name = attributes[ "name" ] - if "owned_private_repos" in attributes: # pragma no branch - assert attributes[ "owned_private_repos" ] is None or isinstance( attributes[ "owned_private_repos" ], int ), attributes[ "owned_private_repos" ] - self._owned_private_repos = attributes[ "owned_private_repos" ] - if "plan" in attributes: # pragma no branch - assert attributes[ "plan" ] is None or isinstance( attributes[ "plan" ], dict ), attributes[ "plan" ] - self._plan = None if attributes[ "plan" ] is None else Plan.Plan( self._requester, attributes[ "plan" ], completed = False ) - if "private_gists" in attributes: # pragma no branch - assert attributes[ "private_gists" ] is None or isinstance( attributes[ "private_gists" ], int ), attributes[ "private_gists" ] - self._private_gists = attributes[ "private_gists" ] - if "public_gists" in attributes: # pragma no branch - assert attributes[ "public_gists" ] is None or isinstance( attributes[ "public_gists" ], int ), attributes[ "public_gists" ] - self._public_gists = attributes[ "public_gists" ] - if "public_repos" in attributes: # pragma no branch - assert attributes[ "public_repos" ] is None or isinstance( attributes[ "public_repos" ], int ), attributes[ "public_repos" ] - self._public_repos = attributes[ "public_repos" ] - if "total_private_repos" in attributes: # pragma no branch - assert attributes[ "total_private_repos" ] is None or isinstance( attributes[ "total_private_repos" ], int ), attributes[ "total_private_repos" ] - self._total_private_repos = attributes[ "total_private_repos" ] - if "type" in attributes: # pragma no branch - assert attributes[ "type" ] is None or isinstance( attributes[ "type" ], ( str, unicode ) ), attributes[ "type" ] - self._type = attributes[ "type" ] - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] + def _useAttributes(self, attributes): + if "avatar_url" in attributes: # pragma no branch + assert attributes["avatar_url"] is None or isinstance(attributes["avatar_url"], (str, unicode)), attributes["avatar_url"] + self._avatar_url = attributes["avatar_url"] + if "billing_email" in attributes: # pragma no branch + assert attributes["billing_email"] is None or isinstance(attributes["billing_email"], (str, unicode)), attributes["billing_email"] + self._billing_email = attributes["billing_email"] + if "blog" in attributes: # pragma no branch + assert attributes["blog"] is None or isinstance(attributes["blog"], (str, unicode)), attributes["blog"] + self._blog = attributes["blog"] + if "collaborators" in attributes: # pragma no branch + assert attributes["collaborators"] is None or isinstance(attributes["collaborators"], (int, long)), attributes["collaborators"] + self._collaborators = attributes["collaborators"] + if "company" in attributes: # pragma no branch + assert attributes["company"] is None or isinstance(attributes["company"], (str, unicode)), attributes["company"] + self._company = attributes["company"] + if "created_at" in attributes: # pragma no branch + assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"] + self._created_at = self._parseDatetime(attributes["created_at"]) + if "disk_usage" in attributes: # pragma no branch + assert attributes["disk_usage"] is None or isinstance(attributes["disk_usage"], (int, long)), attributes["disk_usage"] + self._disk_usage = attributes["disk_usage"] + if "email" in attributes: # pragma no branch + assert attributes["email"] is None or isinstance(attributes["email"], (str, unicode)), attributes["email"] + self._email = attributes["email"] + if "followers" in attributes: # pragma no branch + assert attributes["followers"] is None or isinstance(attributes["followers"], (int, long)), attributes["followers"] + self._followers = attributes["followers"] + if "following" in attributes: # pragma no branch + assert attributes["following"] is None or isinstance(attributes["following"], (int, long)), attributes["following"] + self._following = attributes["following"] + if "gravatar_id" in attributes: # pragma no branch + assert attributes["gravatar_id"] is None or isinstance(attributes["gravatar_id"], (str, unicode)), attributes["gravatar_id"] + self._gravatar_id = attributes["gravatar_id"] + if "html_url" in attributes: # pragma no branch + assert attributes["html_url"] is None or isinstance(attributes["html_url"], (str, unicode)), attributes["html_url"] + self._html_url = attributes["html_url"] + if "id" in attributes: # pragma no branch + assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] + self._id = attributes["id"] + if "location" in attributes: # pragma no branch + assert attributes["location"] is None or isinstance(attributes["location"], (str, unicode)), attributes["location"] + self._location = attributes["location"] + if "login" in attributes: # pragma no branch + assert attributes["login"] is None or isinstance(attributes["login"], (str, unicode)), attributes["login"] + self._login = attributes["login"] + if "name" in attributes: # pragma no branch + assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] + self._name = attributes["name"] + if "owned_private_repos" in attributes: # pragma no branch + assert attributes["owned_private_repos"] is None or isinstance(attributes["owned_private_repos"], (int, long)), attributes["owned_private_repos"] + self._owned_private_repos = attributes["owned_private_repos"] + if "plan" in attributes: # pragma no branch + assert attributes["plan"] is None or isinstance(attributes["plan"], dict), attributes["plan"] + self._plan = None if attributes["plan"] is None else github.Plan.Plan(self._requester, attributes["plan"], completed=False) + if "private_gists" in attributes: # pragma no branch + assert attributes["private_gists"] is None or isinstance(attributes["private_gists"], (int, long)), attributes["private_gists"] + self._private_gists = attributes["private_gists"] + if "public_gists" in attributes: # pragma no branch + assert attributes["public_gists"] is None or isinstance(attributes["public_gists"], (int, long)), attributes["public_gists"] + self._public_gists = attributes["public_gists"] + if "public_repos" in attributes: # pragma no branch + assert attributes["public_repos"] is None or isinstance(attributes["public_repos"], (int, long)), attributes["public_repos"] + self._public_repos = attributes["public_repos"] + if "total_private_repos" in attributes: # pragma no branch + assert attributes["total_private_repos"] is None or isinstance(attributes["total_private_repos"], (int, long)), attributes["total_private_repos"] + self._total_private_repos = attributes["total_private_repos"] + if "type" in attributes: # pragma no branch + assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"] + self._type = attributes["type"] + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] diff --git a/github/PaginatedList.py b/github/PaginatedList.py index f04d1540..8f7addd1 100644 --- a/github/PaginatedList.py +++ b/github/PaginatedList.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,21 +13,22 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject + class PaginatedListBase: - def __init__( self ): + def __init__(self): self.__elements = list() - def __getitem__( self, index ): - assert isinstance( index, ( int, slice ) ) - if isinstance( index, int ): - self.__fetchToIndex( index ) - return self.__elements[ index ] + def __getitem__(self, index): + assert isinstance(index, (int, slice)) + if isinstance(index, (int, long)): + self.__fetchToIndex(index) + return self.__elements[index] else: - return self._Slice( self, index ) + return self._Slice(self, index) - def __iter__( self ): + def __iter__(self): for element in self.__elements: yield element while self._couldGrow(): @@ -33,40 +36,41 @@ class PaginatedListBase: for element in newElements: yield element - def _isBiggerThan( self, index ): - return len( self.__elements ) > index or self._couldGrow() + def _isBiggerThan(self, index): + return len(self.__elements) > index or self._couldGrow() - def __fetchToIndex( self, index ): - while len( self.__elements ) <= index and self._couldGrow(): + def __fetchToIndex(self, index): + while len(self.__elements) <= index and self._couldGrow(): self.__grow() - def __grow( self ): + def __grow(self): newElements = self._fetchNextPage() self.__elements += newElements return newElements class _Slice: - def __init__( self, theList, theSlice ): + def __init__(self, theList, theSlice): self.__list = theList self.__start = theSlice.start or 0 self.__stop = theSlice.stop self.__step = theSlice.step or 1 - def __iter__( self ): + def __iter__(self): index = self.__start - while not self.__finished( index ) : - if self.__list._isBiggerThan( index ): - yield self.__list[ index ] + while not self.__finished(index): + if self.__list._isBiggerThan(index): + yield self.__list[index] index += self.__step else: return - def __finished( self, index ): + def __finished(self, index): return self.__stop is not None and index >= self.__stop -class PaginatedList( PaginatedListBase ): - def __init__( self, contentClass, requester, firstUrl, firstParams ): - PaginatedListBase.__init__( self ) + +class PaginatedList(PaginatedListBase): + def __init__(self, contentClass, requester, firstUrl, firstParams): + PaginatedListBase.__init__(self) self.__requester = requester self.__contentClass = contentClass self.__firstUrl = firstUrl @@ -74,42 +78,42 @@ class PaginatedList( PaginatedListBase ): self.__nextUrl = firstUrl self.__nextParams = firstParams - def _couldGrow( self ): + def _couldGrow(self): return self.__nextUrl is not None - def _fetchNextPage( self ): - headers, data = self.__requester.requestAndCheck( "GET", self.__nextUrl, self.__nextParams, None ) + def _fetchNextPage(self): + headers, data = self.__requester.requestAndCheck("GET", self.__nextUrl, self.__nextParams, None) - links = self.__parseLinkHeader( headers ) - if len( data ) > 0 and "next" in links: - self.__nextUrl = links[ "next" ] + links = self.__parseLinkHeader(headers) + if len(data) > 0 and "next" in links: + self.__nextUrl = links["next"] else: self.__nextUrl = None self.__nextParams = None return [ - self.__contentClass( self.__requester, element, completed = False ) + self.__contentClass(self.__requester, element, completed=False) for element in data ] - def __parseLinkHeader( self, headers ): + def __parseLinkHeader(self, headers): links = {} if "link" in headers: - linkHeaders = headers[ "link" ].split( "," ) + linkHeaders = headers["link"].split(",") for linkHeader in linkHeaders: - ( url, rel ) = linkHeader.split( "; " ) - url = url[ 1 : -1 ] - rel = rel[ 5 : -1 ] - links[ rel ] = url + (url, rel) = linkHeader.split("; ") + url = url[1:-1] + rel = rel[5:-1] + links[rel] = url return links - def get_page( self, page ): - params = dict( self.__firstParams ) + def get_page(self, page): + params = dict(self.__firstParams) if page != 0: - params[ "page" ] = page + 1 - headers, data = self.__requester.requestAndCheck( "GET", self.__firstUrl, params, None ) + params["page"] = page + 1 + headers, data = self.__requester.requestAndCheck("GET", self.__firstUrl, params, None) return [ - self.__contentClass( self.__requester, element, completed = False ) + self.__contentClass(self.__requester, element, completed=False) for element in data ] diff --git a/github/Permissions.py b/github/Permissions.py index a0782c43..32df3015 100644 --- a/github/Permissions.py +++ b/github/Permissions.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,33 +13,34 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class Permissions( GithubObject.BasicGithubObject ): + +class Permissions(github.GithubObject.BasicGithubObject): @property - def admin( self ): - return self._NoneIfNotSet( self._admin ) + def admin(self): + return self._NoneIfNotSet(self._admin) @property - def pull( self ): - return self._NoneIfNotSet( self._pull ) + def pull(self): + return self._NoneIfNotSet(self._pull) @property - def push( self ): - return self._NoneIfNotSet( self._push ) + def push(self): + return self._NoneIfNotSet(self._push) - def _initAttributes( self ): - self._admin = GithubObject.NotSet - self._pull = GithubObject.NotSet - self._push = GithubObject.NotSet + def _initAttributes(self): + self._admin = github.GithubObject.NotSet + self._pull = github.GithubObject.NotSet + self._push = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "admin" in attributes: # pragma no branch - assert attributes[ "admin" ] is None or isinstance( attributes[ "admin" ], bool ), attributes[ "admin" ] - self._admin = attributes[ "admin" ] - if "pull" in attributes: # pragma no branch - assert attributes[ "pull" ] is None or isinstance( attributes[ "pull" ], bool ), attributes[ "pull" ] - self._pull = attributes[ "pull" ] - if "push" in attributes: # pragma no branch - assert attributes[ "push" ] is None or isinstance( attributes[ "push" ], bool ), attributes[ "push" ] - self._push = attributes[ "push" ] + def _useAttributes(self, attributes): + if "admin" in attributes: # pragma no branch + assert attributes["admin"] is None or isinstance(attributes["admin"], bool), attributes["admin"] + self._admin = attributes["admin"] + if "pull" in attributes: # pragma no branch + assert attributes["pull"] is None or isinstance(attributes["pull"], bool), attributes["pull"] + self._pull = attributes["pull"] + if "push" in attributes: # pragma no branch + assert attributes["push"] is None or isinstance(attributes["push"], bool), attributes["push"] + self._push = attributes["push"] diff --git a/github/Plan.py b/github/Plan.py index 5eb0d435..4d4764a2 100644 --- a/github/Plan.py +++ b/github/Plan.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,41 +13,42 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class Plan( GithubObject.BasicGithubObject ): + +class Plan(github.GithubObject.BasicGithubObject): @property - def collaborators( self ): - return self._NoneIfNotSet( self._collaborators ) + def collaborators(self): + return self._NoneIfNotSet(self._collaborators) @property - def name( self ): - return self._NoneIfNotSet( self._name ) + def name(self): + return self._NoneIfNotSet(self._name) @property - def private_repos( self ): - return self._NoneIfNotSet( self._private_repos ) + def private_repos(self): + return self._NoneIfNotSet(self._private_repos) @property - def space( self ): - return self._NoneIfNotSet( self._space ) + def space(self): + return self._NoneIfNotSet(self._space) - def _initAttributes( self ): - self._collaborators = GithubObject.NotSet - self._name = GithubObject.NotSet - self._private_repos = GithubObject.NotSet - self._space = GithubObject.NotSet + def _initAttributes(self): + self._collaborators = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._private_repos = github.GithubObject.NotSet + self._space = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "collaborators" in attributes: # pragma no branch - assert attributes[ "collaborators" ] is None or isinstance( attributes[ "collaborators" ], int ), attributes[ "collaborators" ] - self._collaborators = attributes[ "collaborators" ] - if "name" in attributes: # pragma no branch - assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ] - self._name = attributes[ "name" ] - if "private_repos" in attributes: # pragma no branch - assert attributes[ "private_repos" ] is None or isinstance( attributes[ "private_repos" ], int ), attributes[ "private_repos" ] - self._private_repos = attributes[ "private_repos" ] - if "space" in attributes: # pragma no branch - assert attributes[ "space" ] is None or isinstance( attributes[ "space" ], int ), attributes[ "space" ] - self._space = attributes[ "space" ] + def _useAttributes(self, attributes): + if "collaborators" in attributes: # pragma no branch + assert attributes["collaborators"] is None or isinstance(attributes["collaborators"], (int, long)), attributes["collaborators"] + self._collaborators = attributes["collaborators"] + if "name" in attributes: # pragma no branch + assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] + self._name = attributes["name"] + if "private_repos" in attributes: # pragma no branch + assert attributes["private_repos"] is None or isinstance(attributes["private_repos"], (int, long)), attributes["private_repos"] + self._private_repos = attributes["private_repos"] + if "space" in attributes: # pragma no branch + assert attributes["space"] is None or isinstance(attributes["space"], (int, long)), attributes["space"] + self._space = attributes["space"] diff --git a/github/PullRequest.py b/github/PullRequest.py index 6fb604b5..0799aa64 100644 --- a/github/PullRequest.py +++ b/github/PullRequest.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,156 +13,162 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject -import PaginatedList +import github.GithubObject +import github.PaginatedList -import PullRequestMergeStatus -import NamedUser -import PullRequestPart -import PullRequestComment -import File -import IssueComment -import Commit +import github.PullRequestMergeStatus +import github.NamedUser +import github.PullRequestPart +import github.PullRequestComment +import github.File +import github.IssueComment +import github.Commit -class PullRequest( GithubObject.GithubObject ): + +class PullRequest(github.GithubObject.GithubObject): @property - def additions( self ): - self._completeIfNotSet( self._additions ) - return self._NoneIfNotSet( self._additions ) + def additions(self): + self._completeIfNotSet(self._additions) + return self._NoneIfNotSet(self._additions) @property - def base( self ): - self._completeIfNotSet( self._base ) - return self._NoneIfNotSet( self._base ) + def assignee(self): + self._completeIfNotSet(self._assignee) + return self._NoneIfNotSet(self._assignee) @property - def body( self ): - self._completeIfNotSet( self._body ) - return self._NoneIfNotSet( self._body ) + def base(self): + self._completeIfNotSet(self._base) + return self._NoneIfNotSet(self._base) @property - def changed_files( self ): - self._completeIfNotSet( self._changed_files ) - return self._NoneIfNotSet( self._changed_files ) + def body(self): + self._completeIfNotSet(self._body) + return self._NoneIfNotSet(self._body) @property - def closed_at( self ): - self._completeIfNotSet( self._closed_at ) - return self._NoneIfNotSet( self._closed_at ) + def changed_files(self): + self._completeIfNotSet(self._changed_files) + return self._NoneIfNotSet(self._changed_files) @property - def comments( self ): - self._completeIfNotSet( self._comments ) - return self._NoneIfNotSet( self._comments ) + def closed_at(self): + self._completeIfNotSet(self._closed_at) + return self._NoneIfNotSet(self._closed_at) @property - def commits( self ): - self._completeIfNotSet( self._commits ) - return self._NoneIfNotSet( self._commits ) + def comments(self): + self._completeIfNotSet(self._comments) + return self._NoneIfNotSet(self._comments) @property - def created_at( self ): - self._completeIfNotSet( self._created_at ) - return self._NoneIfNotSet( self._created_at ) + def commits(self): + self._completeIfNotSet(self._commits) + return self._NoneIfNotSet(self._commits) @property - def deletions( self ): - self._completeIfNotSet( self._deletions ) - return self._NoneIfNotSet( self._deletions ) + def created_at(self): + self._completeIfNotSet(self._created_at) + return self._NoneIfNotSet(self._created_at) @property - def diff_url( self ): - self._completeIfNotSet( self._diff_url ) - return self._NoneIfNotSet( self._diff_url ) + def deletions(self): + self._completeIfNotSet(self._deletions) + return self._NoneIfNotSet(self._deletions) @property - def head( self ): - self._completeIfNotSet( self._head ) - return self._NoneIfNotSet( self._head ) + def diff_url(self): + self._completeIfNotSet(self._diff_url) + return self._NoneIfNotSet(self._diff_url) @property - def html_url( self ): - self._completeIfNotSet( self._html_url ) - return self._NoneIfNotSet( self._html_url ) + def head(self): + self._completeIfNotSet(self._head) + return self._NoneIfNotSet(self._head) @property - def id( self ): - self._completeIfNotSet( self._id ) - return self._NoneIfNotSet( self._id ) + def html_url(self): + self._completeIfNotSet(self._html_url) + return self._NoneIfNotSet(self._html_url) @property - def issue_url( self ): - self._completeIfNotSet( self._issue_url ) - return self._NoneIfNotSet( self._issue_url ) + def id(self): + self._completeIfNotSet(self._id) + return self._NoneIfNotSet(self._id) @property - def mergeable( self ): - self._completeIfNotSet( self._mergeable ) - return self._NoneIfNotSet( self._mergeable ) + def issue_url(self): + self._completeIfNotSet(self._issue_url) + return self._NoneIfNotSet(self._issue_url) @property - def merged( self ): - self._completeIfNotSet( self._merged ) - return self._NoneIfNotSet( self._merged ) + def mergeable(self): + self._completeIfNotSet(self._mergeable) + return self._NoneIfNotSet(self._mergeable) @property - def merged_at( self ): - self._completeIfNotSet( self._merged_at ) - return self._NoneIfNotSet( self._merged_at ) + def merged(self): + self._completeIfNotSet(self._merged) + return self._NoneIfNotSet(self._merged) @property - def merged_by( self ): - self._completeIfNotSet( self._merged_by ) - return self._NoneIfNotSet( self._merged_by ) + def merged_at(self): + self._completeIfNotSet(self._merged_at) + return self._NoneIfNotSet(self._merged_at) @property - def number( self ): - self._completeIfNotSet( self._number ) - return self._NoneIfNotSet( self._number ) + def merged_by(self): + self._completeIfNotSet(self._merged_by) + return self._NoneIfNotSet(self._merged_by) @property - def patch_url( self ): - self._completeIfNotSet( self._patch_url ) - return self._NoneIfNotSet( self._patch_url ) + def number(self): + self._completeIfNotSet(self._number) + return self._NoneIfNotSet(self._number) @property - def review_comments( self ): - self._completeIfNotSet( self._review_comments ) - return self._NoneIfNotSet( self._review_comments ) + def patch_url(self): + self._completeIfNotSet(self._patch_url) + return self._NoneIfNotSet(self._patch_url) @property - def state( self ): - self._completeIfNotSet( self._state ) - return self._NoneIfNotSet( self._state ) + def review_comments(self): + self._completeIfNotSet(self._review_comments) + return self._NoneIfNotSet(self._review_comments) @property - def title( self ): - self._completeIfNotSet( self._title ) - return self._NoneIfNotSet( self._title ) + def state(self): + self._completeIfNotSet(self._state) + return self._NoneIfNotSet(self._state) @property - def updated_at( self ): - self._completeIfNotSet( self._updated_at ) - return self._NoneIfNotSet( self._updated_at ) + def title(self): + self._completeIfNotSet(self._title) + return self._NoneIfNotSet(self._title) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def updated_at(self): + self._completeIfNotSet(self._updated_at) + return self._NoneIfNotSet(self._updated_at) @property - def user( self ): - self._completeIfNotSet( self._user ) - return self._NoneIfNotSet( self._user ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) - def create_comment( self, body, commit_id, path, position ): - return self.create_review_comment( body, commit_id, path, position ) + @property + def user(self): + self._completeIfNotSet(self._user) + return self._NoneIfNotSet(self._user) - def create_review_comment( self, body, commit_id, path, position ): - assert isinstance( body, ( str, unicode ) ), body - assert isinstance( commit_id, Commit.Commit ), commit_id - assert isinstance( path, ( str, unicode ) ), path - assert isinstance( position, int ), position + def create_comment(self, body, commit_id, path, position): + return self.create_review_comment(body, commit_id, path, position) + + def create_review_comment(self, body, commit_id, path, position): + assert isinstance(body, (str, unicode)), body + assert isinstance(commit_id, github.Commit.Commit), commit_id + assert isinstance(path, (str, unicode)), path + assert isinstance(position, (int, long)), position post_parameters = { "body": body, "commit_id": commit_id._identity, @@ -173,99 +181,99 @@ class PullRequest( GithubObject.GithubObject ): None, post_parameters ) - return PullRequestComment.PullRequestComment( self._requester, data, completed = True ) + return github.PullRequestComment.PullRequestComment(self._requester, data, completed=True) - def create_issue_comment( self, body ): - assert isinstance( body, ( str, unicode ) ), body + def create_issue_comment(self, body): + assert isinstance(body, (str, unicode)), body post_parameters = { "body": body, } headers, data = self._requester.requestAndCheck( "POST", - self._parentUrl( self._parentUrl( self.url ) ) + "/issues/" + str( self.number ) + "/comments", + self._parentUrl(self._parentUrl(self.url)) + "/issues/" + str(self.number) + "/comments", None, post_parameters ) - return IssueComment.IssueComment( self._requester, data, completed = True ) + return github.IssueComment.IssueComment(self._requester, data, completed=True) - def edit( self, title = GithubObject.NotSet, body = GithubObject.NotSet, state = GithubObject.NotSet ): - assert title is GithubObject.NotSet or isinstance( title, ( str, unicode ) ), title - assert body is GithubObject.NotSet or isinstance( body, ( str, unicode ) ), body - assert state is GithubObject.NotSet or isinstance( state, ( str, unicode ) ), state + def edit(self, title=github.GithubObject.NotSet, body=github.GithubObject.NotSet, state=github.GithubObject.NotSet): + assert title is github.GithubObject.NotSet or isinstance(title, (str, unicode)), title + assert body is github.GithubObject.NotSet or isinstance(body, (str, unicode)), body + assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state post_parameters = dict() - if title is not GithubObject.NotSet: - post_parameters[ "title" ] = title - if body is not GithubObject.NotSet: - post_parameters[ "body" ] = body - if state is not GithubObject.NotSet: - post_parameters[ "state" ] = state + if title is not github.GithubObject.NotSet: + post_parameters["title"] = title + if body is not github.GithubObject.NotSet: + post_parameters["body"] = body + if state is not github.GithubObject.NotSet: + post_parameters["state"] = state headers, data = self._requester.requestAndCheck( "PATCH", self.url, None, post_parameters ) - self._useAttributes( data ) + self._useAttributes(data) - def get_comment( self, id ): - return self.get_review_comment( id ) + def get_comment(self, id): + return self.get_review_comment(id) - def get_review_comment( self, id ): - assert isinstance( id, int ), id + def get_review_comment(self, id): + assert isinstance(id, (int, long)), id headers, data = self._requester.requestAndCheck( "GET", - self._parentUrl( self.url ) + "/comments/" + str( id ), + self._parentUrl(self.url) + "/comments/" + str(id), None, None ) - return PullRequestComment.PullRequestComment( self._requester, data, completed = True ) + return github.PullRequestComment.PullRequestComment(self._requester, data, completed=True) - def get_comments( self ): + def get_comments(self): return self.get_review_comments() - def get_review_comments( self ): - return PaginatedList.PaginatedList( - PullRequestComment.PullRequestComment, + def get_review_comments(self): + return github.PaginatedList.PaginatedList( + github.PullRequestComment.PullRequestComment, self._requester, self.url + "/comments", None ) - def get_commits( self ): - return PaginatedList.PaginatedList( - Commit.Commit, + def get_commits(self): + return github.PaginatedList.PaginatedList( + github.Commit.Commit, self._requester, self.url + "/commits", None ) - def get_files( self ): - return PaginatedList.PaginatedList( - File.File, + def get_files(self): + return github.PaginatedList.PaginatedList( + github.File.File, self._requester, self.url + "/files", None ) - def get_issue_comment( self, id ): - assert isinstance( id, int ), id + def get_issue_comment(self, id): + assert isinstance(id, (int, long)), id headers, data = self._requester.requestAndCheck( "GET", - self._parentUrl( self._parentUrl( self.url ) ) + "/issues/comments/" + str( id ), + self._parentUrl(self._parentUrl(self.url)) + "/issues/comments/" + str(id), None, None ) - return IssueComment.IssueComment( self._requester, data, completed = True ) + return github.IssueComment.IssueComment(self._requester, data, completed=True) - def get_issue_comments( self ): - return PaginatedList.PaginatedList( - IssueComment.IssueComment, + def get_issue_comments(self): + return github.PaginatedList.PaginatedList( + github.IssueComment.IssueComment, self._requester, - self._parentUrl( self._parentUrl( self.url ) ) + "/issues/" + str( self.number ) + "/comments", + self._parentUrl(self._parentUrl(self.url)) + "/issues/" + str(self.number) + "/comments", None ) - def is_merged( self ): + def is_merged(self): status, headers, data = self._requester.requestRaw( "GET", self.url + "/merge", @@ -274,123 +282,127 @@ class PullRequest( GithubObject.GithubObject ): ) return status == 204 - def merge( self, commit_message = GithubObject.NotSet ): - assert commit_message is GithubObject.NotSet or isinstance( commit_message, ( str, unicode ) ), commit_message + def merge(self, commit_message=github.GithubObject.NotSet): + assert commit_message is github.GithubObject.NotSet or isinstance(commit_message, (str, unicode)), commit_message post_parameters = dict() - if commit_message is not GithubObject.NotSet: - post_parameters[ "commit_message" ] = commit_message + if commit_message is not github.GithubObject.NotSet: + post_parameters["commit_message"] = commit_message headers, data = self._requester.requestAndCheck( "PUT", self.url + "/merge", None, post_parameters ) - return PullRequestMergeStatus.PullRequestMergeStatus( self._requester, data, completed = True ) + return github.PullRequestMergeStatus.PullRequestMergeStatus(self._requester, data, completed=True) - def _initAttributes( self ): - self._additions = GithubObject.NotSet - self._base = GithubObject.NotSet - self._body = GithubObject.NotSet - self._changed_files = GithubObject.NotSet - self._closed_at = GithubObject.NotSet - self._comments = GithubObject.NotSet - self._commits = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._deletions = GithubObject.NotSet - self._diff_url = GithubObject.NotSet - self._head = GithubObject.NotSet - self._html_url = GithubObject.NotSet - self._id = GithubObject.NotSet - self._issue_url = GithubObject.NotSet - self._mergeable = GithubObject.NotSet - self._merged = GithubObject.NotSet - self._merged_at = GithubObject.NotSet - self._merged_by = GithubObject.NotSet - self._number = GithubObject.NotSet - self._patch_url = GithubObject.NotSet - self._review_comments = GithubObject.NotSet - self._state = GithubObject.NotSet - self._title = GithubObject.NotSet - self._updated_at = GithubObject.NotSet - self._url = GithubObject.NotSet - self._user = GithubObject.NotSet + def _initAttributes(self): + self._additions = github.GithubObject.NotSet + self._assignee = github.GithubObject.NotSet + self._base = github.GithubObject.NotSet + self._body = github.GithubObject.NotSet + self._changed_files = github.GithubObject.NotSet + self._closed_at = github.GithubObject.NotSet + self._comments = github.GithubObject.NotSet + self._commits = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._deletions = github.GithubObject.NotSet + self._diff_url = github.GithubObject.NotSet + self._head = github.GithubObject.NotSet + self._html_url = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._issue_url = github.GithubObject.NotSet + self._mergeable = github.GithubObject.NotSet + self._merged = github.GithubObject.NotSet + self._merged_at = github.GithubObject.NotSet + self._merged_by = github.GithubObject.NotSet + self._number = github.GithubObject.NotSet + self._patch_url = github.GithubObject.NotSet + self._review_comments = github.GithubObject.NotSet + self._state = github.GithubObject.NotSet + self._title = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + self._user = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "additions" in attributes: # pragma no branch - assert attributes[ "additions" ] is None or isinstance( attributes[ "additions" ], int ), attributes[ "additions" ] - self._additions = attributes[ "additions" ] - if "base" in attributes: # pragma no branch - assert attributes[ "base" ] is None or isinstance( attributes[ "base" ], dict ), attributes[ "base" ] - self._base = None if attributes[ "base" ] is None else PullRequestPart.PullRequestPart( self._requester, attributes[ "base" ], completed = False ) - if "body" in attributes: # pragma no branch - assert attributes[ "body" ] is None or isinstance( attributes[ "body" ], ( str, unicode ) ), attributes[ "body" ] - self._body = attributes[ "body" ] - if "changed_files" in attributes: # pragma no branch - assert attributes[ "changed_files" ] is None or isinstance( attributes[ "changed_files" ], int ), attributes[ "changed_files" ] - self._changed_files = attributes[ "changed_files" ] - if "closed_at" in attributes: # pragma no branch - assert attributes[ "closed_at" ] is None or isinstance( attributes[ "closed_at" ], ( str, unicode ) ), attributes[ "closed_at" ] - self._closed_at = self._parseDatetime( attributes[ "closed_at" ] ) - if "comments" in attributes: # pragma no branch - assert attributes[ "comments" ] is None or isinstance( attributes[ "comments" ], int ), attributes[ "comments" ] - self._comments = attributes[ "comments" ] - if "commits" in attributes: # pragma no branch - assert attributes[ "commits" ] is None or isinstance( attributes[ "commits" ], int ), attributes[ "commits" ] - self._commits = attributes[ "commits" ] - if "created_at" in attributes: # pragma no branch - assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = self._parseDatetime( attributes[ "created_at" ] ) - if "deletions" in attributes: # pragma no branch - assert attributes[ "deletions" ] is None or isinstance( attributes[ "deletions" ], int ), attributes[ "deletions" ] - self._deletions = attributes[ "deletions" ] - if "diff_url" in attributes: # pragma no branch - assert attributes[ "diff_url" ] is None or isinstance( attributes[ "diff_url" ], ( str, unicode ) ), attributes[ "diff_url" ] - self._diff_url = attributes[ "diff_url" ] - if "head" in attributes: # pragma no branch - assert attributes[ "head" ] is None or isinstance( attributes[ "head" ], dict ), attributes[ "head" ] - self._head = None if attributes[ "head" ] is None else PullRequestPart.PullRequestPart( self._requester, attributes[ "head" ], completed = False ) - if "html_url" in attributes: # pragma no branch - assert attributes[ "html_url" ] is None or isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ] - self._html_url = attributes[ "html_url" ] - if "id" in attributes: # pragma no branch - assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] - self._id = attributes[ "id" ] - if "issue_url" in attributes: # pragma no branch - assert attributes[ "issue_url" ] is None or isinstance( attributes[ "issue_url" ], ( str, unicode ) ), attributes[ "issue_url" ] - self._issue_url = attributes[ "issue_url" ] - if "mergeable" in attributes: # pragma no branch - assert attributes[ "mergeable" ] is None or isinstance( attributes[ "mergeable" ], bool ), attributes[ "mergeable" ] - self._mergeable = attributes[ "mergeable" ] - if "merged" in attributes: # pragma no branch - assert attributes[ "merged" ] is None or isinstance( attributes[ "merged" ], bool ), attributes[ "merged" ] - self._merged = attributes[ "merged" ] - if "merged_at" in attributes: # pragma no branch - assert attributes[ "merged_at" ] is None or isinstance( attributes[ "merged_at" ], ( str, unicode ) ), attributes[ "merged_at" ] - self._merged_at = self._parseDatetime( attributes[ "merged_at" ] ) - if "merged_by" in attributes: # pragma no branch - assert attributes[ "merged_by" ] is None or isinstance( attributes[ "merged_by" ], dict ), attributes[ "merged_by" ] - self._merged_by = None if attributes[ "merged_by" ] is None else NamedUser.NamedUser( self._requester, attributes[ "merged_by" ], completed = False ) - if "number" in attributes: # pragma no branch - assert attributes[ "number" ] is None or isinstance( attributes[ "number" ], int ), attributes[ "number" ] - self._number = attributes[ "number" ] - if "patch_url" in attributes: # pragma no branch - assert attributes[ "patch_url" ] is None or isinstance( attributes[ "patch_url" ], ( str, unicode ) ), attributes[ "patch_url" ] - self._patch_url = attributes[ "patch_url" ] - if "review_comments" in attributes: # pragma no branch - assert attributes[ "review_comments" ] is None or isinstance( attributes[ "review_comments" ], int ), attributes[ "review_comments" ] - self._review_comments = attributes[ "review_comments" ] - if "state" in attributes: # pragma no branch - assert attributes[ "state" ] is None or isinstance( attributes[ "state" ], ( str, unicode ) ), attributes[ "state" ] - self._state = attributes[ "state" ] - if "title" in attributes: # pragma no branch - assert attributes[ "title" ] is None or isinstance( attributes[ "title" ], ( str, unicode ) ), attributes[ "title" ] - self._title = attributes[ "title" ] - if "updated_at" in attributes: # pragma no branch - assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ] - self._updated_at = self._parseDatetime( attributes[ "updated_at" ] ) - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] - if "user" in attributes: # pragma no branch - assert attributes[ "user" ] is None or isinstance( attributes[ "user" ], dict ), attributes[ "user" ] - self._user = None if attributes[ "user" ] is None else NamedUser.NamedUser( self._requester, attributes[ "user" ], completed = False ) + def _useAttributes(self, attributes): + if "additions" in attributes: # pragma no branch + assert attributes["additions"] is None or isinstance(attributes["additions"], (int, long)), attributes["additions"] + self._additions = attributes["additions"] + if "assignee" in attributes: # pragma no branch + assert attributes["assignee"] is None or isinstance(attributes["assignee"], dict), attributes["assignee"] + self._assignee = None if attributes["assignee"] is None else github.NamedUser.NamedUser(self._requester, attributes["assignee"], completed=False) + if "base" in attributes: # pragma no branch + assert attributes["base"] is None or isinstance(attributes["base"], dict), attributes["base"] + self._base = None if attributes["base"] is None else github.PullRequestPart.PullRequestPart(self._requester, attributes["base"], completed=False) + if "body" in attributes: # pragma no branch + assert attributes["body"] is None or isinstance(attributes["body"], (str, unicode)), attributes["body"] + self._body = attributes["body"] + if "changed_files" in attributes: # pragma no branch + assert attributes["changed_files"] is None or isinstance(attributes["changed_files"], (int, long)), attributes["changed_files"] + self._changed_files = attributes["changed_files"] + if "closed_at" in attributes: # pragma no branch + assert attributes["closed_at"] is None or isinstance(attributes["closed_at"], (str, unicode)), attributes["closed_at"] + self._closed_at = self._parseDatetime(attributes["closed_at"]) + if "comments" in attributes: # pragma no branch + assert attributes["comments"] is None or isinstance(attributes["comments"], (int, long)), attributes["comments"] + self._comments = attributes["comments"] + if "commits" in attributes: # pragma no branch + assert attributes["commits"] is None or isinstance(attributes["commits"], (int, long)), attributes["commits"] + self._commits = attributes["commits"] + if "created_at" in attributes: # pragma no branch + assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"] + self._created_at = self._parseDatetime(attributes["created_at"]) + if "deletions" in attributes: # pragma no branch + assert attributes["deletions"] is None or isinstance(attributes["deletions"], (int, long)), attributes["deletions"] + self._deletions = attributes["deletions"] + if "diff_url" in attributes: # pragma no branch + assert attributes["diff_url"] is None or isinstance(attributes["diff_url"], (str, unicode)), attributes["diff_url"] + self._diff_url = attributes["diff_url"] + if "head" in attributes: # pragma no branch + assert attributes["head"] is None or isinstance(attributes["head"], dict), attributes["head"] + self._head = None if attributes["head"] is None else github.PullRequestPart.PullRequestPart(self._requester, attributes["head"], completed=False) + if "html_url" in attributes: # pragma no branch + assert attributes["html_url"] is None or isinstance(attributes["html_url"], (str, unicode)), attributes["html_url"] + self._html_url = attributes["html_url"] + if "id" in attributes: # pragma no branch + assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] + self._id = attributes["id"] + if "issue_url" in attributes: # pragma no branch + assert attributes["issue_url"] is None or isinstance(attributes["issue_url"], (str, unicode)), attributes["issue_url"] + self._issue_url = attributes["issue_url"] + if "mergeable" in attributes: # pragma no branch + assert attributes["mergeable"] is None or isinstance(attributes["mergeable"], bool), attributes["mergeable"] + self._mergeable = attributes["mergeable"] + if "merged" in attributes: # pragma no branch + assert attributes["merged"] is None or isinstance(attributes["merged"], bool), attributes["merged"] + self._merged = attributes["merged"] + if "merged_at" in attributes: # pragma no branch + assert attributes["merged_at"] is None or isinstance(attributes["merged_at"], (str, unicode)), attributes["merged_at"] + self._merged_at = self._parseDatetime(attributes["merged_at"]) + if "merged_by" in attributes: # pragma no branch + assert attributes["merged_by"] is None or isinstance(attributes["merged_by"], dict), attributes["merged_by"] + self._merged_by = None if attributes["merged_by"] is None else github.NamedUser.NamedUser(self._requester, attributes["merged_by"], completed=False) + if "number" in attributes: # pragma no branch + assert attributes["number"] is None or isinstance(attributes["number"], (int, long)), attributes["number"] + self._number = attributes["number"] + if "patch_url" in attributes: # pragma no branch + assert attributes["patch_url"] is None or isinstance(attributes["patch_url"], (str, unicode)), attributes["patch_url"] + self._patch_url = attributes["patch_url"] + if "review_comments" in attributes: # pragma no branch + assert attributes["review_comments"] is None or isinstance(attributes["review_comments"], (int, long)), attributes["review_comments"] + self._review_comments = attributes["review_comments"] + if "state" in attributes: # pragma no branch + assert attributes["state"] is None or isinstance(attributes["state"], (str, unicode)), attributes["state"] + self._state = attributes["state"] + if "title" in attributes: # pragma no branch + assert attributes["title"] is None or isinstance(attributes["title"], (str, unicode)), attributes["title"] + self._title = attributes["title"] + if "updated_at" in attributes: # pragma no branch + assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], (str, unicode)), attributes["updated_at"] + self._updated_at = self._parseDatetime(attributes["updated_at"]) + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] + if "user" in attributes: # pragma no branch + assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"] + self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False) diff --git a/github/PullRequestComment.py b/github/PullRequestComment.py index eb042a3c..dbbb95b7 100644 --- a/github/PullRequestComment.py +++ b/github/PullRequestComment.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,67 +13,68 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import NamedUser +import github.NamedUser -class PullRequestComment( GithubObject.GithubObject ): + +class PullRequestComment(github.GithubObject.GithubObject): @property - def body( self ): - self._completeIfNotSet( self._body ) - return self._NoneIfNotSet( self._body ) + def body(self): + self._completeIfNotSet(self._body) + return self._NoneIfNotSet(self._body) @property - def commit_id( self ): - self._completeIfNotSet( self._commit_id ) - return self._NoneIfNotSet( self._commit_id ) + def commit_id(self): + self._completeIfNotSet(self._commit_id) + return self._NoneIfNotSet(self._commit_id) @property - def created_at( self ): - self._completeIfNotSet( self._created_at ) - return self._NoneIfNotSet( self._created_at ) + def created_at(self): + self._completeIfNotSet(self._created_at) + return self._NoneIfNotSet(self._created_at) @property - def id( self ): - self._completeIfNotSet( self._id ) - return self._NoneIfNotSet( self._id ) + def id(self): + self._completeIfNotSet(self._id) + return self._NoneIfNotSet(self._id) @property - def original_commit_id( self ): - self._completeIfNotSet( self._original_commit_id ) - return self._NoneIfNotSet( self._original_commit_id ) + def original_commit_id(self): + self._completeIfNotSet(self._original_commit_id) + return self._NoneIfNotSet(self._original_commit_id) @property - def original_position( self ): - self._completeIfNotSet( self._original_position ) - return self._NoneIfNotSet( self._original_position ) + def original_position(self): + self._completeIfNotSet(self._original_position) + return self._NoneIfNotSet(self._original_position) @property - def path( self ): - self._completeIfNotSet( self._path ) - return self._NoneIfNotSet( self._path ) + def path(self): + self._completeIfNotSet(self._path) + return self._NoneIfNotSet(self._path) @property - def position( self ): - self._completeIfNotSet( self._position ) - return self._NoneIfNotSet( self._position ) + def position(self): + self._completeIfNotSet(self._position) + return self._NoneIfNotSet(self._position) @property - def updated_at( self ): - self._completeIfNotSet( self._updated_at ) - return self._NoneIfNotSet( self._updated_at ) + def updated_at(self): + self._completeIfNotSet(self._updated_at) + return self._NoneIfNotSet(self._updated_at) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) @property - def user( self ): - self._completeIfNotSet( self._user ) - return self._NoneIfNotSet( self._user ) + def user(self): + self._completeIfNotSet(self._user) + return self._NoneIfNotSet(self._user) - def delete( self ): + def delete(self): headers, data = self._requester.requestAndCheck( "DELETE", self.url, @@ -79,8 +82,8 @@ class PullRequestComment( GithubObject.GithubObject ): None ) - def edit( self, body ): - assert isinstance( body, ( str, unicode ) ), body + def edit(self, body): + assert isinstance(body, (str, unicode)), body post_parameters = { "body": body, } @@ -90,52 +93,52 @@ class PullRequestComment( GithubObject.GithubObject ): None, post_parameters ) - self._useAttributes( data ) + self._useAttributes(data) - def _initAttributes( self ): - self._body = GithubObject.NotSet - self._commit_id = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._id = GithubObject.NotSet - self._original_commit_id = GithubObject.NotSet - self._original_position = GithubObject.NotSet - self._path = GithubObject.NotSet - self._position = GithubObject.NotSet - self._updated_at = GithubObject.NotSet - self._url = GithubObject.NotSet - self._user = GithubObject.NotSet + def _initAttributes(self): + self._body = github.GithubObject.NotSet + self._commit_id = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._original_commit_id = github.GithubObject.NotSet + self._original_position = github.GithubObject.NotSet + self._path = github.GithubObject.NotSet + self._position = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + self._user = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "body" in attributes: # pragma no branch - assert attributes[ "body" ] is None or isinstance( attributes[ "body" ], ( str, unicode ) ), attributes[ "body" ] - self._body = attributes[ "body" ] - if "commit_id" in attributes: # pragma no branch - assert attributes[ "commit_id" ] is None or isinstance( attributes[ "commit_id" ], ( str, unicode ) ), attributes[ "commit_id" ] - self._commit_id = attributes[ "commit_id" ] - if "created_at" in attributes: # pragma no branch - assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = self._parseDatetime( attributes[ "created_at" ] ) - if "id" in attributes: # pragma no branch - assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] - self._id = attributes[ "id" ] - if "original_commit_id" in attributes: # pragma no branch - assert attributes[ "original_commit_id" ] is None or isinstance( attributes[ "original_commit_id" ], ( str, unicode ) ), attributes[ "original_commit_id" ] - self._original_commit_id = attributes[ "original_commit_id" ] - if "original_position" in attributes: # pragma no branch - assert attributes[ "original_position" ] is None or isinstance( attributes[ "original_position" ], int ), attributes[ "original_position" ] - self._original_position = attributes[ "original_position" ] - if "path" in attributes: # pragma no branch - assert attributes[ "path" ] is None or isinstance( attributes[ "path" ], ( str, unicode ) ), attributes[ "path" ] - self._path = attributes[ "path" ] - if "position" in attributes: # pragma no branch - assert attributes[ "position" ] is None or isinstance( attributes[ "position" ], int ), attributes[ "position" ] - self._position = attributes[ "position" ] - if "updated_at" in attributes: # pragma no branch - assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ] - self._updated_at = self._parseDatetime( attributes[ "updated_at" ] ) - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] - if "user" in attributes: # pragma no branch - assert attributes[ "user" ] is None or isinstance( attributes[ "user" ], dict ), attributes[ "user" ] - self._user = None if attributes[ "user" ] is None else NamedUser.NamedUser( self._requester, attributes[ "user" ], completed = False ) + def _useAttributes(self, attributes): + if "body" in attributes: # pragma no branch + assert attributes["body"] is None or isinstance(attributes["body"], (str, unicode)), attributes["body"] + self._body = attributes["body"] + if "commit_id" in attributes: # pragma no branch + assert attributes["commit_id"] is None or isinstance(attributes["commit_id"], (str, unicode)), attributes["commit_id"] + self._commit_id = attributes["commit_id"] + if "created_at" in attributes: # pragma no branch + assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"] + self._created_at = self._parseDatetime(attributes["created_at"]) + if "id" in attributes: # pragma no branch + assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] + self._id = attributes["id"] + if "original_commit_id" in attributes: # pragma no branch + assert attributes["original_commit_id"] is None or isinstance(attributes["original_commit_id"], (str, unicode)), attributes["original_commit_id"] + self._original_commit_id = attributes["original_commit_id"] + if "original_position" in attributes: # pragma no branch + assert attributes["original_position"] is None or isinstance(attributes["original_position"], (int, long)), attributes["original_position"] + self._original_position = attributes["original_position"] + if "path" in attributes: # pragma no branch + assert attributes["path"] is None or isinstance(attributes["path"], (str, unicode)), attributes["path"] + self._path = attributes["path"] + if "position" in attributes: # pragma no branch + assert attributes["position"] is None or isinstance(attributes["position"], (int, long)), attributes["position"] + self._position = attributes["position"] + if "updated_at" in attributes: # pragma no branch + assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], (str, unicode)), attributes["updated_at"] + self._updated_at = self._parseDatetime(attributes["updated_at"]) + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] + if "user" in attributes: # pragma no branch + assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"] + self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False) diff --git a/github/PullRequestMergeStatus.py b/github/PullRequestMergeStatus.py index c1e8c859..4e2a6eb8 100644 --- a/github/PullRequestMergeStatus.py +++ b/github/PullRequestMergeStatus.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,33 +13,34 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class PullRequestMergeStatus( GithubObject.BasicGithubObject ): + +class PullRequestMergeStatus(github.GithubObject.BasicGithubObject): @property - def merged( self ): - return self._NoneIfNotSet( self._merged ) + def merged(self): + return self._NoneIfNotSet(self._merged) @property - def message( self ): - return self._NoneIfNotSet( self._message ) + def message(self): + return self._NoneIfNotSet(self._message) @property - def sha( self ): - return self._NoneIfNotSet( self._sha ) + def sha(self): + return self._NoneIfNotSet(self._sha) - def _initAttributes( self ): - self._merged = GithubObject.NotSet - self._message = GithubObject.NotSet - self._sha = GithubObject.NotSet + def _initAttributes(self): + self._merged = github.GithubObject.NotSet + self._message = github.GithubObject.NotSet + self._sha = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "merged" in attributes: # pragma no branch - assert attributes[ "merged" ] is None or isinstance( attributes[ "merged" ], bool ), attributes[ "merged" ] - self._merged = attributes[ "merged" ] - if "message" in attributes: # pragma no branch - assert attributes[ "message" ] is None or isinstance( attributes[ "message" ], ( str, unicode ) ), attributes[ "message" ] - self._message = attributes[ "message" ] - if "sha" in attributes: # pragma no branch - assert attributes[ "sha" ] is None or isinstance( attributes[ "sha" ], ( str, unicode ) ), attributes[ "sha" ] - self._sha = attributes[ "sha" ] + def _useAttributes(self, attributes): + if "merged" in attributes: # pragma no branch + assert attributes["merged"] is None or isinstance(attributes["merged"], bool), attributes["merged"] + self._merged = attributes["merged"] + if "message" in attributes: # pragma no branch + assert attributes["message"] is None or isinstance(attributes["message"], (str, unicode)), attributes["message"] + self._message = attributes["message"] + if "sha" in attributes: # pragma no branch + assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"] + self._sha = attributes["sha"] diff --git a/github/PullRequestPart.py b/github/PullRequestPart.py index 877a8a49..10d1be55 100644 --- a/github/PullRequestPart.py +++ b/github/PullRequestPart.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,52 +13,53 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import Repository -import NamedUser +import github.Repository +import github.NamedUser -class PullRequestPart( GithubObject.BasicGithubObject ): + +class PullRequestPart(github.GithubObject.BasicGithubObject): @property - def label( self ): - return self._NoneIfNotSet( self._label ) + def label(self): + return self._NoneIfNotSet(self._label) @property - def ref( self ): - return self._NoneIfNotSet( self._ref ) + def ref(self): + return self._NoneIfNotSet(self._ref) @property - def repo( self ): - return self._NoneIfNotSet( self._repo ) + def repo(self): + return self._NoneIfNotSet(self._repo) @property - def sha( self ): - return self._NoneIfNotSet( self._sha ) + def sha(self): + return self._NoneIfNotSet(self._sha) @property - def user( self ): - return self._NoneIfNotSet( self._user ) + def user(self): + return self._NoneIfNotSet(self._user) - def _initAttributes( self ): - self._label = GithubObject.NotSet - self._ref = GithubObject.NotSet - self._repo = GithubObject.NotSet - self._sha = GithubObject.NotSet - self._user = GithubObject.NotSet + def _initAttributes(self): + self._label = github.GithubObject.NotSet + self._ref = github.GithubObject.NotSet + self._repo = github.GithubObject.NotSet + self._sha = github.GithubObject.NotSet + self._user = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "label" in attributes: # pragma no branch - assert attributes[ "label" ] is None or isinstance( attributes[ "label" ], ( str, unicode ) ), attributes[ "label" ] - self._label = attributes[ "label" ] - if "ref" in attributes: # pragma no branch - assert attributes[ "ref" ] is None or isinstance( attributes[ "ref" ], ( str, unicode ) ), attributes[ "ref" ] - self._ref = attributes[ "ref" ] - if "repo" in attributes: # pragma no branch - assert attributes[ "repo" ] is None or isinstance( attributes[ "repo" ], dict ), attributes[ "repo" ] - self._repo = None if attributes[ "repo" ] is None else Repository.Repository( self._requester, attributes[ "repo" ], completed = False ) - if "sha" in attributes: # pragma no branch - assert attributes[ "sha" ] is None or isinstance( attributes[ "sha" ], ( str, unicode ) ), attributes[ "sha" ] - self._sha = attributes[ "sha" ] - if "user" in attributes: # pragma no branch - assert attributes[ "user" ] is None or isinstance( attributes[ "user" ], dict ), attributes[ "user" ] - self._user = None if attributes[ "user" ] is None else NamedUser.NamedUser( self._requester, attributes[ "user" ], completed = False ) + def _useAttributes(self, attributes): + if "label" in attributes: # pragma no branch + assert attributes["label"] is None or isinstance(attributes["label"], (str, unicode)), attributes["label"] + self._label = attributes["label"] + if "ref" in attributes: # pragma no branch + assert attributes["ref"] is None or isinstance(attributes["ref"], (str, unicode)), attributes["ref"] + self._ref = attributes["ref"] + if "repo" in attributes: # pragma no branch + assert attributes["repo"] is None or isinstance(attributes["repo"], dict), attributes["repo"] + self._repo = None if attributes["repo"] is None else github.Repository.Repository(self._requester, attributes["repo"], completed=False) + if "sha" in attributes: # pragma no branch + assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"] + self._sha = attributes["sha"] + if "user" in attributes: # pragma no branch + assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"] + self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, attributes["user"], completed=False) diff --git a/github/Repository.py b/github/Repository.py index 811ffbc9..a92870a4 100644 --- a/github/Repository.py +++ b/github/Repository.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -14,191 +16,190 @@ import urllib import datetime -import GithubObject -import PaginatedList +import github.GithubObject +import github.PaginatedList -import Branch -import IssueEvent -import ContentFile -import Label -import InputGitAuthor -import GitBlob -import Organization -import GitRef -import Issue -import Repository -import PullRequest -import RepositoryKey -import NamedUser -import Milestone -import InputGitTreeElement -import Comparison -import CommitComment -import GitCommit -import Team -import Commit -import GitTree -import Hook -import Tag -import GitTag -import Download -import Permissions -import Event -import Legacy +import github.Branch +import github.IssueEvent +import github.ContentFile +import github.Label +import github.GitBlob +import github.Organization +import github.GitRef +import github.Issue +import github.Repository +import github.PullRequest +import github.RepositoryKey +import github.NamedUser +import github.Milestone +import github.Comparison +import github.CommitComment +import github.GitCommit +import github.Team +import github.Commit +import github.GitTree +import github.Hook +import github.Tag +import github.GitTag +import github.Download +import github.Permissions +import github.Event +import github.Legacy -class Repository( GithubObject.GithubObject ): + +class Repository(github.GithubObject.GithubObject): @property - def clone_url( self ): - self._completeIfNotSet( self._clone_url ) - return self._NoneIfNotSet( self._clone_url ) + def clone_url(self): + self._completeIfNotSet(self._clone_url) + return self._NoneIfNotSet(self._clone_url) @property - def created_at( self ): - self._completeIfNotSet( self._created_at ) - return self._NoneIfNotSet( self._created_at ) + def created_at(self): + self._completeIfNotSet(self._created_at) + return self._NoneIfNotSet(self._created_at) @property - def description( self ): - self._completeIfNotSet( self._description ) - return self._NoneIfNotSet( self._description ) + def description(self): + self._completeIfNotSet(self._description) + return self._NoneIfNotSet(self._description) @property - def fork( self ): - self._completeIfNotSet( self._fork ) - return self._NoneIfNotSet( self._fork ) + def fork(self): + self._completeIfNotSet(self._fork) + return self._NoneIfNotSet(self._fork) @property - def forks( self ): - self._completeIfNotSet( self._forks ) - return self._NoneIfNotSet( self._forks ) + def forks(self): + self._completeIfNotSet(self._forks) + return self._NoneIfNotSet(self._forks) @property - def full_name( self ): - self._completeIfNotSet( self._full_name ) - return self._NoneIfNotSet( self._full_name ) + def full_name(self): + self._completeIfNotSet(self._full_name) + return self._NoneIfNotSet(self._full_name) @property - def git_url( self ): - self._completeIfNotSet( self._git_url ) - return self._NoneIfNotSet( self._git_url ) + def git_url(self): + self._completeIfNotSet(self._git_url) + return self._NoneIfNotSet(self._git_url) @property - def has_downloads( self ): - self._completeIfNotSet( self._has_downloads ) - return self._NoneIfNotSet( self._has_downloads ) + def has_downloads(self): + self._completeIfNotSet(self._has_downloads) + return self._NoneIfNotSet(self._has_downloads) @property - def has_issues( self ): - self._completeIfNotSet( self._has_issues ) - return self._NoneIfNotSet( self._has_issues ) + def has_issues(self): + self._completeIfNotSet(self._has_issues) + return self._NoneIfNotSet(self._has_issues) @property - def has_wiki( self ): - self._completeIfNotSet( self._has_wiki ) - return self._NoneIfNotSet( self._has_wiki ) + def has_wiki(self): + self._completeIfNotSet(self._has_wiki) + return self._NoneIfNotSet(self._has_wiki) @property - def homepage( self ): - self._completeIfNotSet( self._homepage ) - return self._NoneIfNotSet( self._homepage ) + def homepage(self): + self._completeIfNotSet(self._homepage) + return self._NoneIfNotSet(self._homepage) @property - def html_url( self ): - self._completeIfNotSet( self._html_url ) - return self._NoneIfNotSet( self._html_url ) + def html_url(self): + self._completeIfNotSet(self._html_url) + return self._NoneIfNotSet(self._html_url) @property - def id( self ): - self._completeIfNotSet( self._id ) - return self._NoneIfNotSet( self._id ) + def id(self): + self._completeIfNotSet(self._id) + return self._NoneIfNotSet(self._id) @property - def language( self ): - self._completeIfNotSet( self._language ) - return self._NoneIfNotSet( self._language ) + def language(self): + self._completeIfNotSet(self._language) + return self._NoneIfNotSet(self._language) @property - def master_branch( self ): - self._completeIfNotSet( self._master_branch ) - return self._NoneIfNotSet( self._master_branch ) + def master_branch(self): + self._completeIfNotSet(self._master_branch) + return self._NoneIfNotSet(self._master_branch) @property - def name( self ): - self._completeIfNotSet( self._name ) - return self._NoneIfNotSet( self._name ) + def name(self): + self._completeIfNotSet(self._name) + return self._NoneIfNotSet(self._name) @property - def open_issues( self ): - self._completeIfNotSet( self._open_issues ) - return self._NoneIfNotSet( self._open_issues ) + def open_issues(self): + self._completeIfNotSet(self._open_issues) + return self._NoneIfNotSet(self._open_issues) @property - def organization( self ): - self._completeIfNotSet( self._organization ) - return self._NoneIfNotSet( self._organization ) + def organization(self): + self._completeIfNotSet(self._organization) + return self._NoneIfNotSet(self._organization) @property - def owner( self ): - self._completeIfNotSet( self._owner ) - return self._NoneIfNotSet( self._owner ) + def owner(self): + self._completeIfNotSet(self._owner) + return self._NoneIfNotSet(self._owner) @property - def parent( self ): - self._completeIfNotSet( self._parent ) - return self._NoneIfNotSet( self._parent ) + def parent(self): + self._completeIfNotSet(self._parent) + return self._NoneIfNotSet(self._parent) @property - def permissions( self ): - self._completeIfNotSet( self._permissions ) - return self._NoneIfNotSet( self._permissions ) + def permissions(self): + self._completeIfNotSet(self._permissions) + return self._NoneIfNotSet(self._permissions) @property - def private( self ): - self._completeIfNotSet( self._private ) - return self._NoneIfNotSet( self._private ) + def private(self): + self._completeIfNotSet(self._private) + return self._NoneIfNotSet(self._private) @property - def pushed_at( self ): - self._completeIfNotSet( self._pushed_at ) - return self._NoneIfNotSet( self._pushed_at ) + def pushed_at(self): + self._completeIfNotSet(self._pushed_at) + return self._NoneIfNotSet(self._pushed_at) @property - def size( self ): - self._completeIfNotSet( self._size ) - return self._NoneIfNotSet( self._size ) + def size(self): + self._completeIfNotSet(self._size) + return self._NoneIfNotSet(self._size) @property - def source( self ): - self._completeIfNotSet( self._source ) - return self._NoneIfNotSet( self._source ) + def source(self): + self._completeIfNotSet(self._source) + return self._NoneIfNotSet(self._source) @property - def ssh_url( self ): - self._completeIfNotSet( self._ssh_url ) - return self._NoneIfNotSet( self._ssh_url ) + def ssh_url(self): + self._completeIfNotSet(self._ssh_url) + return self._NoneIfNotSet(self._ssh_url) @property - def svn_url( self ): - self._completeIfNotSet( self._svn_url ) - return self._NoneIfNotSet( self._svn_url ) + def svn_url(self): + self._completeIfNotSet(self._svn_url) + return self._NoneIfNotSet(self._svn_url) @property - def updated_at( self ): - self._completeIfNotSet( self._updated_at ) - return self._NoneIfNotSet( self._updated_at ) + def updated_at(self): + self._completeIfNotSet(self._updated_at) + return self._NoneIfNotSet(self._updated_at) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) @property - def watchers( self ): - self._completeIfNotSet( self._watchers ) - return self._NoneIfNotSet( self._watchers ) + def watchers(self): + self._completeIfNotSet(self._watchers) + return self._NoneIfNotSet(self._watchers) - def add_to_collaborators( self, collaborator ): - assert isinstance( collaborator, NamedUser.NamedUser ), collaborator + def add_to_collaborators(self, collaborator): + assert isinstance(collaborator, github.NamedUser.NamedUser), collaborator headers, data = self._requester.requestAndCheck( "PUT", self.url + "/collaborators/" + collaborator._identity, @@ -206,41 +207,41 @@ class Repository( GithubObject.GithubObject ): None ) - def compare( self, base, head ): - assert isinstance( base, ( str, unicode ) ), base - assert isinstance( head, ( str, unicode ) ), head + def compare(self, base, head): + assert isinstance(base, (str, unicode)), base + assert isinstance(head, (str, unicode)), head headers, data = self._requester.requestAndCheck( "GET", self.url + "/compare/" + base + "..." + head, None, None ) - return Comparison.Comparison( self._requester, data, completed = True ) + return github.Comparison.Comparison(self._requester, data, completed=True) - def create_download( self, name, size, description = GithubObject.NotSet, content_type = GithubObject.NotSet ): - assert isinstance( name, ( str, unicode ) ), name - assert isinstance( size, int ), size - assert description is GithubObject.NotSet or isinstance( description, ( str, unicode ) ), description - assert content_type is GithubObject.NotSet or isinstance( content_type, ( str, unicode ) ), content_type + def create_download(self, name, size, description=github.GithubObject.NotSet, content_type=github.GithubObject.NotSet): + assert isinstance(name, (str, unicode)), name + assert isinstance(size, (int, long)), size + assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description + assert content_type is github.GithubObject.NotSet or isinstance(content_type, (str, unicode)), content_type post_parameters = { "name": name, "size": size, } - if description is not GithubObject.NotSet: - post_parameters[ "description" ] = description - if content_type is not GithubObject.NotSet: - post_parameters[ "content_type" ] = content_type + if description is not github.GithubObject.NotSet: + post_parameters["description"] = description + if content_type is not github.GithubObject.NotSet: + post_parameters["content_type"] = content_type headers, data = self._requester.requestAndCheck( "POST", self.url + "/downloads", None, post_parameters ) - return Download.Download( self._requester, data, completed = True ) + return github.Download.Download(self._requester, data, completed=True) - def create_git_blob( self, content, encoding ): - assert isinstance( content, ( str, unicode ) ), content - assert isinstance( encoding, ( str, unicode ) ), encoding + def create_git_blob(self, content, encoding): + assert isinstance(content, (str, unicode)), content + assert isinstance(encoding, (str, unicode)), encoding post_parameters = { "content": content, "encoding": encoding, @@ -251,34 +252,34 @@ class Repository( GithubObject.GithubObject ): None, post_parameters ) - return GitBlob.GitBlob( self._requester, data, completed = True ) + return github.GitBlob.GitBlob(self._requester, data, completed=True) - def create_git_commit( self, message, tree, parents, author = GithubObject.NotSet, committer = GithubObject.NotSet ): - assert isinstance( message, ( str, unicode ) ), message - 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 + def create_git_commit(self, message, tree, parents, author=github.GithubObject.NotSet, committer=github.GithubObject.NotSet): + assert isinstance(message, (str, unicode)), message + assert isinstance(tree, github.GitTree.GitTree), tree + assert all(isinstance(element, github.GitCommit.GitCommit) for element in parents), parents + assert author is github.GithubObject.NotSet or isinstance(author, github.InputGitAuthor), author + assert committer is github.GithubObject.NotSet or isinstance(committer, github.InputGitAuthor), committer post_parameters = { "message": message, "tree": tree._identity, - "parents": [ element._identity for element in parents ], + "parents": [element._identity for element in parents], } - if author is not GithubObject.NotSet: - post_parameters[ "author" ] = author._identity - if committer is not GithubObject.NotSet: - post_parameters[ "committer" ] = committer._identity + if author is not github.GithubObject.NotSet: + post_parameters["author"] = author._identity + if committer is not github.GithubObject.NotSet: + post_parameters["committer"] = committer._identity headers, data = self._requester.requestAndCheck( "POST", self.url + "/git/commits", None, post_parameters ) - return GitCommit.GitCommit( self._requester, data, completed = True ) + return github.GitCommit.GitCommit(self._requester, data, completed=True) - def create_git_ref( self, ref, sha ): - assert isinstance( ref, ( str, unicode ) ), ref - assert isinstance( sha, ( str, unicode ) ), sha + def create_git_ref(self, ref, sha): + assert isinstance(ref, (str, unicode)), ref + assert isinstance(sha, (str, unicode)), sha post_parameters = { "ref": ref, "sha": sha, @@ -289,95 +290,95 @@ class Repository( GithubObject.GithubObject ): None, post_parameters ) - return GitRef.GitRef( self._requester, data, completed = True ) + return github.GitRef.GitRef(self._requester, data, completed=True) - def create_git_tag( self, tag, message, object, type, tagger = GithubObject.NotSet ): - assert isinstance( tag, ( str, unicode ) ), tag - assert isinstance( message, ( str, unicode ) ), message - assert isinstance( object, ( str, unicode ) ), object - assert isinstance( type, ( str, unicode ) ), type - assert tagger is GithubObject.NotSet or isinstance( tagger, InputGitAuthor.InputGitAuthor ), tagger + def create_git_tag(self, tag, message, object, type, tagger=github.GithubObject.NotSet): + assert isinstance(tag, (str, unicode)), tag + assert isinstance(message, (str, unicode)), message + assert isinstance(object, (str, unicode)), object + assert isinstance(type, (str, unicode)), type + assert tagger is github.GithubObject.NotSet or isinstance(tagger, github.InputGitAuthor), tagger post_parameters = { "tag": tag, "message": message, "object": object, "type": type, } - if tagger is not GithubObject.NotSet: - post_parameters[ "tagger" ] = tagger._identity + if tagger is not github.GithubObject.NotSet: + post_parameters["tagger"] = tagger._identity headers, data = self._requester.requestAndCheck( "POST", self.url + "/git/tags", None, post_parameters ) - return GitTag.GitTag( self._requester, data, completed = True ) + return github.GitTag.GitTag(self._requester, data, completed=True) - 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, GitTree.GitTree ), base_tree + def create_git_tree(self, tree, base_tree=github.GithubObject.NotSet): + assert all(isinstance(element, github.InputGitTreeElement) for element in tree), tree + assert base_tree is github.GithubObject.NotSet or isinstance(base_tree, github.GitTree.GitTree), base_tree post_parameters = { - "tree": [ element._identity for element in tree ], + "tree": [element._identity for element in tree], } - if base_tree is not GithubObject.NotSet: - post_parameters[ "base_tree" ] = base_tree._identity + if base_tree is not github.GithubObject.NotSet: + post_parameters["base_tree"] = base_tree._identity headers, data = self._requester.requestAndCheck( "POST", self.url + "/git/trees", None, post_parameters ) - return GitTree.GitTree( self._requester, data, completed = True ) + return github.GitTree.GitTree(self._requester, data, completed=True) - def create_hook( self, name, config, events = GithubObject.NotSet, active = GithubObject.NotSet ): - assert isinstance( name, ( str, unicode ) ), name - assert isinstance( config, dict ), config - assert events is GithubObject.NotSet or all( isinstance( element, ( str, unicode ) ) for element in events ), events - assert active is GithubObject.NotSet or isinstance( active, bool ), active + def create_hook(self, name, config, events=github.GithubObject.NotSet, active=github.GithubObject.NotSet): + assert isinstance(name, (str, unicode)), name + assert isinstance(config, dict), config + assert events is github.GithubObject.NotSet or all(isinstance(element, (str, unicode)) for element in events), events + assert active is github.GithubObject.NotSet or isinstance(active, bool), active post_parameters = { "name": name, "config": config, } - if events is not GithubObject.NotSet: - post_parameters[ "events" ] = events - if active is not GithubObject.NotSet: - post_parameters[ "active" ] = active + if events is not github.GithubObject.NotSet: + post_parameters["events"] = events + if active is not github.GithubObject.NotSet: + post_parameters["active"] = active headers, data = self._requester.requestAndCheck( "POST", self.url + "/hooks", None, post_parameters ) - return Hook.Hook( self._requester, data, completed = True ) + return github.Hook.Hook(self._requester, data, completed=True) - 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, 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 + def create_issue(self, title, body=github.GithubObject.NotSet, assignee=github.GithubObject.NotSet, milestone=github.GithubObject.NotSet, labels=github.GithubObject.NotSet): + assert isinstance(title, (str, unicode)), title + assert body is github.GithubObject.NotSet or isinstance(body, (str, unicode)), body + assert assignee is github.GithubObject.NotSet or isinstance(assignee, github.NamedUser.NamedUser), assignee + assert milestone is github.GithubObject.NotSet or isinstance(milestone, github.Milestone.Milestone), milestone + assert labels is github.GithubObject.NotSet or all(isinstance(element, github.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._identity - if milestone is not GithubObject.NotSet: - post_parameters[ "milestone" ] = milestone._identity - if labels is not GithubObject.NotSet: - post_parameters[ "labels" ] = [ element.name for element in labels ] + if body is not github.GithubObject.NotSet: + post_parameters["body"] = body + if assignee is not github.GithubObject.NotSet: + post_parameters["assignee"] = assignee._identity + if milestone is not github.GithubObject.NotSet: + post_parameters["milestone"] = milestone._identity + if labels is not github.GithubObject.NotSet: + post_parameters["labels"] = [element.name for element in labels] headers, data = self._requester.requestAndCheck( "POST", self.url + "/issues", None, post_parameters ) - return Issue.Issue( self._requester, data, completed = True ) + return github.Issue.Issue(self._requester, data, completed=True) - def create_key( self, title, key ): - assert isinstance( title, ( str, unicode ) ), title - assert isinstance( key, ( str, unicode ) ), key + def create_key(self, title, key): + assert isinstance(title, (str, unicode)), title + assert isinstance(key, (str, unicode)), key post_parameters = { "title": title, "key": key, @@ -388,11 +389,11 @@ class Repository( GithubObject.GithubObject ): None, post_parameters ) - return RepositoryKey.RepositoryKey( self._requester, data, completed = True, repoUrl = self._url ) + return github.RepositoryKey.RepositoryKey(self._requester, data, completed=True, repoUrl=self._url) - def create_label( self, name, color ): - assert isinstance( name, ( str, unicode ) ), name - assert isinstance( color, ( str, unicode ) ), color + def create_label(self, name, color): + assert isinstance(name, (str, unicode)), name + assert isinstance(color, (str, unicode)), color post_parameters = { "name": name, "color": color, @@ -403,50 +404,50 @@ class Repository( GithubObject.GithubObject ): None, post_parameters ) - return Label.Label( self._requester, data, completed = True ) + return github.Label.Label(self._requester, data, completed=True) - def create_milestone( self, title, state = GithubObject.NotSet, description = GithubObject.NotSet, due_on = GithubObject.NotSet ): - assert isinstance( title, ( str, unicode ) ), title - assert state is GithubObject.NotSet or isinstance( state, ( str, unicode ) ), state - assert description is GithubObject.NotSet or isinstance( description, ( str, unicode ) ), description - assert due_on is GithubObject.NotSet or isinstance( due_on, datetime.date ), due_on + def create_milestone(self, title, state=github.GithubObject.NotSet, description=github.GithubObject.NotSet, due_on=github.GithubObject.NotSet): + assert isinstance(title, (str, unicode)), title + assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state + assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description + assert due_on is github.GithubObject.NotSet or isinstance(due_on, datetime.date), due_on post_parameters = { "title": title, } - if state is not GithubObject.NotSet: - post_parameters[ "state" ] = state - if description is not GithubObject.NotSet: - post_parameters[ "description" ] = description - if due_on is not GithubObject.NotSet: - post_parameters[ "due_on" ] = due_on.strftime( "%Y-%m-%d" ) + if state is not github.GithubObject.NotSet: + post_parameters["state"] = state + if description is not github.GithubObject.NotSet: + post_parameters["description"] = description + if due_on is not github.GithubObject.NotSet: + post_parameters["due_on"] = due_on.strftime("%Y-%m-%d") headers, data = self._requester.requestAndCheck( "POST", self.url + "/milestones", None, post_parameters ) - return Milestone.Milestone( self._requester, data, completed = True ) + return github.Milestone.Milestone(self._requester, data, completed=True) - def create_pull( self, *args, **kwds ): - if len( args ) + len( kwds ) == 4: - return self.__create_pull_1( *args, **kwds ) + def create_pull(self, *args, **kwds): + if len(args) + len(kwds) == 4: + return self.__create_pull_1(*args, **kwds) else: - return self.__create_pull_2( *args, **kwds ) + return self.__create_pull_2(*args, **kwds) - def __create_pull_1( self, title, body, base, head ): - assert isinstance( title, ( str, unicode ) ), title - assert isinstance( body, ( str, unicode ) ), body - assert isinstance( base, ( str, unicode ) ), base - assert isinstance( head, ( str, unicode ) ), head - return self.__create_pull( title = title, body = body, base = base, head = head ) + def __create_pull_1(self, title, body, base, head): + assert isinstance(title, (str, unicode)), title + assert isinstance(body, (str, unicode)), body + assert isinstance(base, (str, unicode)), base + assert isinstance(head, (str, unicode)), head + return self.__create_pull(title=title, body=body, base=base, head=head) - def __create_pull_2( self, issue, base, head ): - assert isinstance( issue, Issue.Issue ), issue - assert isinstance( base, ( str, unicode ) ), base - assert isinstance( head, ( str, unicode ) ), head - return self.__create_pull( issue = issue._identity, base = base, head = head ) + def __create_pull_2(self, issue, base, head): + assert isinstance(issue, github.Issue.Issue), issue + assert isinstance(base, (str, unicode)), base + assert isinstance(head, (str, unicode)), head + return self.__create_pull(issue=issue._identity, base=base, head=head) - def __create_pull( self, **kwds ): + def __create_pull(self, **kwds): post_parameters = kwds headers, data = self._requester.requestAndCheck( "POST", @@ -454,9 +455,9 @@ class Repository( GithubObject.GithubObject ): None, post_parameters ) - return PullRequest.PullRequest( self._requester, data, completed = True ) + return github.PullRequest.PullRequest(self._requester, data, completed=True) - def delete( self ): + def delete(self): headers, data = self._requester.requestAndCheck( "DELETE", self.url, @@ -464,42 +465,45 @@ class Repository( GithubObject.GithubObject ): None ) - def edit( self, name, description = GithubObject.NotSet, homepage = GithubObject.NotSet, public = GithubObject.NotSet, has_issues = GithubObject.NotSet, has_wiki = GithubObject.NotSet, has_downloads = GithubObject.NotSet ): - assert isinstance( name, ( str, unicode ) ), name - assert description is GithubObject.NotSet or isinstance( description, ( str, unicode ) ), description - assert homepage is GithubObject.NotSet or isinstance( homepage, ( str, unicode ) ), homepage - assert public is GithubObject.NotSet or isinstance( public, bool ), public - 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 + def edit(self, name, description=github.GithubObject.NotSet, homepage=github.GithubObject.NotSet, public=github.GithubObject.NotSet, has_issues=github.GithubObject.NotSet, has_wiki=github.GithubObject.NotSet, has_downloads=github.GithubObject.NotSet, default_branch=github.GithubObject.NotSet): + assert isinstance(name, (str, unicode)), name + assert description is github.GithubObject.NotSet or isinstance(description, (str, unicode)), description + assert homepage is github.GithubObject.NotSet or isinstance(homepage, (str, unicode)), homepage + assert public is github.GithubObject.NotSet or isinstance(public, bool), public + assert has_issues is github.GithubObject.NotSet or isinstance(has_issues, bool), has_issues + assert has_wiki is github.GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki + assert has_downloads is github.GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads + assert default_branch is github.GithubObject.NotSet or isinstance(default_branch, (str, unicode)), default_branch post_parameters = { "name": name, } - if description is not GithubObject.NotSet: - post_parameters[ "description" ] = description - if homepage is not GithubObject.NotSet: - post_parameters[ "homepage" ] = homepage - if public is not GithubObject.NotSet: - post_parameters[ "public" ] = public - if has_issues is not GithubObject.NotSet: - post_parameters[ "has_issues" ] = has_issues - if has_wiki is not GithubObject.NotSet: - post_parameters[ "has_wiki" ] = has_wiki - if has_downloads is not GithubObject.NotSet: - post_parameters[ "has_downloads" ] = has_downloads + if description is not github.GithubObject.NotSet: + post_parameters["description"] = description + if homepage is not github.GithubObject.NotSet: + post_parameters["homepage"] = homepage + if public is not github.GithubObject.NotSet: + post_parameters["public"] = public + if has_issues is not github.GithubObject.NotSet: + post_parameters["has_issues"] = has_issues + if has_wiki is not github.GithubObject.NotSet: + post_parameters["has_wiki"] = has_wiki + if has_downloads is not github.GithubObject.NotSet: + post_parameters["has_downloads"] = has_downloads + if default_branch is not github.GithubObject.NotSet: + post_parameters["default_branch"] = default_branch headers, data = self._requester.requestAndCheck( "PATCH", self.url, None, post_parameters ) - self._useAttributes( data ) + self._useAttributes(data) - def get_archive_link( self, archive_format, ref = GithubObject.NotSet ): - assert isinstance( archive_format, ( str, unicode ) ), archive_format - assert ref is GithubObject.NotSet or isinstance( ref, ( str, unicode ) ), ref + def get_archive_link(self, archive_format, ref=github.GithubObject.NotSet): + assert isinstance(archive_format, (str, unicode)), archive_format + assert ref is github.GithubObject.NotSet or isinstance(ref, (str, unicode)), ref url = self.url + "/" + archive_format - if ref is not GithubObject.NotSet: + if ref is not github.GithubObject.NotSet: url += "/" + ref headers, data = self._requester.requestAndCheck( "GET", @@ -507,321 +511,324 @@ class Repository( GithubObject.GithubObject ): None, None ) - return headers[ "location" ] + return headers["location"] - def get_assignees( self ): - return PaginatedList.PaginatedList( - NamedUser.NamedUser, + def get_assignees(self): + return github.PaginatedList.PaginatedList( + github.NamedUser.NamedUser, self._requester, self.url + "/assignees", None ) - def get_branch( self, branch ): - assert isinstance( branch, ( str, unicode ) ), branch + def get_branch(self, branch): + assert isinstance(branch, (str, unicode)), branch headers, data = self._requester.requestAndCheck( "GET", self.url + "/branches/" + branch, None, None ) - return Branch.Branch( self._requester, data, completed = True ) + return github.Branch.Branch(self._requester, data, completed=True) - def get_branches( self ): - return PaginatedList.PaginatedList( - Branch.Branch, + def get_branches(self): + return github.PaginatedList.PaginatedList( + github.Branch.Branch, self._requester, self.url + "/branches", None ) - def get_collaborators( self ): - return PaginatedList.PaginatedList( - NamedUser.NamedUser, + def get_collaborators(self): + return github.PaginatedList.PaginatedList( + github.NamedUser.NamedUser, self._requester, self.url + "/collaborators", None ) - def get_comment( self, id ): - assert isinstance( id, int ), id + def get_comment(self, id): + assert isinstance(id, (int, long)), id headers, data = self._requester.requestAndCheck( "GET", - self.url + "/comments/" + str( id ), + self.url + "/comments/" + str(id), None, None ) - return CommitComment.CommitComment( self._requester, data, completed = True ) + return github.CommitComment.CommitComment(self._requester, data, completed=True) - def get_comments( self ): - return PaginatedList.PaginatedList( - CommitComment.CommitComment, + def get_comments(self): + return github.PaginatedList.PaginatedList( + github.CommitComment.CommitComment, self._requester, self.url + "/comments", None ) - def get_commit( self, sha ): - assert isinstance( sha, ( str, unicode ) ), sha + def get_commit(self, sha): + assert isinstance(sha, (str, unicode)), sha headers, data = self._requester.requestAndCheck( "GET", self.url + "/commits/" + sha, None, None ) - return Commit.Commit( self._requester, data, completed = True ) + return github.Commit.Commit(self._requester, data, completed=True) - def get_commits( self, sha = GithubObject.NotSet, path = GithubObject.NotSet ): - assert sha is GithubObject.NotSet or isinstance( sha, ( str, unicode ) ), sha - assert path is GithubObject.NotSet or isinstance( path, ( str, unicode ) ), path + def get_commits(self, sha=github.GithubObject.NotSet, path=github.GithubObject.NotSet): + assert sha is github.GithubObject.NotSet or isinstance(sha, (str, unicode)), sha + assert path is github.GithubObject.NotSet or isinstance(path, (str, unicode)), path url_parameters = dict() - if sha is not GithubObject.NotSet: - url_parameters[ "sha" ] = sha - if path is not GithubObject.NotSet: - url_parameters[ "path" ] = path - return PaginatedList.PaginatedList( - Commit.Commit, + if sha is not github.GithubObject.NotSet: + url_parameters["sha"] = sha + if path is not github.GithubObject.NotSet: + url_parameters["path"] = path + return github.PaginatedList.PaginatedList( + github.Commit.Commit, self._requester, self.url + "/commits", url_parameters ) - def get_contents( self, path ): - assert isinstance( path, ( str, unicode ) ), path + def get_contents(self, path): + assert isinstance(path, (str, unicode)), path headers, data = self._requester.requestAndCheck( "GET", self.url + "/contents" + path, None, None ) - return ContentFile.ContentFile( self._requester, data, completed = True ) + return github.ContentFile.ContentFile(self._requester, data, completed=True) - def get_contributors( self ): - return PaginatedList.PaginatedList( - NamedUser.NamedUser, + def get_contributors(self): + return github.PaginatedList.PaginatedList( + github.NamedUser.NamedUser, self._requester, self.url + "/contributors", None ) - def get_download( self, id ): - assert isinstance( id, int ), id + def get_download(self, id): + assert isinstance(id, (int, long)), id headers, data = self._requester.requestAndCheck( "GET", - self.url + "/downloads/" + str( id ), + self.url + "/downloads/" + str(id), None, None ) - return Download.Download( self._requester, data, completed = True ) + return github.Download.Download(self._requester, data, completed=True) - def get_downloads( self ): - return PaginatedList.PaginatedList( - Download.Download, + def get_downloads(self): + return github.PaginatedList.PaginatedList( + github.Download.Download, self._requester, self.url + "/downloads", None ) - def get_events( self ): - return PaginatedList.PaginatedList( - Event.Event, + def get_events(self): + return github.PaginatedList.PaginatedList( + github.Event.Event, self._requester, self.url + "/events", None ) - def get_forks( self ): - return PaginatedList.PaginatedList( + def get_forks(self): + return github.PaginatedList.PaginatedList( Repository, self._requester, self.url + "/forks", None ) - def get_git_blob( self, sha ): - assert isinstance( sha, ( str, unicode ) ), sha + def get_git_blob(self, sha): + assert isinstance(sha, (str, unicode)), sha headers, data = self._requester.requestAndCheck( "GET", self.url + "/git/blobs/" + sha, None, None ) - return GitBlob.GitBlob( self._requester, data, completed = True ) + return github.GitBlob.GitBlob(self._requester, data, completed=True) - def get_git_commit( self, sha ): - assert isinstance( sha, ( str, unicode ) ), sha + def get_git_commit(self, sha): + assert isinstance(sha, (str, unicode)), sha headers, data = self._requester.requestAndCheck( "GET", self.url + "/git/commits/" + sha, None, None ) - return GitCommit.GitCommit( self._requester, data, completed = True ) + return github.GitCommit.GitCommit(self._requester, data, completed=True) - def get_git_ref( self, ref ): - assert isinstance( ref, ( str, unicode ) ), ref + def get_git_ref(self, ref): + prefix = "/git/refs/" + if not self._requester.FIX_REPO_GET_GIT_REF: + prefix = "/git/" + assert isinstance(ref, (str, unicode)), ref headers, data = self._requester.requestAndCheck( "GET", - self.url + "/git/" + ref, + self.url + prefix + ref, None, None ) - return GitRef.GitRef( self._requester, data, completed = True ) + return github.GitRef.GitRef(self._requester, data, completed=True) - def get_git_refs( self ): - return PaginatedList.PaginatedList( - GitRef.GitRef, + def get_git_refs(self): + return github.PaginatedList.PaginatedList( + github.GitRef.GitRef, self._requester, self.url + "/git/refs", None ) - def get_git_tag( self, sha ): - assert isinstance( sha, ( str, unicode ) ), sha + def get_git_tag(self, sha): + assert isinstance(sha, (str, unicode)), sha headers, data = self._requester.requestAndCheck( "GET", self.url + "/git/tags/" + sha, None, None ) - return GitTag.GitTag( self._requester, data, completed = True ) + return github.GitTag.GitTag(self._requester, data, completed=True) - def get_git_tree( self, sha, recursive = GithubObject.NotSet ): - assert isinstance( sha, ( str, unicode ) ), sha - assert recursive is GithubObject.NotSet or isinstance( recursive, bool ), recursive + def get_git_tree(self, sha, recursive=github.GithubObject.NotSet): + assert isinstance(sha, (str, unicode)), sha + assert recursive is github.GithubObject.NotSet or isinstance(recursive, bool), recursive url_parameters = dict() - if recursive is not GithubObject.NotSet: - url_parameters[ "recursive" ] = recursive + if recursive is not github.GithubObject.NotSet: + url_parameters["recursive"] = recursive headers, data = self._requester.requestAndCheck( "GET", self.url + "/git/trees/" + sha, url_parameters, None ) - return GitTree.GitTree( self._requester, data, completed = True ) + return github.GitTree.GitTree(self._requester, data, completed=True) - def get_hook( self, id ): - assert isinstance( id, int ), id + def get_hook(self, id): + assert isinstance(id, (int, long)), id headers, data = self._requester.requestAndCheck( "GET", - self.url + "/hooks/" + str( id ), + self.url + "/hooks/" + str(id), None, None ) - return Hook.Hook( self._requester, data, completed = True ) + return github.Hook.Hook(self._requester, data, completed=True) - def get_hooks( self ): - return PaginatedList.PaginatedList( - Hook.Hook, + def get_hooks(self): + return github.PaginatedList.PaginatedList( + github.Hook.Hook, self._requester, self.url + "/hooks", None ) - def get_issue( self, number ): - assert isinstance( number, int ), number + def get_issue(self, number): + assert isinstance(number, (int, long)), number headers, data = self._requester.requestAndCheck( "GET", - self.url + "/issues/" + str( number ), + self.url + "/issues/" + str(number), None, None ) - return Issue.Issue( self._requester, data, completed = True ) + return github.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 milestone == "*" or milestone == "none" or isinstance( milestone, Milestone.Milestone ), milestone - assert state is GithubObject.NotSet or isinstance( state, ( str, unicode ) ), state - assert assignee is GithubObject.NotSet or assignee == "*" or assignee == "none" 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, datetime.datetime ), since + def get_issues(self, milestone=github.GithubObject.NotSet, state=github.GithubObject.NotSet, assignee=github.GithubObject.NotSet, mentioned=github.GithubObject.NotSet, labels=github.GithubObject.NotSet, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet, since=github.GithubObject.NotSet): + assert milestone is github.GithubObject.NotSet or milestone == "*" or milestone == "none" or isinstance(milestone, github.Milestone.Milestone), milestone + assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state + assert assignee is github.GithubObject.NotSet or assignee == "*" or assignee == "none" or isinstance(assignee, github.NamedUser.NamedUser), assignee + assert mentioned is github.GithubObject.NotSet or isinstance(mentioned, github.NamedUser.NamedUser), mentioned + assert labels is github.GithubObject.NotSet or all(isinstance(element, github.Label.Label) for element in labels), labels + assert sort is github.GithubObject.NotSet or isinstance(sort, (str, unicode)), sort + assert direction is github.GithubObject.NotSet or isinstance(direction, (str, unicode)), direction + assert since is github.GithubObject.NotSet or isinstance(since, datetime.datetime), since url_parameters = dict() - if milestone is not GithubObject.NotSet: - if isinstance( milestone, str ): - url_parameters[ "milestone" ] = milestone + if milestone is not github.GithubObject.NotSet: + if isinstance(milestone, str): + url_parameters["milestone"] = milestone else: - url_parameters[ "milestone" ] = milestone._identity - if state is not GithubObject.NotSet: - url_parameters[ "state" ] = state - if assignee is not GithubObject.NotSet: - if isinstance( assignee, str ): - url_parameters[ "assignee" ] = assignee + url_parameters["milestone"] = milestone._identity + if state is not github.GithubObject.NotSet: + url_parameters["state"] = state + if assignee is not github.GithubObject.NotSet: + if isinstance(assignee, str): + url_parameters["assignee"] = assignee else: - url_parameters[ "assignee" ] = assignee._identity - if mentioned is not GithubObject.NotSet: - url_parameters[ "mentioned" ] = mentioned._identity - if labels is not GithubObject.NotSet: - url_parameters[ "labels" ] = ",".join( label.name for label in labels ) - if sort is not GithubObject.NotSet: - url_parameters[ "sort" ] = sort - if direction is not GithubObject.NotSet: - url_parameters[ "direction" ] = direction - if since is not GithubObject.NotSet: - url_parameters[ "since" ] = since.strftime( "%Y-%m-%dT%H:%M:%SZ" ) - return PaginatedList.PaginatedList( - Issue.Issue, + url_parameters["assignee"] = assignee._identity + if mentioned is not github.GithubObject.NotSet: + url_parameters["mentioned"] = mentioned._identity + if labels is not github.GithubObject.NotSet: + url_parameters["labels"] = ",".join(label.name for label in labels) + if sort is not github.GithubObject.NotSet: + url_parameters["sort"] = sort + if direction is not github.GithubObject.NotSet: + url_parameters["direction"] = direction + if since is not github.GithubObject.NotSet: + url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ") + return github.PaginatedList.PaginatedList( + github.Issue.Issue, self._requester, self.url + "/issues", url_parameters ) - def get_issues_event( self, id ): - assert isinstance( id, int ), id + def get_issues_event(self, id): + assert isinstance(id, (int, long)), id headers, data = self._requester.requestAndCheck( "GET", - self.url + "/issues/events/" + str( id ), + self.url + "/issues/events/" + str(id), None, None ) - return IssueEvent.IssueEvent( self._requester, data, completed = True ) + return github.IssueEvent.IssueEvent(self._requester, data, completed=True) - def get_issues_events( self ): - return PaginatedList.PaginatedList( - IssueEvent.IssueEvent, + def get_issues_events(self): + return github.PaginatedList.PaginatedList( + github.IssueEvent.IssueEvent, self._requester, self.url + "/issues/events", None ) - def get_key( self, id ): - assert isinstance( id, int ), id + def get_key(self, id): + assert isinstance(id, (int, long)), id headers, data = self._requester.requestAndCheck( "GET", - self.url + "/keys/" + str( id ), + self.url + "/keys/" + str(id), None, None ) - return RepositoryKey.RepositoryKey( self._requester, data, completed = True, repoUrl = self._url ) + return github.RepositoryKey.RepositoryKey(self._requester, data, completed=True, repoUrl=self._url) - def get_keys( self ): - return PaginatedList.PaginatedList( - lambda requester, data, completed: RepositoryKey.RepositoryKey( requester, data, completed, repoUrl = self._url ), + def get_keys(self): + return github.PaginatedList.PaginatedList( + lambda requester, data, completed: github.RepositoryKey.RepositoryKey(requester, data, completed, repoUrl=self._url), self._requester, self.url + "/keys", None ) - def get_label( self, name ): - assert isinstance( name, ( str, unicode ) ), name + def get_label(self, name): + assert isinstance(name, (str, unicode)), name headers, data = self._requester.requestAndCheck( "GET", - self.url + "/labels/" + urllib.quote( name ), + self.url + "/labels/" + urllib.quote(name), None, None ) - return Label.Label( self._requester, data, completed = True ) + return github.Label.Label(self._requester, data, completed=True) - def get_labels( self ): - return PaginatedList.PaginatedList( - Label.Label, + def get_labels(self): + return github.PaginatedList.PaginatedList( + github.Label.Label, self._requester, self.url + "/labels", None ) - def get_languages( self ): + def get_languages(self): headers, data = self._requester.requestAndCheck( "GET", self.url + "/languages", @@ -830,115 +837,115 @@ class Repository( GithubObject.GithubObject ): ) return data - def get_milestone( self, number ): - assert isinstance( number, int ), number + def get_milestone(self, number): + assert isinstance(number, (int, long)), number headers, data = self._requester.requestAndCheck( "GET", - self.url + "/milestones/" + str( number ), + self.url + "/milestones/" + str(number), None, None ) - return Milestone.Milestone( self._requester, data, completed = True ) + return github.Milestone.Milestone(self._requester, data, completed=True) - def get_milestones( self, state = GithubObject.NotSet, sort = GithubObject.NotSet, direction = GithubObject.NotSet ): - assert state is GithubObject.NotSet or isinstance( state, ( str, unicode ) ), state - assert sort is GithubObject.NotSet or isinstance( sort, ( str, unicode ) ), sort - assert direction is GithubObject.NotSet or isinstance( direction, ( str, unicode ) ), direction + def get_milestones(self, state=github.GithubObject.NotSet, sort=github.GithubObject.NotSet, direction=github.GithubObject.NotSet): + assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state + assert sort is github.GithubObject.NotSet or isinstance(sort, (str, unicode)), sort + assert direction is github.GithubObject.NotSet or isinstance(direction, (str, unicode)), direction url_parameters = dict() - if state is not GithubObject.NotSet: - url_parameters[ "state" ] = state - if sort is not GithubObject.NotSet: - url_parameters[ "sort" ] = sort - if direction is not GithubObject.NotSet: - url_parameters[ "direction" ] = direction - return PaginatedList.PaginatedList( - Milestone.Milestone, + if state is not github.GithubObject.NotSet: + url_parameters["state"] = state + if sort is not github.GithubObject.NotSet: + url_parameters["sort"] = sort + if direction is not github.GithubObject.NotSet: + url_parameters["direction"] = direction + return github.PaginatedList.PaginatedList( + github.Milestone.Milestone, self._requester, self.url + "/milestones", url_parameters ) - def get_network_events( self ): - return PaginatedList.PaginatedList( - Event.Event, + def get_network_events(self): + return github.PaginatedList.PaginatedList( + github.Event.Event, self._requester, "/networks/" + self.owner.login + "/" + self.name + "/events", None ) - def get_pull( self, number ): - assert isinstance( number, int ), number + def get_pull(self, number): + assert isinstance(number, (int, long)), number headers, data = self._requester.requestAndCheck( "GET", - self.url + "/pulls/" + str( number ), + self.url + "/pulls/" + str(number), None, None ) - return PullRequest.PullRequest( self._requester, data, completed = True ) + return github.PullRequest.PullRequest(self._requester, data, completed=True) - def get_pulls( self, state = GithubObject.NotSet ): - assert state is GithubObject.NotSet or isinstance( state, ( str, unicode ) ), state + def get_pulls(self, state=github.GithubObject.NotSet): + assert state is github.GithubObject.NotSet or isinstance(state, (str, unicode)), state url_parameters = dict() - if state is not GithubObject.NotSet: - url_parameters[ "state" ] = state - return PaginatedList.PaginatedList( - PullRequest.PullRequest, + if state is not github.GithubObject.NotSet: + url_parameters["state"] = state + return github.PaginatedList.PaginatedList( + github.PullRequest.PullRequest, self._requester, self.url + "/pulls", url_parameters ) - def get_readme( self ): + def get_readme(self): headers, data = self._requester.requestAndCheck( "GET", self.url + "/readme", None, None ) - return ContentFile.ContentFile( self._requester, data, completed = True ) + return github.ContentFile.ContentFile(self._requester, data, completed=True) - def get_stargazers( self ): - return PaginatedList.PaginatedList( - NamedUser.NamedUser, + def get_stargazers(self): + return github.PaginatedList.PaginatedList( + github.NamedUser.NamedUser, self._requester, self.url + "/stargazers", None ) - def get_subscribers( self ): - return PaginatedList.PaginatedList( - NamedUser.NamedUser, + def get_subscribers(self): + return github.PaginatedList.PaginatedList( + github.NamedUser.NamedUser, self._requester, self.url + "/subscribers", None ) - def get_tags( self ): - return PaginatedList.PaginatedList( - Tag.Tag, + def get_tags(self): + return github.PaginatedList.PaginatedList( + github.Tag.Tag, self._requester, self.url + "/tags", None ) - def get_teams( self ): - return PaginatedList.PaginatedList( - Team.Team, + def get_teams(self): + return github.PaginatedList.PaginatedList( + github.Team.Team, self._requester, self.url + "/teams", None ) - def get_watchers( self ): - return PaginatedList.PaginatedList( - NamedUser.NamedUser, + def get_watchers(self): + return github.PaginatedList.PaginatedList( + github.NamedUser.NamedUser, self._requester, self.url + "/watchers", None ) - def has_in_assignees( self, assignee ): - assert isinstance( assignee, NamedUser.NamedUser ), assignee + def has_in_assignees(self, assignee): + assert isinstance(assignee, github.NamedUser.NamedUser), assignee status, headers, data = self._requester.requestRaw( "GET", self.url + "/assignees/" + assignee._identity, @@ -947,8 +954,8 @@ class Repository( GithubObject.GithubObject ): ) return status == 204 - def has_in_collaborators( self, collaborator ): - assert isinstance( collaborator, NamedUser.NamedUser ), collaborator + def has_in_collaborators(self, collaborator): + assert isinstance(collaborator, github.NamedUser.NamedUser), collaborator status, headers, data = self._requester.requestRaw( "GET", self.url + "/collaborators/" + collaborator._identity, @@ -957,30 +964,30 @@ class Repository( GithubObject.GithubObject ): ) return status == 204 - def legacy_search_issues( self, state, keyword ): - assert state in [ "open", "closed" ], state - assert isinstance( keyword, ( str, unicode ) ), keyword + def legacy_search_issues(self, state, keyword): + assert state in ["open", "closed"], state + assert isinstance(keyword, (str, unicode)), keyword headers, data = self._requester.requestAndCheck( "GET", - "/legacy/issues/search/" + self.owner.login + "/" + self.name + "/" + state + "/" + urllib.quote( keyword ), + "/legacy/issues/search/" + self.owner.login + "/" + self.name + "/" + state + "/" + urllib.quote(keyword), None, None ) return [ - Issue.Issue( self._requester, Legacy.convertIssue( element ), completed = False ) - for element in data[ "issues" ] + github.Issue.Issue(self._requester, github.Legacy.convertIssue(element), completed=False) + for element in data["issues"] ] - def merge( self, base, head, commit_message = GithubObject.NotSet ): - assert isinstance( base, ( str, unicode ) ), base - assert isinstance( head, ( str, unicode ) ), head - assert commit_message is GithubObject.NotSet or isinstance( commit_message, ( str, unicode ) ), commit_message + def merge(self, base, head, commit_message=github.GithubObject.NotSet): + assert isinstance(base, (str, unicode)), base + assert isinstance(head, (str, unicode)), head + assert commit_message is github.GithubObject.NotSet or isinstance(commit_message, (str, unicode)), commit_message post_parameters = { "base": base, "head": head, } - if commit_message is not GithubObject.NotSet: - post_parameters[ "commit_message" ] = commit_message + if commit_message is not github.GithubObject.NotSet: + post_parameters["commit_message"] = commit_message headers, data = self._requester.requestAndCheck( "POST", self.url + "/merges", @@ -990,10 +997,10 @@ class Repository( GithubObject.GithubObject ): if data is None: return None else: - return Commit.Commit( self._requester, data, completed = True ) + return github.Commit.Commit(self._requester, data, completed=True) - def remove_from_collaborators( self, collaborator ): - assert isinstance( collaborator, NamedUser.NamedUser ), collaborator + def remove_from_collaborators(self, collaborator): + assert isinstance(collaborator, github.NamedUser.NamedUser), collaborator headers, data = self._requester.requestAndCheck( "DELETE", self.url + "/collaborators/" + collaborator._identity, @@ -1002,129 +1009,129 @@ class Repository( GithubObject.GithubObject ): ) @property - def _identity( self ): + def _identity(self): return self.owner.login + "/" + self.name - def _initAttributes( self ): - self._clone_url = GithubObject.NotSet - self._created_at = GithubObject.NotSet - self._description = GithubObject.NotSet - self._fork = GithubObject.NotSet - self._forks = GithubObject.NotSet - self._full_name = GithubObject.NotSet - self._git_url = GithubObject.NotSet - self._has_downloads = GithubObject.NotSet - self._has_issues = GithubObject.NotSet - self._has_wiki = GithubObject.NotSet - self._homepage = GithubObject.NotSet - self._html_url = GithubObject.NotSet - self._id = GithubObject.NotSet - self._language = GithubObject.NotSet - self._master_branch = GithubObject.NotSet - self._name = GithubObject.NotSet - self._open_issues = GithubObject.NotSet - self._organization = GithubObject.NotSet - self._owner = GithubObject.NotSet - self._parent = GithubObject.NotSet - self._permissions = GithubObject.NotSet - self._private = GithubObject.NotSet - self._pushed_at = GithubObject.NotSet - self._size = GithubObject.NotSet - self._source = GithubObject.NotSet - self._ssh_url = GithubObject.NotSet - self._svn_url = GithubObject.NotSet - self._updated_at = GithubObject.NotSet - self._url = GithubObject.NotSet - self._watchers = GithubObject.NotSet + def _initAttributes(self): + self._clone_url = github.GithubObject.NotSet + self._created_at = github.GithubObject.NotSet + self._description = github.GithubObject.NotSet + self._fork = github.GithubObject.NotSet + self._forks = github.GithubObject.NotSet + self._full_name = github.GithubObject.NotSet + self._git_url = github.GithubObject.NotSet + self._has_downloads = github.GithubObject.NotSet + self._has_issues = github.GithubObject.NotSet + self._has_wiki = github.GithubObject.NotSet + self._homepage = github.GithubObject.NotSet + self._html_url = github.GithubObject.NotSet + self._id = github.GithubObject.NotSet + self._language = github.GithubObject.NotSet + self._master_branch = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._open_issues = github.GithubObject.NotSet + self._organization = github.GithubObject.NotSet + self._owner = github.GithubObject.NotSet + self._parent = github.GithubObject.NotSet + self._permissions = github.GithubObject.NotSet + self._private = github.GithubObject.NotSet + self._pushed_at = github.GithubObject.NotSet + self._size = github.GithubObject.NotSet + self._source = github.GithubObject.NotSet + self._ssh_url = github.GithubObject.NotSet + self._svn_url = github.GithubObject.NotSet + self._updated_at = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + self._watchers = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "clone_url" in attributes: # pragma no branch - assert attributes[ "clone_url" ] is None or isinstance( attributes[ "clone_url" ], ( str, unicode ) ), attributes[ "clone_url" ] - self._clone_url = attributes[ "clone_url" ] - if "created_at" in attributes: # pragma no branch - assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] - self._created_at = self._parseDatetime( attributes[ "created_at" ] ) - if "description" in attributes: # pragma no branch - assert attributes[ "description" ] is None or isinstance( attributes[ "description" ], ( str, unicode ) ), attributes[ "description" ] - self._description = attributes[ "description" ] - if "fork" in attributes: # pragma no branch - assert attributes[ "fork" ] is None or isinstance( attributes[ "fork" ], bool ), attributes[ "fork" ] - self._fork = attributes[ "fork" ] - if "forks" in attributes: # pragma no branch - assert attributes[ "forks" ] is None or isinstance( attributes[ "forks" ], int ), attributes[ "forks" ] - self._forks = attributes[ "forks" ] - if "full_name" in attributes: # pragma no branch - assert attributes[ "full_name" ] is None or isinstance( attributes[ "full_name" ], ( str, unicode ) ), attributes[ "full_name" ] - self._full_name = attributes[ "full_name" ] - if "git_url" in attributes: # pragma no branch - assert attributes[ "git_url" ] is None or isinstance( attributes[ "git_url" ], ( str, unicode ) ), attributes[ "git_url" ] - self._git_url = attributes[ "git_url" ] - if "has_downloads" in attributes: # pragma no branch - assert attributes[ "has_downloads" ] is None or isinstance( attributes[ "has_downloads" ], bool ), attributes[ "has_downloads" ] - self._has_downloads = attributes[ "has_downloads" ] - if "has_issues" in attributes: # pragma no branch - assert attributes[ "has_issues" ] is None or isinstance( attributes[ "has_issues" ], bool ), attributes[ "has_issues" ] - self._has_issues = attributes[ "has_issues" ] - if "has_wiki" in attributes: # pragma no branch - assert attributes[ "has_wiki" ] is None or isinstance( attributes[ "has_wiki" ], bool ), attributes[ "has_wiki" ] - self._has_wiki = attributes[ "has_wiki" ] - if "homepage" in attributes: # pragma no branch - assert attributes[ "homepage" ] is None or isinstance( attributes[ "homepage" ], ( str, unicode ) ), attributes[ "homepage" ] - self._homepage = attributes[ "homepage" ] - if "html_url" in attributes: # pragma no branch - assert attributes[ "html_url" ] is None or isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ] - self._html_url = attributes[ "html_url" ] - if "id" in attributes: # pragma no branch - assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] - self._id = attributes[ "id" ] - if "language" in attributes: # pragma no branch - assert attributes[ "language" ] is None or isinstance( attributes[ "language" ], ( str, unicode ) ), attributes[ "language" ] - self._language = attributes[ "language" ] - if "master_branch" in attributes: # pragma no branch - assert attributes[ "master_branch" ] is None or isinstance( attributes[ "master_branch" ], ( str, unicode ) ), attributes[ "master_branch" ] - self._master_branch = attributes[ "master_branch" ] - if "name" in attributes: # pragma no branch - assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ] - self._name = attributes[ "name" ] - if "open_issues" in attributes: # pragma no branch - assert attributes[ "open_issues" ] is None or isinstance( attributes[ "open_issues" ], int ), attributes[ "open_issues" ] - self._open_issues = attributes[ "open_issues" ] - if "organization" in attributes: # pragma no branch - assert attributes[ "organization" ] is None or isinstance( attributes[ "organization" ], dict ), attributes[ "organization" ] - self._organization = None if attributes[ "organization" ] is None else Organization.Organization( self._requester, attributes[ "organization" ], completed = False ) - if "owner" in attributes: # pragma no branch - assert attributes[ "owner" ] is None or isinstance( attributes[ "owner" ], dict ), attributes[ "owner" ] - self._owner = None if attributes[ "owner" ] is None else NamedUser.NamedUser( self._requester, attributes[ "owner" ], completed = False ) - if "parent" in attributes: # pragma no branch - assert attributes[ "parent" ] is None or isinstance( attributes[ "parent" ], dict ), attributes[ "parent" ] - self._parent = None if attributes[ "parent" ] is None else Repository( self._requester, attributes[ "parent" ], completed = False ) - if "permissions" in attributes: # pragma no branch - assert attributes[ "permissions" ] is None or isinstance( attributes[ "permissions" ], dict ), attributes[ "permissions" ] - self._permissions = None if attributes[ "permissions" ] is None else Permissions.Permissions( self._requester, attributes[ "permissions" ], completed = False ) - if "private" in attributes: # pragma no branch - assert attributes[ "private" ] is None or isinstance( attributes[ "private" ], bool ), attributes[ "private" ] - self._private = attributes[ "private" ] - if "pushed_at" in attributes: # pragma no branch - assert attributes[ "pushed_at" ] is None or isinstance( attributes[ "pushed_at" ], ( str, unicode ) ), attributes[ "pushed_at" ] - self._pushed_at = self._parseDatetime( attributes[ "pushed_at" ] ) - if "size" in attributes: # pragma no branch - assert attributes[ "size" ] is None or isinstance( attributes[ "size" ], int ), attributes[ "size" ] - self._size = attributes[ "size" ] - if "source" in attributes: # pragma no branch - assert attributes[ "source" ] is None or isinstance( attributes[ "source" ], dict ), attributes[ "source" ] - self._source = None if attributes[ "source" ] is None else Repository( self._requester, attributes[ "source" ], completed = False ) - if "ssh_url" in attributes: # pragma no branch - assert attributes[ "ssh_url" ] is None or isinstance( attributes[ "ssh_url" ], ( str, unicode ) ), attributes[ "ssh_url" ] - self._ssh_url = attributes[ "ssh_url" ] - if "svn_url" in attributes: # pragma no branch - assert attributes[ "svn_url" ] is None or isinstance( attributes[ "svn_url" ], ( str, unicode ) ), attributes[ "svn_url" ] - self._svn_url = attributes[ "svn_url" ] - if "updated_at" in attributes: # pragma no branch - assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ] - self._updated_at = self._parseDatetime( attributes[ "updated_at" ] ) - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] - if "watchers" in attributes: # pragma no branch - assert attributes[ "watchers" ] is None or isinstance( attributes[ "watchers" ], int ), attributes[ "watchers" ] - self._watchers = attributes[ "watchers" ] + def _useAttributes(self, attributes): + if "clone_url" in attributes: # pragma no branch + assert attributes["clone_url"] is None or isinstance(attributes["clone_url"], (str, unicode)), attributes["clone_url"] + self._clone_url = attributes["clone_url"] + if "created_at" in attributes: # pragma no branch + assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"] + self._created_at = self._parseDatetime(attributes["created_at"]) + if "description" in attributes: # pragma no branch + assert attributes["description"] is None or isinstance(attributes["description"], (str, unicode)), attributes["description"] + self._description = attributes["description"] + if "fork" in attributes: # pragma no branch + assert attributes["fork"] is None or isinstance(attributes["fork"], bool), attributes["fork"] + self._fork = attributes["fork"] + if "forks" in attributes: # pragma no branch + assert attributes["forks"] is None or isinstance(attributes["forks"], (int, long)), attributes["forks"] + self._forks = attributes["forks"] + if "full_name" in attributes: # pragma no branch + assert attributes["full_name"] is None or isinstance(attributes["full_name"], (str, unicode)), attributes["full_name"] + self._full_name = attributes["full_name"] + if "git_url" in attributes: # pragma no branch + assert attributes["git_url"] is None or isinstance(attributes["git_url"], (str, unicode)), attributes["git_url"] + self._git_url = attributes["git_url"] + if "has_downloads" in attributes: # pragma no branch + assert attributes["has_downloads"] is None or isinstance(attributes["has_downloads"], bool), attributes["has_downloads"] + self._has_downloads = attributes["has_downloads"] + if "has_issues" in attributes: # pragma no branch + assert attributes["has_issues"] is None or isinstance(attributes["has_issues"], bool), attributes["has_issues"] + self._has_issues = attributes["has_issues"] + if "has_wiki" in attributes: # pragma no branch + assert attributes["has_wiki"] is None or isinstance(attributes["has_wiki"], bool), attributes["has_wiki"] + self._has_wiki = attributes["has_wiki"] + if "homepage" in attributes: # pragma no branch + assert attributes["homepage"] is None or isinstance(attributes["homepage"], (str, unicode)), attributes["homepage"] + self._homepage = attributes["homepage"] + if "html_url" in attributes: # pragma no branch + assert attributes["html_url"] is None or isinstance(attributes["html_url"], (str, unicode)), attributes["html_url"] + self._html_url = attributes["html_url"] + if "id" in attributes: # pragma no branch + assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] + self._id = attributes["id"] + if "language" in attributes: # pragma no branch + assert attributes["language"] is None or isinstance(attributes["language"], (str, unicode)), attributes["language"] + self._language = attributes["language"] + if "master_branch" in attributes: # pragma no branch + assert attributes["master_branch"] is None or isinstance(attributes["master_branch"], (str, unicode)), attributes["master_branch"] + self._master_branch = attributes["master_branch"] + if "name" in attributes: # pragma no branch + assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] + self._name = attributes["name"] + if "open_issues" in attributes: # pragma no branch + assert attributes["open_issues"] is None or isinstance(attributes["open_issues"], (int, long)), attributes["open_issues"] + self._open_issues = attributes["open_issues"] + if "organization" in attributes: # pragma no branch + assert attributes["organization"] is None or isinstance(attributes["organization"], dict), attributes["organization"] + self._organization = None if attributes["organization"] is None else github.Organization.Organization(self._requester, attributes["organization"], completed=False) + if "owner" in attributes: # pragma no branch + assert attributes["owner"] is None or isinstance(attributes["owner"], dict), attributes["owner"] + self._owner = None if attributes["owner"] is None else github.NamedUser.NamedUser(self._requester, attributes["owner"], completed=False) + if "parent" in attributes: # pragma no branch + assert attributes["parent"] is None or isinstance(attributes["parent"], dict), attributes["parent"] + self._parent = None if attributes["parent"] is None else Repository(self._requester, attributes["parent"], completed=False) + if "permissions" in attributes: # pragma no branch + assert attributes["permissions"] is None or isinstance(attributes["permissions"], dict), attributes["permissions"] + self._permissions = None if attributes["permissions"] is None else github.Permissions.Permissions(self._requester, attributes["permissions"], completed=False) + if "private" in attributes: # pragma no branch + assert attributes["private"] is None or isinstance(attributes["private"], bool), attributes["private"] + self._private = attributes["private"] + if "pushed_at" in attributes: # pragma no branch + assert attributes["pushed_at"] is None or isinstance(attributes["pushed_at"], (str, unicode)), attributes["pushed_at"] + self._pushed_at = self._parseDatetime(attributes["pushed_at"]) + if "size" in attributes: # pragma no branch + assert attributes["size"] is None or isinstance(attributes["size"], (int, long)), attributes["size"] + self._size = attributes["size"] + if "source" in attributes: # pragma no branch + assert attributes["source"] is None or isinstance(attributes["source"], dict), attributes["source"] + self._source = None if attributes["source"] is None else Repository(self._requester, attributes["source"], completed=False) + if "ssh_url" in attributes: # pragma no branch + assert attributes["ssh_url"] is None or isinstance(attributes["ssh_url"], (str, unicode)), attributes["ssh_url"] + self._ssh_url = attributes["ssh_url"] + if "svn_url" in attributes: # pragma no branch + assert attributes["svn_url"] is None or isinstance(attributes["svn_url"], (str, unicode)), attributes["svn_url"] + self._svn_url = attributes["svn_url"] + if "updated_at" in attributes: # pragma no branch + assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], (str, unicode)), attributes["updated_at"] + self._updated_at = self._parseDatetime(attributes["updated_at"]) + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] + if "watchers" in attributes: # pragma no branch + assert attributes["watchers"] is None or isinstance(attributes["watchers"], (int, long)), attributes["watchers"] + self._watchers = attributes["watchers"] diff --git a/github/RepositoryKey.py b/github/RepositoryKey.py index 2d05745b..028dc3ce 100644 --- a/github/RepositoryKey.py +++ b/github/RepositoryKey.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,42 +13,44 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class RepositoryKey( GithubObject.GithubObject ): - def __init__( self, requester, attributes, completed, repoUrl ): - GithubObject.GithubObject.__init__( self, requester, attributes, completed ) + +class RepositoryKey(github.GithubObject.GithubObject): + def __init__(self, requester, attributes, completed, repoUrl): + github.GithubObject.GithubObject.__init__(self, requester, attributes, completed) self.__repoUrl = repoUrl - @property - def __customUrl( self ): - return self.__repoUrl + "/keys/" + str( self.id ) @property - def id( self ): - self._completeIfNotSet( self._id ) - return self._NoneIfNotSet( self._id ) + def __customUrl(self): + return self.__repoUrl + "/keys/" + str(self.id) @property - def key( self ): - self._completeIfNotSet( self._key ) - return self._NoneIfNotSet( self._key ) + def id(self): + self._completeIfNotSet(self._id) + return self._NoneIfNotSet(self._id) @property - def title( self ): - self._completeIfNotSet( self._title ) - return self._NoneIfNotSet( self._title ) + def key(self): + self._completeIfNotSet(self._key) + return self._NoneIfNotSet(self._key) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def title(self): + self._completeIfNotSet(self._title) + return self._NoneIfNotSet(self._title) @property - def verified( self ): - self._completeIfNotSet( self._verified ) - return self._NoneIfNotSet( self._verified ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) - def delete( self ): + @property + def verified(self): + self._completeIfNotSet(self._verified) + return self._NoneIfNotSet(self._verified) + + def delete(self): headers, data = self._requester.requestAndCheck( "DELETE", self.__customUrl, @@ -54,42 +58,42 @@ class RepositoryKey( GithubObject.GithubObject ): None ) - def edit( self, title = GithubObject.NotSet, key = GithubObject.NotSet ): - assert title is GithubObject.NotSet or isinstance( title, ( str, unicode ) ), title - assert key is GithubObject.NotSet or isinstance( key, ( str, unicode ) ), key + def edit(self, title=github.GithubObject.NotSet, key=github.GithubObject.NotSet): + assert title is github.GithubObject.NotSet or isinstance(title, (str, unicode)), title + assert key is github.GithubObject.NotSet or isinstance(key, (str, unicode)), key post_parameters = dict() - if title is not GithubObject.NotSet: - post_parameters[ "title" ] = title - if key is not GithubObject.NotSet: - post_parameters[ "key" ] = key + if title is not github.GithubObject.NotSet: + post_parameters["title"] = title + if key is not github.GithubObject.NotSet: + post_parameters["key"] = key headers, data = self._requester.requestAndCheck( "PATCH", self.__customUrl, None, post_parameters ) - self._useAttributes( data ) + self._useAttributes(data) - def _initAttributes( self ): - self._id = GithubObject.NotSet - self._key = GithubObject.NotSet - self._title = GithubObject.NotSet - self._url = GithubObject.NotSet - self._verified = GithubObject.NotSet + def _initAttributes(self): + self._id = github.GithubObject.NotSet + self._key = github.GithubObject.NotSet + self._title = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + self._verified = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "id" in attributes: # pragma no branch - assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] - self._id = attributes[ "id" ] - if "key" in attributes: # pragma no branch - assert attributes[ "key" ] is None or isinstance( attributes[ "key" ], ( str, unicode ) ), attributes[ "key" ] - self._key = attributes[ "key" ] - if "title" in attributes: # pragma no branch - assert attributes[ "title" ] is None or isinstance( attributes[ "title" ], ( str, unicode ) ), attributes[ "title" ] - self._title = attributes[ "title" ] - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] - if "verified" in attributes: # pragma no branch - assert attributes[ "verified" ] is None or isinstance( attributes[ "verified" ], bool ), attributes[ "verified" ] - self._verified = attributes[ "verified" ] + def _useAttributes(self, attributes): + if "id" in attributes: # pragma no branch + assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] + self._id = attributes["id"] + if "key" in attributes: # pragma no branch + assert attributes["key"] is None or isinstance(attributes["key"], (str, unicode)), attributes["key"] + self._key = attributes["key"] + if "title" in attributes: # pragma no branch + assert attributes["title"] is None or isinstance(attributes["title"], (str, unicode)), attributes["title"] + self._title = attributes["title"] + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] + if "verified" in attributes: # pragma no branch + assert attributes["verified"] is None or isinstance(attributes["verified"], bool), attributes["verified"] + self._verified = attributes["verified"] diff --git a/github/Requester.py b/github/Requester.py index fd223b71..2a7f2c0c 100644 --- a/github/Requester.py +++ b/github/Requester.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,6 +13,7 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . +import logging import httplib import base64 import urllib @@ -18,27 +21,32 @@ import urlparse import sys atLeastPython26 = sys.hexversion >= 0x02060000 +atLeastPython3 = sys.hexversion >= 0x03000000 if atLeastPython26: import json -else: #pragma no cover - import simplejson as json #pragma no cover +else: # pragma no cover + import simplejson as json # pragma no cover import GithubException + class Requester: __httpConnectionClass = httplib.HTTPConnection __httpsConnectionClass = httplib.HTTPSConnection @classmethod - def injectConnectionClasses( cls, httpConnectionClass, httpsConnectionClass ): + def injectConnectionClasses(cls, httpConnectionClass, httpsConnectionClass): cls.__httpConnectionClass = httpConnectionClass cls.__httpsConnectionClass = httpsConnectionClass - def __init__( self, login_or_token, password, base_url, timeout ): + def __init__(self, login_or_token, password, base_url, timeout, client_id, client_secret, user_agent): if password is not None: login = login_or_token - self.__authorizationHeader = "Basic " + base64.b64encode( login + ":" + password ).replace( '\n', '' ) + if atLeastPython3: + self.__authorizationHeader = "Basic " + str(base64.b64encode(bytearray(login + ":" + password, "utf-8"))).replace('\n', '') # pragma no cover + else: + self.__authorizationHeader = "Basic " + base64.b64encode(login + ":" + password).replace('\n', '') elif login_or_token is not None: token = login_or_token self.__authorizationHeader = "token " + token @@ -46,7 +54,7 @@ class Requester: self.__authorizationHeader = None self.__base_url = base_url - o = urlparse.urlparse( base_url ) + o = urlparse.urlparse(base_url) self.__hostname = o.hostname self.__port = o.port self.__prefix = o.path @@ -57,69 +65,108 @@ class Requester: elif o.scheme == "http": self.__connectionClass = self.__httpConnectionClass else: - assert( False ) #pragma no cover - self.rate_limiting = ( 5000, 5000 ) + assert False, "Unknown URL scheme" # pragma no cover + self.rate_limiting = (5000, 5000) + self.FIX_REPO_GET_GIT_REF = True - def requestAndCheck( self, verb, url, parameters, input ): - status, headers, output = self.requestRaw( verb, url, parameters, input ) - output = self.__structuredFromJson( output ) + self.__clientId = client_id + self.__clientSecret = client_secret + self.__userAgent = user_agent + + def requestAndCheck(self, verb, url, parameters, input): + status, headers, output = self.requestRaw(verb, url, parameters, input) + output = self.__structuredFromJson(output) if status >= 400: - raise GithubException.GithubException( status, output ) + raise GithubException.GithubException(status, output) return headers, output - def requestRaw( self, verb, url, parameters, input ): - assert verb in [ "HEAD", "GET", "POST", "PATCH", "PUT", "DELETE" ] - - #URLs generated locally will be relative to __base_url - #URLs returned from the server will start with __base_url - if url.startswith( "/" ): - url = self.__prefix + url + def __structuredFromJson(self, data): + if len(data) == 0: + return None else: - o = urlparse.urlparse( url ) - assert o.scheme == self.__scheme or o.scheme == "https" and self.__scheme == "http" # Issue #80 - assert o.hostname == self.__hostname - assert o.path.startswith( self.__prefix ) - assert o.port == self.__port - url = o.path - if o.query != "": - url += "?" + o.query + return json.loads(data) - headers = dict() - if self.__authorizationHeader is not None: - headers[ "Authorization" ] = self.__authorizationHeader + def requestRaw(self, verb, url, parameters, input): + assert verb in ["HEAD", "GET", "POST", "PATCH", "PUT", "DELETE"] + if parameters is None: + parameters = dict() - if atLeastPython26: - cnx = self.__connectionClass( host = self.__hostname, port = self.__port, strict = True, timeout = self.__timeout ) - else: #pragma no cover - cnx = self.__connectionClass( host = self.__hostname, port = self.__port, strict = True ) #pragma no cover + requestHeaders = dict() + self.__authenticate(requestHeaders, parameters) + if self.__userAgent is not None: + requestHeaders["User-Agent"] = self.__userAgent + + url = self.__makeAbsoluteUrl(url) + url = self.__addParametersToUrl(url, parameters) + + if input is not None: + requestHeaders["Content-Type"] = "application/json" + + cnx = self.__createConnection() cnx.request( verb, - self.__completeUrl( url, parameters ), - json.dumps( input ), - headers + url, + json.dumps(input), + requestHeaders ) response = cnx.getresponse() status = response.status - headers = dict( response.getheaders() ) + responseHeaders = dict(response.getheaders()) output = response.read() cnx.close() - if "x-ratelimit-remaining" in headers and "x-ratelimit-limit" in headers: - self.rate_limiting = ( int( headers[ "x-ratelimit-remaining" ] ), int( headers[ "x-ratelimit-limit" ] ) ) + if "x-ratelimit-remaining" in responseHeaders and "x-ratelimit-limit" in responseHeaders: + self.rate_limiting = (int(responseHeaders["x-ratelimit-remaining"]), int(responseHeaders["x-ratelimit-limit"])) - # print verb, self.__base_url + url, parameters, input, "==>", status, str( headers ), str( output ) - return status, headers, output + self.__log(verb, url, requestHeaders, input, status, responseHeaders, output) - def __completeUrl( self, url, parameters ): - if parameters is None or len( parameters ) == 0: + return status, responseHeaders, output + + def __authenticate(self, requestHeaders, parameters): + if self.__clientId and self.__clientSecret: + parameters["client_id"] = self.__clientId + parameters["client_secret"] = self.__clientSecret + if self.__authorizationHeader is not None: + requestHeaders["Authorization"] = self.__authorizationHeader + + def __makeAbsoluteUrl(self, url): + # URLs generated locally will be relative to __base_url + # URLs returned from the server will start with __base_url + if url.startswith("/"): + url = self.__prefix + url + else: + o = urlparse.urlparse(url) + assert o.scheme == self.__scheme or o.scheme == "https" and self.__scheme == "http" # Issue #80 + assert o.hostname == self.__hostname + assert o.path.startswith(self.__prefix) + assert o.port == self.__port + url = o.path + if o.query != "": + url += "?" + o.query + return url + + def __addParametersToUrl(self, url, parameters): + if len(parameters) == 0: return url else: - return url + "?" + urllib.urlencode( parameters ) + return url + "?" + urllib.urlencode(parameters) - def __structuredFromJson( self, data ): - if len( data ) == 0: - return None - else: - return json.loads( data ) + def __createConnection(self): + if atLeastPython26: + return self.__connectionClass(host=self.__hostname, port=self.__port, strict=True, timeout=self.__timeout) + else: # pragma no cover + return self.__connectionClass(host=self.__hostname, port=self.__port, strict=True) # pragma no cover + + def __log(self, verb, url, requestHeaders, input, status, responseHeaders, output): + logger = logging.getLogger(__name__) + if logger.isEnabledFor(logging.DEBUG): + if "Authorization" in requestHeaders: + if requestHeaders["Authorization"].startswith("Basic"): + requestHeaders["Authorization"] = "Basic (login and password removed)" + elif requestHeaders["Authorization"].startswith("token"): + requestHeaders["Authorization"] = "token (oauth token removed)" + else: # pragma no cover + requestHeaders["Authorization"] = "Unknown authorization removed" + logger.debug("%s %s://%s%s %s %s ==> %i %s %s", str(verb), self.__scheme, self.__hostname, str(url), str(requestHeaders), str(input), status, str(responseHeaders), str(output)) diff --git a/github/Tag.py b/github/Tag.py index 3ed86186..96c87022 100644 --- a/github/Tag.py +++ b/github/Tag.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,43 +13,44 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -import Commit +import github.Commit -class Tag( GithubObject.BasicGithubObject ): + +class Tag(github.GithubObject.BasicGithubObject): @property - def commit( self ): - return self._NoneIfNotSet( self._commit ) + def commit(self): + return self._NoneIfNotSet(self._commit) @property - def name( self ): - return self._NoneIfNotSet( self._name ) + def name(self): + return self._NoneIfNotSet(self._name) @property - def tarball_url( self ): - return self._NoneIfNotSet( self._tarball_url ) + def tarball_url(self): + return self._NoneIfNotSet(self._tarball_url) @property - def zipball_url( self ): - return self._NoneIfNotSet( self._zipball_url ) + def zipball_url(self): + return self._NoneIfNotSet(self._zipball_url) - def _initAttributes( self ): - self._commit = GithubObject.NotSet - self._name = GithubObject.NotSet - self._tarball_url = GithubObject.NotSet - self._zipball_url = GithubObject.NotSet + def _initAttributes(self): + self._commit = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._tarball_url = github.GithubObject.NotSet + self._zipball_url = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "commit" in attributes: # pragma no branch - assert attributes[ "commit" ] is None or isinstance( attributes[ "commit" ], dict ), attributes[ "commit" ] - self._commit = None if attributes[ "commit" ] is None else Commit.Commit( self._requester, attributes[ "commit" ], completed = False ) - if "name" in attributes: # pragma no branch - assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ] - self._name = attributes[ "name" ] - if "tarball_url" in attributes: # pragma no branch - assert attributes[ "tarball_url" ] is None or isinstance( attributes[ "tarball_url" ], ( str, unicode ) ), attributes[ "tarball_url" ] - self._tarball_url = attributes[ "tarball_url" ] - if "zipball_url" in attributes: # pragma no branch - assert attributes[ "zipball_url" ] is None or isinstance( attributes[ "zipball_url" ], ( str, unicode ) ), attributes[ "zipball_url" ] - self._zipball_url = attributes[ "zipball_url" ] + def _useAttributes(self, attributes): + if "commit" in attributes: # pragma no branch + assert attributes["commit"] is None or isinstance(attributes["commit"], dict), attributes["commit"] + self._commit = None if attributes["commit"] is None else github.Commit.Commit(self._requester, attributes["commit"], completed=False) + if "name" in attributes: # pragma no branch + assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] + self._name = attributes["name"] + if "tarball_url" in attributes: # pragma no branch + assert attributes["tarball_url"] is None or isinstance(attributes["tarball_url"], (str, unicode)), attributes["tarball_url"] + self._tarball_url = attributes["tarball_url"] + if "zipball_url" in attributes: # pragma no branch + assert attributes["zipball_url"] is None or isinstance(attributes["zipball_url"], (str, unicode)), attributes["zipball_url"] + self._zipball_url = attributes["zipball_url"] diff --git a/github/Team.py b/github/Team.py index 671ce655..684e5df9 100644 --- a/github/Team.py +++ b/github/Team.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,45 +13,46 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject -import PaginatedList +import github.GithubObject +import github.PaginatedList -import Repository -import NamedUser +import github.Repository +import github.NamedUser -class Team( GithubObject.GithubObject ): + +class Team(github.GithubObject.GithubObject): @property - def id( self ): - self._completeIfNotSet( self._id ) - return self._NoneIfNotSet( self._id ) + def id(self): + self._completeIfNotSet(self._id) + return self._NoneIfNotSet(self._id) @property - def members_count( self ): - self._completeIfNotSet( self._members_count ) - return self._NoneIfNotSet( self._members_count ) + def members_count(self): + self._completeIfNotSet(self._members_count) + return self._NoneIfNotSet(self._members_count) @property - def name( self ): - self._completeIfNotSet( self._name ) - return self._NoneIfNotSet( self._name ) + def name(self): + self._completeIfNotSet(self._name) + return self._NoneIfNotSet(self._name) @property - def permission( self ): - self._completeIfNotSet( self._permission ) - return self._NoneIfNotSet( self._permission ) + def permission(self): + self._completeIfNotSet(self._permission) + return self._NoneIfNotSet(self._permission) @property - def repos_count( self ): - self._completeIfNotSet( self._repos_count ) - return self._NoneIfNotSet( self._repos_count ) + def repos_count(self): + self._completeIfNotSet(self._repos_count) + return self._NoneIfNotSet(self._repos_count) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) - def add_to_members( self, member ): - assert isinstance( member, NamedUser.NamedUser ), member + def add_to_members(self, member): + assert isinstance(member, github.NamedUser.NamedUser), member headers, data = self._requester.requestAndCheck( "PUT", self.url + "/members/" + member._identity, @@ -57,8 +60,8 @@ class Team( GithubObject.GithubObject ): None ) - def add_to_repos( self, repo ): - assert isinstance( repo, Repository.Repository ), repo + def add_to_repos(self, repo): + assert isinstance(repo, github.Repository.Repository), repo headers, data = self._requester.requestAndCheck( "PUT", self.url + "/repos/" + repo._identity, @@ -66,7 +69,7 @@ class Team( GithubObject.GithubObject ): None ) - def delete( self ): + def delete(self): headers, data = self._requester.requestAndCheck( "DELETE", self.url, @@ -74,40 +77,40 @@ class Team( GithubObject.GithubObject ): None ) - def edit( self, name, permission = GithubObject.NotSet ): - assert isinstance( name, ( str, unicode ) ), name - assert permission is GithubObject.NotSet or isinstance( permission, ( str, unicode ) ), permission + def edit(self, name, permission=github.GithubObject.NotSet): + assert isinstance(name, (str, unicode)), name + assert permission is github.GithubObject.NotSet or isinstance(permission, (str, unicode)), permission post_parameters = { "name": name, } - if permission is not GithubObject.NotSet: - post_parameters[ "permission" ] = permission + if permission is not github.GithubObject.NotSet: + post_parameters["permission"] = permission headers, data = self._requester.requestAndCheck( "PATCH", self.url, None, post_parameters ) - self._useAttributes( data ) + self._useAttributes(data) - def get_members( self ): - return PaginatedList.PaginatedList( - NamedUser.NamedUser, + def get_members(self): + return github.PaginatedList.PaginatedList( + github.NamedUser.NamedUser, self._requester, self.url + "/members", None ) - def get_repos( self ): - return PaginatedList.PaginatedList( - Repository.Repository, + def get_repos(self): + return github.PaginatedList.PaginatedList( + github.Repository.Repository, self._requester, self.url + "/repos", None ) - def has_in_members( self, member ): - assert isinstance( member, NamedUser.NamedUser ), member + def has_in_members(self, member): + assert isinstance(member, github.NamedUser.NamedUser), member status, headers, data = self._requester.requestRaw( "GET", self.url + "/members/" + member._identity, @@ -116,8 +119,8 @@ class Team( GithubObject.GithubObject ): ) return status == 204 - def has_in_repos( self, repo ): - assert isinstance( repo, Repository.Repository ), repo + def has_in_repos(self, repo): + assert isinstance(repo, github.Repository.Repository), repo status, headers, data = self._requester.requestRaw( "GET", self.url + "/repos/" + repo._identity, @@ -126,8 +129,8 @@ class Team( GithubObject.GithubObject ): ) return status == 204 - def remove_from_members( self, member ): - assert isinstance( member, NamedUser.NamedUser ), member + def remove_from_members(self, member): + assert isinstance(member, github.NamedUser.NamedUser), member headers, data = self._requester.requestAndCheck( "DELETE", self.url + "/members/" + member._identity, @@ -135,8 +138,8 @@ class Team( GithubObject.GithubObject ): None ) - def remove_from_repos( self, repo ): - assert isinstance( repo, Repository.Repository ), repo + def remove_from_repos(self, repo): + assert isinstance(repo, github.Repository.Repository), repo headers, data = self._requester.requestAndCheck( "DELETE", self.url + "/repos/" + repo._identity, @@ -145,33 +148,33 @@ class Team( GithubObject.GithubObject ): ) @property - def _identity( self ): + def _identity(self): return self.id - def _initAttributes( self ): - self._id = GithubObject.NotSet - self._members_count = GithubObject.NotSet - self._name = GithubObject.NotSet - self._permission = GithubObject.NotSet - self._repos_count = GithubObject.NotSet - self._url = GithubObject.NotSet + def _initAttributes(self): + self._id = github.GithubObject.NotSet + self._members_count = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._permission = github.GithubObject.NotSet + self._repos_count = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "id" in attributes: # pragma no branch - assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] - self._id = attributes[ "id" ] - if "members_count" in attributes: # pragma no branch - assert attributes[ "members_count" ] is None or isinstance( attributes[ "members_count" ], int ), attributes[ "members_count" ] - self._members_count = attributes[ "members_count" ] - if "name" in attributes: # pragma no branch - assert attributes[ "name" ] is None or isinstance( attributes[ "name" ], ( str, unicode ) ), attributes[ "name" ] - self._name = attributes[ "name" ] - if "permission" in attributes: # pragma no branch - assert attributes[ "permission" ] is None or isinstance( attributes[ "permission" ], ( str, unicode ) ), attributes[ "permission" ] - self._permission = attributes[ "permission" ] - if "repos_count" in attributes: # pragma no branch - assert attributes[ "repos_count" ] is None or isinstance( attributes[ "repos_count" ], int ), attributes[ "repos_count" ] - self._repos_count = attributes[ "repos_count" ] - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] + def _useAttributes(self, attributes): + if "id" in attributes: # pragma no branch + assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] + self._id = attributes["id"] + if "members_count" in attributes: # pragma no branch + assert attributes["members_count"] is None or isinstance(attributes["members_count"], (int, long)), attributes["members_count"] + self._members_count = attributes["members_count"] + if "name" in attributes: # pragma no branch + assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] + self._name = attributes["name"] + if "permission" in attributes: # pragma no branch + assert attributes["permission"] is None or isinstance(attributes["permission"], (str, unicode)), attributes["permission"] + self._permission = attributes["permission"] + if "repos_count" in attributes: # pragma no branch + assert attributes["repos_count"] is None or isinstance(attributes["repos_count"], (int, long)), attributes["repos_count"] + self._repos_count = attributes["repos_count"] + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] diff --git a/github/UserKey.py b/github/UserKey.py index 6886842a..4fe342ce 100644 --- a/github/UserKey.py +++ b/github/UserKey.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,35 +13,36 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import GithubObject +import github.GithubObject -class UserKey( GithubObject.GithubObject ): + +class UserKey(github.GithubObject.GithubObject): @property - def id( self ): - self._completeIfNotSet( self._id ) - return self._NoneIfNotSet( self._id ) + def id(self): + self._completeIfNotSet(self._id) + return self._NoneIfNotSet(self._id) @property - def key( self ): - self._completeIfNotSet( self._key ) - return self._NoneIfNotSet( self._key ) + def key(self): + self._completeIfNotSet(self._key) + return self._NoneIfNotSet(self._key) @property - def title( self ): - self._completeIfNotSet( self._title ) - return self._NoneIfNotSet( self._title ) + def title(self): + self._completeIfNotSet(self._title) + return self._NoneIfNotSet(self._title) @property - def url( self ): - self._completeIfNotSet( self._url ) - return self._NoneIfNotSet( self._url ) + def url(self): + self._completeIfNotSet(self._url) + return self._NoneIfNotSet(self._url) @property - def verified( self ): - self._completeIfNotSet( self._verified ) - return self._NoneIfNotSet( self._verified ) + def verified(self): + self._completeIfNotSet(self._verified) + return self._NoneIfNotSet(self._verified) - def delete( self ): + def delete(self): headers, data = self._requester.requestAndCheck( "DELETE", self.url, @@ -47,42 +50,42 @@ class UserKey( GithubObject.GithubObject ): None ) - def edit( self, title = GithubObject.NotSet, key = GithubObject.NotSet ): - assert title is GithubObject.NotSet or isinstance( title, ( str, unicode ) ), title - assert key is GithubObject.NotSet or isinstance( key, ( str, unicode ) ), key + def edit(self, title=github.GithubObject.NotSet, key=github.GithubObject.NotSet): + assert title is github.GithubObject.NotSet or isinstance(title, (str, unicode)), title + assert key is github.GithubObject.NotSet or isinstance(key, (str, unicode)), key post_parameters = dict() - if title is not GithubObject.NotSet: - post_parameters[ "title" ] = title - if key is not GithubObject.NotSet: - post_parameters[ "key" ] = key + if title is not github.GithubObject.NotSet: + post_parameters["title"] = title + if key is not github.GithubObject.NotSet: + post_parameters["key"] = key headers, data = self._requester.requestAndCheck( "PATCH", self.url, None, post_parameters ) - self._useAttributes( data ) + self._useAttributes(data) - def _initAttributes( self ): - self._id = GithubObject.NotSet - self._key = GithubObject.NotSet - self._title = GithubObject.NotSet - self._url = GithubObject.NotSet - self._verified = GithubObject.NotSet + def _initAttributes(self): + self._id = github.GithubObject.NotSet + self._key = github.GithubObject.NotSet + self._title = github.GithubObject.NotSet + self._url = github.GithubObject.NotSet + self._verified = github.GithubObject.NotSet - def _useAttributes( self, attributes ): - if "id" in attributes: # pragma no branch - assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] - self._id = attributes[ "id" ] - if "key" in attributes: # pragma no branch - assert attributes[ "key" ] is None or isinstance( attributes[ "key" ], ( str, unicode ) ), attributes[ "key" ] - self._key = attributes[ "key" ] - if "title" in attributes: # pragma no branch - assert attributes[ "title" ] is None or isinstance( attributes[ "title" ], ( str, unicode ) ), attributes[ "title" ] - self._title = attributes[ "title" ] - if "url" in attributes: # pragma no branch - assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] - self._url = attributes[ "url" ] - if "verified" in attributes: # pragma no branch - assert attributes[ "verified" ] is None or isinstance( attributes[ "verified" ], bool ), attributes[ "verified" ] - self._verified = attributes[ "verified" ] + def _useAttributes(self, attributes): + if "id" in attributes: # pragma no branch + assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] + self._id = attributes["id"] + if "key" in attributes: # pragma no branch + assert attributes["key"] is None or isinstance(attributes["key"], (str, unicode)), attributes["key"] + self._key = attributes["key"] + if "title" in attributes: # pragma no branch + assert attributes["title"] is None or isinstance(attributes["title"], (str, unicode)), attributes["title"] + self._title = attributes["title"] + if "url" in attributes: # pragma no branch + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = attributes["url"] + if "verified" in attributes: # pragma no branch + assert attributes["verified"] is None or isinstance(attributes["verified"], bool), attributes["verified"] + self._verified = attributes["verified"] diff --git a/github/__init__.py b/github/__init__.py index ef0a03ab..269bb7bd 100644 --- a/github/__init__.py +++ b/github/__init__.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -11,8 +13,16 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . +import logging + from Github import Github from GithubException import GithubException from InputFileContent import InputFileContent from InputGitAuthor import InputGitAuthor from InputGitTreeElement import InputGitTreeElement + + +def enable_console_debug_logging(): # pragma no cover + logger = logging.getLogger("github") + logger.setLevel(logging.DEBUG) + logger.addHandler(logging.StreamHandler()) diff --git a/test/IntegrationTest.py b/github/tests/AllTests.py old mode 100755 new mode 100644 similarity index 95% rename from test/IntegrationTest.py rename to github/tests/AllTests.py index 9e5cb5b7..33b9f840 --- a/test/IntegrationTest.py +++ b/github/tests/AllTests.py @@ -1,4 +1,4 @@ -#!/bin/env python +# -*- coding: utf-8 -*- # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -13,8 +13,6 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -import Framework - from AuthenticatedUser import * from Authentication import * from Authorization import * @@ -29,7 +27,7 @@ from Gist import * from GistComment import * from GitBlob import * from GitCommit import * -from Github import * +from Github_ import * from GitRef import * from GitTag import * from GitTree import * @@ -40,6 +38,7 @@ from IssueEvent import * from Label import * from Milestone import * from NamedUser import * +from Markdown import * from Organization import * from PullRequest import * from PullRequestComment import * @@ -50,14 +49,14 @@ from RepositoryKey import * from Tag import * from Team import * from UserKey import * -from Markdown import * from PaginatedList import * +from Exceptions import * +from Enterprise import * +from Logging_ import * + from Issue33 import * from Issue50 import * from Issue54 import * -from Exceptions import * -from Enterprise import * from Issue80 import * - -Framework.main() +from Issue87 import * diff --git a/github/tests/AuthenticatedUser.py b/github/tests/AuthenticatedUser.py new file mode 100644 index 00000000..19e35fc8 --- /dev/null +++ b/github/tests/AuthenticatedUser.py @@ -0,0 +1,182 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + +import github +import datetime + + +class AuthenticatedUser(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.user = self.g.get_user() + + def testAttributes(self): + self.assertEqual(self.user.avatar_url, "https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png") + self.assertEqual(self.user.bio, "") + self.assertEqual(self.user.blog, "http://vincent-jacques.net") + self.assertEqual(self.user.collaborators, 0) + self.assertEqual(self.user.company, "Criteo") + self.assertEqual(self.user.created_at, datetime.datetime(2010, 7, 9, 6, 10, 6)) + self.assertEqual(self.user.disk_usage, 16692) + self.assertEqual(self.user.email, "vincent@vincent-jacques.net") + self.assertEqual(self.user.followers, 13) + self.assertEqual(self.user.following, 24) + self.assertEqual(self.user.gravatar_id, "b68de5ae38616c296fa345d2b9df2225") + self.assertEqual(self.user.hireable, False) + self.assertEqual(self.user.html_url, "https://github.com/jacquev6") + self.assertEqual(self.user.id, 327146) + self.assertEqual(self.user.location, "Paris, France") + self.assertEqual(self.user.login, "jacquev6") + self.assertEqual(self.user.name, "Vincent Jacques") + self.assertEqual(self.user.owned_private_repos, 5) + self.assertEqual(self.user.plan.name, "micro") + self.assertEqual(self.user.plan.collaborators, 1) + self.assertEqual(self.user.plan.space, 614400) + self.assertEqual(self.user.plan.private_repos, 5) + self.assertEqual(self.user.private_gists, 5) + self.assertEqual(self.user.public_gists, 1) + self.assertEqual(self.user.public_repos, 10) + self.assertEqual(self.user.total_private_repos, 5) + self.assertEqual(self.user.type, "User") + self.assertEqual(self.user.url, "https://api.github.com/users/jacquev6") + + def testEditWithoutArguments(self): + self.user.edit() + + def testEditWithAllArguments(self): + self.user.edit("Name edited by PyGithub", "Email edited by PyGithub", "Blog edited by PyGithub", "Company edited by PyGithub", "Location edited by PyGithub", True, "Bio edited by PyGithub") + self.assertEqual(self.user.name, "Name edited by PyGithub") + self.assertEqual(self.user.email, "Email edited by PyGithub") + self.assertEqual(self.user.blog, "Blog edited by PyGithub") + self.assertEqual(self.user.company, "Company edited by PyGithub") + self.assertEqual(self.user.location, "Location edited by PyGithub") + self.assertEqual(self.user.hireable, True) + self.assertEqual(self.user.bio, "Bio edited by PyGithub") + + def testEmails(self): + self.assertEqual(self.user.get_emails(), ["vincent@vincent-jacques.net", "github.com@vincent-jacques.net"]) + self.user.add_to_emails("1@foobar.com", "2@foobar.com") + self.assertEqual(self.user.get_emails(), ["vincent@vincent-jacques.net", "1@foobar.com", "2@foobar.com", "github.com@vincent-jacques.net"]) + self.user.remove_from_emails("1@foobar.com", "2@foobar.com") + self.assertEqual(self.user.get_emails(), ["vincent@vincent-jacques.net", "github.com@vincent-jacques.net"]) + + def testFollowing(self): + nvie = self.g.get_user("nvie") + self.assertListKeyEqual(self.user.get_following(), lambda u: u.login, ["schacon", "jamis", "chad", "unclebob", "dabrahams", "jnorthrup", "brugidou", "regisb", "walidk", "tanzilli", "fjardon", "r3c", "sdanzan", "vineus", "cjuniet", "gturri", "ant9000", "asquini", "claudyus", "jardon-u", "s-bernard", "kamaradclimber", "Lyloa", "nvie"]) + self.assertEqual(self.user.has_in_following(nvie), True) + self.user.remove_from_following(nvie) + self.assertEqual(self.user.has_in_following(nvie), False) + self.user.add_to_following(nvie) + self.assertEqual(self.user.has_in_following(nvie), True) + self.assertListKeyEqual(self.user.get_followers(), lambda u: u.login, ["jnorthrup", "brugidou", "regisb", "walidk", "afzalkhan", "sdanzan", "vineus", "gturri", "fjardon", "cjuniet", "jardon-u", "kamaradclimber", "L42y"]) + + def testWatching(self): + gitflow = self.g.get_user("nvie").get_repo("gitflow") + self.assertListKeyEqual(self.user.get_watched(), lambda r: r.name, ["git", "boost.php", "capistrano", "boost.perl", "git-subtree", "git-hg", "homebrew", "celtic_knot", "twisted-intro", "markup", "hub", "gitflow", "murder", "boto", "agit", "d3", "pygit2", "git-pulls", "django_mathlatex", "scrumblr", "developer.github.com", "python-github3", "PlantUML", "bootstrap", "drawnby", "django-socketio", "django-realtime", "playground", "BozoCrack", "FatherBeaver", "PyGithub", "django", "django", "TestPyGithub"]) + self.assertEqual(self.user.has_in_watched(gitflow), True) + self.user.remove_from_watched(gitflow) + self.assertEqual(self.user.has_in_watched(gitflow), False) + self.user.add_to_watched(gitflow) + self.assertEqual(self.user.has_in_watched(gitflow), True) + + def testStarring(self): + gitflow = self.g.get_user("nvie").get_repo("gitflow") + self.assertListKeyEqual(self.user.get_starred(), lambda r: r.name, ["git", "boost.php", "capistrano", "boost.perl", "git-subtree", "git-hg", "homebrew", "celtic_knot", "twisted-intro", "markup", "hub", "gitflow", "murder", "boto", "agit", "d3", "pygit2", "git-pulls", "django_mathlatex", "scrumblr", "developer.github.com", "python-github3", "PlantUML", "bootstrap", "drawnby", "django-socketio", "django-realtime", "playground", "BozoCrack", "FatherBeaver", "amaunet", "django", "django", "moviePlanning", "folly"]) + self.assertEqual(self.user.has_in_starred(gitflow), True) + self.user.remove_from_starred(gitflow) + self.assertEqual(self.user.has_in_starred(gitflow), False) + self.user.add_to_starred(gitflow) + self.assertEqual(self.user.has_in_starred(gitflow), True) + + def testSubscriptions(self): + gitflow = self.g.get_user("nvie").get_repo("gitflow") + self.assertListKeyEqual(self.user.get_subscriptions(), lambda r: r.name, ["gitflow", "ViDE", "Boost.HierarchicalEnum", "QuadProgMm", "DrawSyntax", "DrawTurksHead", "PrivateStuff", "vincent-jacques.net", "Hacking", "C4Planner", "developer.github.com", "PyGithub", "PyGithub", "django", "CinePlanning", "PyGithub", "PyGithub", "PyGithub", "IpMap", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub"]) + self.assertEqual(self.user.has_in_subscriptions(gitflow), True) + self.user.remove_from_subscriptions(gitflow) + self.assertEqual(self.user.has_in_subscriptions(gitflow), False) + self.user.add_to_subscriptions(gitflow) + self.assertEqual(self.user.has_in_subscriptions(gitflow), True) + + def testGetAuthorizations(self): + self.assertListKeyEqual(self.user.get_authorizations(), lambda a: a.id, [372294]) + + def testCreateRepository(self): + repo = self.user.create_repo("TestPyGithub") + self.assertEqual(repo.url, "https://api.github.com/repos/jacquev6/TestPyGithub") + + def testCreateRepositoryWithAllArguments(self): + repo = self.user.create_repo("TestPyGithub", "Repo created by PyGithub", "http://foobar.com", private=False, has_issues=False, has_wiki=False, has_downloads=False) + self.assertEqual(repo.url, "https://api.github.com/repos/jacquev6/TestPyGithub") + + def testCreateRepositoryWithAutoInit(self): + repo = self.user.create_repo("TestPyGithub", auto_init=True, gitignore_template="Python") + self.assertEqual(repo.url, "https://api.github.com/repos/jacquev6/TestPyGithub") + + def testCreateAuthorizationWithoutArguments(self): + authorization = self.user.create_authorization() + self.assertEqual(authorization.id, 372259) + + def testCreateAuthorizationWithAllArguments(self): + authorization = self.user.create_authorization(["repo"], "Note created by PyGithub", "http://vincent-jacques.net/PyGithub") + self.assertEqual(authorization.id, 372294) + + def testCreateGist(self): + gist = self.user.create_gist(True, {"foobar.txt": github.InputFileContent("File created by PyGithub")}, "Gist created by PyGithub") + self.assertEqual(gist.description, "Gist created by PyGithub") + self.assertEqual(gist.files.keys(), ["foobar.txt"]) + self.assertEqual(gist.files["foobar.txt"].content, "File created by PyGithub") + + def testCreateGistWithoutDescription(self): + gist = self.user.create_gist(True, {"foobar.txt": github.InputFileContent("File created by PyGithub")}) + self.assertEqual(gist.description, None) + self.assertEqual(gist.files.keys(), ["foobar.txt"]) + self.assertEqual(gist.files["foobar.txt"].content, "File created by PyGithub") + + def testCreateKey(self): + key = self.user.create_key("Key added through PyGithub", "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Mm0RjTNAYFfSCtUpO54usdseroUSIYg5KX4JoseTpqyiB/hqewjYLAdUq/tNIQzrkoEJWSyZrQt0ma7/YCyMYuNGd3DU6q6ZAyBeY3E9RyCiKjO3aTL2VKQGFvBVVmGdxGVSCITRphAcsKc/PF35/fg9XP9S0anMXcEFtdfMHz41SSw+XtE+Vc+6cX9FuI5qUfLGbkv8L1v3g4uw9VXlzq4GfTA+1S7D6mcoGHopAIXFlVr+2RfDKdSURMcB22z41fljO1MW4+zUS/4FyUTpL991es5fcwKXYoiE+x06VJeJJ1Krwx+DZj45uweV6cHXt2JwJEI9fWB6WyBlDejWw== vincent@IDEE") + self.assertEqual(key.id, 2626650) + + def testGetEvents(self): + self.assertListKeyBegin(self.user.get_events(), lambda e: e.type, ["PushEvent", "IssuesEvent", "IssueCommentEvent", "PushEvent"]) + + def testGetOrganizationEvents(self): + self.assertListKeyBegin(self.user.get_organization_events(self.g.get_organization("BeaverSoftware")), lambda e: e.type, ["CreateEvent", "CreateEvent", "PushEvent", "PushEvent"]) + + def testGetGists(self): + self.assertListKeyEqual(self.user.get_gists(), lambda g: g.id, ["2793505", "2793179", "11cb445f8197e17d303d", "1942384", "dcb7de17e8a52b74541d"]) + + def testGetStarredGists(self): + self.assertListKeyEqual(self.user.get_starred_gists(), lambda g: g.id, ["1942384", "dcb7de17e8a52b74541d"]) + + def testGetIssues(self): + self.assertListKeyEqual(self.user.get_issues(), lambda i: (i.id, i.repository.name), [(4639931, "PyGithub"), (4452000, "PyGithub"), (4356743, "PyGithub"), (3716033, "PyGithub"), (3715946, "PyGithub"), (3643837, "PyGithub"), (3628022, "PyGithub"), (3624595, "PyGithub"), (3624570, "PyGithub"), (3624561, "PyGithub"), (3624556, "PyGithub"), (3619973, "PyGithub"), (3527266, "PyGithub"), (3527245, "PyGithub"), (3527231, "PyGithub")]) + + def testGetKeys(self): + self.assertListKeyEqual(self.user.get_keys(), lambda k: k.title, ["vincent@home", "vincent@gandi", "vincent@aws", "vincent@macbook"]) + + def testGetOrgs(self): + self.assertListKeyEqual(self.user.get_orgs(), lambda o: o.login, ["BeaverSoftware"]) + + def testGetRepos(self): + self.assertListKeyEqual(self.user.get_repos(), lambda r: r.name, ["TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE"]) + + def testGetReposWithArguments(self): + self.assertListKeyEqual(self.user.get_repos("public", "full_name", "desc"), lambda r: r.name, ["ViDE", "QuadProgMm", "PyGithub", "DrawTurksHead", "DrawSyntax", "django", "developer.github.com", "C4Planner", "Boost.HierarchicalEnum", "acme-public-website"]) + + def testCreateFork(self): + repo = self.user.create_fork(self.g.get_user("nvie").get_repo("gitflow")) + self.assertEqual(repo.source.full_name, "nvie/gitflow") diff --git a/github/tests/Authentication.py b/github/tests/Authentication.py new file mode 100644 index 00000000..7d585933 --- /dev/null +++ b/github/tests/Authentication.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework +import github + + +class Authentication(Framework.BasicTestCase): + def testNoAuthentication(self): + g = github.Github() + self.assertEqual(g.get_user("jacquev6").name, "Vincent Jacques") + + def testBasicAuthentication(self): + g = github.Github(self.login, self.password) + self.assertEqual(g.get_user("jacquev6").name, "Vincent Jacques") + + def testOAuthAuthentication(self): + g = github.Github(self.oauth_token) + self.assertEqual(g.get_user("jacquev6").name, "Vincent Jacques") + + # Warning: I don't have a scret key, so the requests for this test are forged + def testSecretKeyAuthentication(self): + g = github.Github(client_id=self.client_id, client_secret=self.client_secret) + self.assertListKeyEqual(g.get_organization("BeaverSoftware").get_repos("public"), lambda r: r.name, ["FatherBeaver", "PyGithub"]) + + def testUserAgent(self): + g = github.Github(user_agent="PyGithubTester") + self.assertEqual(g.get_user("jacquev6").name, "Vincent Jacques") diff --git a/github/tests/Authorization.py b/github/tests/Authorization.py new file mode 100644 index 00000000..9e79ca1c --- /dev/null +++ b/github/tests/Authorization.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + +import datetime + + +class Authorization(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.authorization = self.g.get_user().get_authorization(372259) + + def testAttributes(self): + self.assertEqual(self.authorization.app.url, "http://developer.github.com/v3/oauth/#oauth-authorizations-api") + self.assertEqual(self.authorization.app.name, "GitHub API") + self.assertEqual(self.authorization.created_at, datetime.datetime(2012, 5, 22, 18, 3, 17)) + self.assertEqual(self.authorization.id, 372259) + self.assertEqual(self.authorization.note, None) + self.assertEqual(self.authorization.note_url, None) + self.assertEqual(self.authorization.scopes, []) + self.assertEqual(self.authorization.token, "82459c4500086f8f0cc67d2936c17d1e27ad1c33") + self.assertEqual(self.authorization.updated_at, datetime.datetime(2012, 5, 22, 18, 3, 17)) + self.assertEqual(self.authorization.url, "https://api.github.com/authorizations/372259") + + def testEdit(self): + self.authorization.edit() + self.assertEqual(self.authorization.scopes, []) + self.authorization.edit(scopes=["user"]) + self.assertEqual(self.authorization.scopes, ["user"]) + self.authorization.edit(add_scopes=["repo"]) + self.assertEqual(self.authorization.scopes, ["user", "repo"]) + self.authorization.edit(remove_scopes=["repo"]) + self.assertEqual(self.authorization.scopes, ["user"]) + self.assertEqual(self.authorization.note, None) + self.assertEqual(self.authorization.note_url, None) + self.authorization.edit(note="Note created by PyGithub", note_url="http://vincent-jacques.net/PyGithub") + self.assertEqual(self.authorization.note, "Note created by PyGithub") + self.assertEqual(self.authorization.note_url, "http://vincent-jacques.net/PyGithub") + + def testDelete(self): + self.authorization.delete() diff --git a/test/Branch.py b/github/tests/Branch.py similarity index 66% rename from test/Branch.py rename to github/tests/Branch.py index 4983cbcb..27feeb62 100644 --- a/test/Branch.py +++ b/github/tests/Branch.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -13,11 +15,12 @@ import Framework -class Branch( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.branch = self.g.get_user().get_repo( "PyGithub" ).get_branches()[ 0 ] - def testAttributes( self ): - self.assertEqual( self.branch.name, "topic/RewriteWithGeneratedCode" ) - self.assertEqual( self.branch.commit.sha, "1292bf0e22c796e91cc3d6e24b544aece8c21f2a" ) +class Branch(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.branch = self.g.get_user().get_repo("PyGithub").get_branches()[0] + + def testAttributes(self): + self.assertEqual(self.branch.name, "topic/RewriteWithGeneratedCode") + self.assertEqual(self.branch.commit.sha, "1292bf0e22c796e91cc3d6e24b544aece8c21f2a") diff --git a/github/tests/Commit.py b/github/tests/Commit.py new file mode 100644 index 00000000..ac9275e0 --- /dev/null +++ b/github/tests/Commit.py @@ -0,0 +1,83 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + + +class Commit(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.commit = self.g.get_user().get_repo("PyGithub").get_commit("1292bf0e22c796e91cc3d6e24b544aece8c21f2a") + self.commit.author.login # to force lazy completion + + def testAttributes(self): + self.assertEqual(self.commit.author.login, "jacquev6") + self.assertEqual(self.commit.commit.url, "https://api.github.com/repos/jacquev6/PyGithub/git/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a") + self.assertEqual(self.commit.committer.login, "jacquev6") + self.assertEqual(len(self.commit.files), 1) + self.assertEqual(self.commit.files[0].additions, 0) + self.assertEqual(self.commit.files[0].blob_url, "https://github.com/jacquev6/PyGithub/blob/1292bf0e22c796e91cc3d6e24b544aece8c21f2a/github/GithubObjects/GitAuthor.py") + self.assertEqual(self.commit.files[0].changes, 20) + self.assertEqual(self.commit.files[0].deletions, 20) + self.assertEqual(self.commit.files[0].filename, "github/GithubObjects/GitAuthor.py") + self.assertTrue(isinstance(self.commit.files[0].patch, (str, unicode))) + self.assertEqual(self.commit.files[0].raw_url, "https://github.com/jacquev6/PyGithub/raw/1292bf0e22c796e91cc3d6e24b544aece8c21f2a/github/GithubObjects/GitAuthor.py") + self.assertEqual(self.commit.files[0].sha, "1292bf0e22c796e91cc3d6e24b544aece8c21f2a") + self.assertEqual(self.commit.files[0].status, "modified") + self.assertEqual(len(self.commit.parents), 1) + self.assertEqual(self.commit.parents[0].sha, "b46ed0dfde5ad02d3b91eb54a41c5ed960710eae") + self.assertEqual(self.commit.sha, "1292bf0e22c796e91cc3d6e24b544aece8c21f2a") + self.assertEqual(self.commit.stats.deletions, 20) + self.assertEqual(self.commit.stats.additions, 0) + self.assertEqual(self.commit.stats.total, 20) + self.assertEqual(self.commit.url, "https://api.github.com/repos/jacquev6/PyGithub/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a") + + def testGetComments(self): + self.assertListKeyEqual(self.commit.get_comments(), lambda c: c.id, [1347033, 1347083, 1347397, 1349654]) + + def testCreateComment(self): + comment = self.commit.create_comment("Comment created by PyGithub") + self.assertEqual(comment.id, 1361949) + self.assertEqual(comment.line, None) + self.assertEqual(comment.path, None) + self.assertEqual(comment.position, None) + + def testCreateCommentOnFileLine(self): + comment = self.commit.create_comment("Comment created by PyGithub", path="codegen/templates/GithubObject.MethodBody.UseResult.py", line=26) + self.assertEqual(comment.id, 1362000) + self.assertEqual(comment.line, 26) + self.assertEqual(comment.path, "codegen/templates/GithubObject.MethodBody.UseResult.py") + self.assertEqual(comment.position, None) + + def testCreateCommentOnFilePosition(self): + comment = self.commit.create_comment("Comment also created by PyGithub", path="codegen/templates/GithubObject.MethodBody.UseResult.py", position=3) + self.assertEqual(comment.id, 1362001) + self.assertEqual(comment.line, None) + self.assertEqual(comment.path, "codegen/templates/GithubObject.MethodBody.UseResult.py") + self.assertEqual(comment.position, 3) + + def testCreateStatusWithoutOptionalParameters(self): + status = self.commit.create_status("pending") + self.assertEqual(status.id, 277031) + self.assertEqual(status.state, "pending") + self.assertEqual(status.target_url, None) + self.assertEqual(status.description, None) + + def testCreateStatusWithAllParameters(self): + status = self.commit.create_status("success", "https://github.com/jacquev6/PyGithub/issues/67", "Status successfuly created by PyGithub") + self.assertEqual(status.id, 277040) + self.assertEqual(status.state, "success") + self.assertEqual(status.target_url, "https://github.com/jacquev6/PyGithub/issues/67") + self.assertEqual(status.description, "Status successfuly created by PyGithub") diff --git a/github/tests/CommitComment.py b/github/tests/CommitComment.py new file mode 100644 index 00000000..2bead16e --- /dev/null +++ b/github/tests/CommitComment.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + +import datetime + + +class CommitComment(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.comment = self.g.get_user().get_repo("PyGithub").get_comment(1361949) + + def testAttributes(self): + self.assertEqual(self.comment.body, "Comment created by PyGithub") + self.assertEqual(self.comment.commit_id, "6945921c529be14c3a8f566dd1e483674516d46d") + self.assertEqual(self.comment.created_at, datetime.datetime(2012, 5, 22, 18, 40, 18)) + self.assertEqual(self.comment.html_url, "https://github.com/jacquev6/PyGithub/commit/6945921c529be14c3a8f566dd1e483674516d46d#commitcomment-1361949") + self.assertEqual(self.comment.id, 1361949) + self.assertEqual(self.comment.line, None) + self.assertEqual(self.comment.path, None) + self.assertEqual(self.comment.position, None) + self.assertEqual(self.comment.updated_at, datetime.datetime(2012, 5, 22, 18, 40, 18)) + self.assertEqual(self.comment.url, "https://api.github.com/repos/jacquev6/PyGithub/comments/1361949") + self.assertEqual(self.comment.user.login, "jacquev6") + + def testEdit(self): + self.comment.edit("Comment edited by PyGithub") + + def testDelete(self): + self.comment.delete() diff --git a/github/tests/CommitStatus.py b/github/tests/CommitStatus.py new file mode 100644 index 00000000..2ce0e867 --- /dev/null +++ b/github/tests/CommitStatus.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + +import github +import datetime + + +class CommitStatus(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.statuses = list(self.g.get_user().get_repo("PyGithub").get_commit("1292bf0e22c796e91cc3d6e24b544aece8c21f2a").get_statuses()) + + def testAttributes(self): + self.assertEqual(self.statuses[0].created_at, datetime.datetime(2012, 9, 8, 11, 30, 56)) + self.assertEqual(self.statuses[0].updated_at, datetime.datetime(2012, 9, 8, 11, 30, 56)) + self.assertEqual(self.statuses[0].creator.login, "jacquev6") + self.assertEqual(self.statuses[0].description, "Status successfuly created by PyGithub") + self.assertEqual(self.statuses[1].description, None) + self.assertEqual(self.statuses[0].id, 277040) + self.assertEqual(self.statuses[0].state, "success") + self.assertEqual(self.statuses[1].state, "pending") + self.assertEqual(self.statuses[0].target_url, "https://github.com/jacquev6/PyGithub/issues/67") + self.assertEqual(self.statuses[1].target_url, None) diff --git a/github/tests/ContentFile.py b/github/tests/ContentFile.py new file mode 100644 index 00000000..04a4933a --- /dev/null +++ b/github/tests/ContentFile.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import base64 +import sys + +import Framework + +import github +import datetime + +atLeastPython3 = sys.hexversion >= 0x03000000 + + +class ContentFile(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.file = self.g.get_user().get_repo("PyGithub").get_readme() + + def testAttributes(self): + self.assertEqual(self.file.type, "file") + self.assertEqual(self.file.encoding, "base64") + self.assertEqual(self.file.size, 7531) + self.assertEqual(self.file.name, "ReadMe.md") + self.assertEqual(self.file.path, "ReadMe.md") + if atLeastPython3: + self.assertEqual(len(base64.b64decode(bytearray(self.file.content, "utf-8"))), 7531) # pragma no cover + else: + self.assertEqual(len(base64.b64decode(self.file.content)), 7531) + self.assertEqual(self.file.sha, "5628799a7d517a4aaa0c1a7004d07569cd154df0") diff --git a/github/tests/Download.py b/github/tests/Download.py new file mode 100644 index 00000000..a24dcfd4 --- /dev/null +++ b/github/tests/Download.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + +import datetime + + +class Download(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.download = self.g.get_user().get_repo("PyGithub").get_download(242550) + + def testAttributes(self): + self.assertEqual(self.download.accesskeyid, None) + self.assertEqual(self.download.acl, None) + self.assertEqual(self.download.bucket, None) + self.assertEqual(self.download.content_type, "text/plain") + self.assertEqual(self.download.created_at, datetime.datetime(2012, 5, 22, 18, 58, 32)) + self.assertEqual(self.download.description, None) + self.assertEqual(self.download.download_count, 0) + self.assertEqual(self.download.expirationdate, None) + self.assertEqual(self.download.html_url, "https://github.com/downloads/jacquev6/PyGithub/Foobar.txt") + self.assertEqual(self.download.id, 242550) + self.assertEqual(self.download.mime_type, None) + self.assertEqual(self.download.name, "Foobar.txt") + self.assertEqual(self.download.path, None) + self.assertEqual(self.download.policy, None) + self.assertEqual(self.download.prefix, None) + self.assertEqual(self.download.redirect, None) + self.assertEqual(self.download.s3_url, None) + self.assertEqual(self.download.signature, None) + self.assertEqual(self.download.size, 1024) + self.assertEqual(self.download.url, "https://api.github.com/repos/jacquev6/PyGithub/downloads/242550") + + def testDelete(self): + self.download.delete() diff --git a/github/tests/Enterprise.py b/github/tests/Enterprise.py new file mode 100644 index 00000000..ee8f73a2 --- /dev/null +++ b/github/tests/Enterprise.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import github + +import Framework + + +# Replay data for this test case is forged, because I don't have access to a real Github Enterprise install +class Enterprise(Framework.BasicTestCase): + def testHttps(self): + g = github.Github(self.login, self.password, base_url="https://my.enterprise.com") + self.assertListKeyEqual(g.get_user().get_repos(), lambda r: r.name, ["TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE"]) + + def testHttp(self): + g = github.Github(self.login, self.password, base_url="http://my.enterprise.com") + self.assertListKeyEqual(g.get_user().get_repos(), lambda r: r.name, ["TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE"]) + + def testLongUrl(self): + g = github.Github(self.login, self.password, base_url="http://my.enterprise.com/path/to/github") + repos = g.get_user().get_repos() + self.assertListKeyEqual(repos, lambda r: r.name, ["TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE"]) + self.assertEqual(repos[0].owner.name, "Vincent Jacques") + + def testSpecificPort(self): + g = github.Github(self.login, self.password, base_url="http://my.enterprise.com:8080") + self.assertListKeyEqual(g.get_user().get_repos(), lambda r: r.name, ["TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE"]) diff --git a/github/tests/Event.py b/github/tests/Event.py new file mode 100644 index 00000000..5d518dfb --- /dev/null +++ b/github/tests/Event.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + +import datetime + + +class Event(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.event = self.g.get_user("jacquev6").get_events()[0] + + def testAttributes(self): + self.assertEqual(self.event.actor.login, "jacquev6") + self.assertEqual(self.event.created_at, datetime.datetime(2012, 5, 26, 10, 1, 39)) + self.assertEqual(self.event.id, "1556114751") + self.assertEqual(self.event.org, None) + self.assertEqual(self.event.payload, {u'commits': [{u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/5bb654d26dd014d36794acd1e6ecf3736f12aad7', u'sha': u'5bb654d26dd014d36794acd1e6ecf3736f12aad7', u'message': u'Implement the three authentication schemes', u'distinct': False, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/cb0313157bf904f2d364377d35d9397b269547a5', u'sha': u'cb0313157bf904f2d364377d35d9397b269547a5', u'message': u"Merge branch 'topic/Authentication' into develop", u'distinct': False, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/0cec0d25e606c023a62a4fc7cdc815309ebf6d16', u'sha': u'0cec0d25e606c023a62a4fc7cdc815309ebf6d16', u'message': u'Publish version 0.7', u'distinct': False, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/ecda065e01876209d2bdf5fe4e91cee8ffaa9ff7', u'sha': u'ecda065e01876209d2bdf5fe4e91cee8ffaa9ff7', u'message': u"Merge branch 'develop'", u'distinct': False, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/3a3bf4763192ee1234eb0557628133e06f3dfc76', u'sha': u'3a3bf4763192ee1234eb0557628133e06f3dfc76', u'message': u"Merge branch 'master' into topic/RewriteWithGeneratedCode\n\nConflicts:\n\tgithub/Github.py\n\tgithub/Requester.py", u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/608f17794664f61693a3dc05e6056fea8fbef0ff', u'sha': u'608f17794664f61693a3dc05e6056fea8fbef0ff', u'message': u'Restore some form of Authorization header in replay data', u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/2c04b8adbd91d38eef4f0767337ab7a12b2f684b', u'sha': u'2c04b8adbd91d38eef4f0767337ab7a12b2f684b', u'message': u'Allow test without pre-set-up Github', u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/5b97389988b6fe43e15a079702f6f1671257fb28', u'sha': u'5b97389988b6fe43e15a079702f6f1671257fb28', u'message': u'Test three authentication schemes', u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/12747613c5ec00deccf296b8619ad507f7050475', u'sha': u'12747613c5ec00deccf296b8619ad507f7050475', u'message': u'Test Issue.getComments', u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/2982fa96c5ca75abe717d974d83f9135d664232e', u'sha': u'2982fa96c5ca75abe717d974d83f9135d664232e', u'message': u'Test the new Repository.full_name attribute', u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/619eae8d51c5988f0d2889fc767fa677438ba95d', u'sha': u'619eae8d51c5988f0d2889fc767fa677438ba95d', u'message': u'Improve coverage of AuthenticatedUser', u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}], u'head': u'619eae8d51c5988f0d2889fc767fa677438ba95d', u'push_id': 80673538, u'ref': u'refs/heads/topic/RewriteWithGeneratedCode', u'size': 11}) + self.assertEqual(self.event.public, True) + self.assertEqual(self.event.repo.name, "jacquev6/PyGithub") + self.assertEqual(self.event.type, "PushEvent") diff --git a/github/tests/Exceptions.py b/github/tests/Exceptions.py new file mode 100644 index 00000000..ddbdbd1d --- /dev/null +++ b/github/tests/Exceptions.py @@ -0,0 +1,93 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import github +import sys + +import Framework + +atLeastPython26 = sys.hexversion >= 0x02060000 +atMostPython2 = sys.hexversion < 0x03000000 + + +class Exceptions(Framework.TestCase): # To stay compatible with Python 2.6, we do not use self.assertRaises with only one argument + def testInvalidInput(self): + raised = False + try: + self.g.get_user().create_key("Bad key", "xxx") + except github.GithubException, exception: + raised = True + self.assertEqual(exception.status, 422) + self.assertEqual( + exception.data, + { + "errors": [ + { + "code": "custom", + "field": "key", + "message": "key is invalid. It must begin with 'ssh-rsa' or 'ssh-dss'. Check that you're copying the public half of the key", + "resource": "PublicKey" + } + ], + "message": "Validation Failed" + } + ) + if atLeastPython26 and atMostPython2: + self.assertEqual(str(exception), "422 {u\'message\': u\'Validation Failed\', u\'errors\': [{u\'field\': u\'key\', u\'message\': u\"key is invalid. It must begin with \'ssh-rsa\' or \'ssh-dss\'. Check that you\'re copying the public half of the key\", u\'code\': u\'custom\', u\'resource\': u\'PublicKey\'}]}") + else: + self.assertEqual(str(exception), "422 {\'message\': \'Validation Failed\', \'errors\': [{\'field\': \'key\', \'message\': \"key is invalid. It must begin with \'ssh-rsa\' or \'ssh-dss\'. Check that you\'re copying the public half of the key\", \'code\': \'custom\', \'resource\': \'PublicKey\'}]}") # pragma no cover + self.assertTrue(raised) + + def testUnknownObject(self): + raised = False + try: + self.g.get_user().get_repo("Xxx") + except github.GithubException, exception: + raised = True + self.assertEqual(exception.status, 404) + self.assertEqual(exception.data, {"message": "Not Found"}) + if atLeastPython26 and atMostPython2: + self.assertEqual(str(exception), "404 {u'message': u'Not Found'}") + else: + self.assertEqual(str(exception), "404 {'message': 'Not Found'}") # pragma no cover + self.assertTrue(raised) + + def testUnknownUser(self): + raised = False + try: + self.g.get_user("ThisUserShouldReallyNotExist") + except github.GithubException, exception: + raised = True + self.assertEqual(exception.status, 404) + self.assertEqual(exception.data, {"message": "Not Found"}) + if atLeastPython26 and atMostPython2: + self.assertEqual(str(exception), "404 {u'message': u'Not Found'}") + else: + self.assertEqual(str(exception), "404 {'message': 'Not Found'}") # pragma no cover + self.assertTrue(raised) + + def testBadAuthentication(self): + raised = False + try: + github.Github("BadUser", "BadPassword").get_user().login + except github.GithubException, exception: + raised = True + self.assertEqual(exception.status, 401) + self.assertEqual(exception.data, {"message": "Bad credentials"}) + if atLeastPython26 and atMostPython2: + self.assertEqual(str(exception), "401 {u'message': u'Bad credentials'}") + else: + self.assertEqual(str(exception), "401 {'message': 'Bad credentials'}") # pragma no cover + self.assertTrue(raised) diff --git a/github/tests/Framework.py b/github/tests/Framework.py new file mode 100644 index 00000000..f9c38c6d --- /dev/null +++ b/github/tests/Framework.py @@ -0,0 +1,195 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import os +import sys +import unittest +import httplib +import traceback + +import github + + +class FakeHttpResponse: + def __init__(self, status, headers, output): + self.status = status + self.__headers = headers + self.__output = output + + def getheaders(self): + return self.__headers + + def read(self): + return self.__output + + +def fixAuthorizationHeader(headers): + if "Authorization" in headers: + if headers["Authorization"].startswith("token "): + headers["Authorization"] = "token private_token_removed" + elif headers["Authorization"].startswith("Basic "): + headers["Authorization"] = "Basic login_and_password_removed" + else: # pragma no cover + assert False + + +class RecordingConnection: # pragma no cover + def __init__(self, file, protocol, host, port, *args, **kwds): + self.__file = file + self.__protocol = protocol + self.__host = host + self.__port = str(port) + self.__cnx = self._realConnection(host, port, *args, **kwds) + + def request(self, verb, url, input, headers): + print verb, url, input, headers, + self.__cnx.request(verb, url, input, headers) + fixAuthorizationHeader(headers) + self.__file.write(self.__protocol + " " + verb + " " + self.__host + " " + self.__port + " " + url + " " + str(headers) + " " + input + "\n") + + def getresponse(self): + res = self.__cnx.getresponse() + + status = res.status + print "=>", status + headers = res.getheaders() + output = res.read() + + self.__file.write(str(status) + "\n") + self.__file.write(str(headers) + "\n") + self.__file.write(str(output) + "\n") + + return FakeHttpResponse(status, headers, output) + + def close(self): + self.__file.write("\n") + return self.__cnx.close() + + +class RecordingHttpConnection(RecordingConnection): # pragma no cover + _realConnection = httplib.HTTPConnection + + def __init__(self, file, *args, **kwds): + RecordingConnection.__init__(self, file, "http", *args, **kwds) + + +class RecordingHttpsConnection(RecordingConnection): # pragma no cover + _realConnection = httplib.HTTPSConnection + + def __init__(self, file, *args, **kwds): + print args, kwds + RecordingConnection.__init__(self, file, "https", *args, **kwds) + + +class ReplayingConnection: + def __init__(self, testCase, file, protocol, host, port, *args, **kwds): + self.__testCase = testCase + self.__file = file + self.__protocol = protocol + self.__host = host + self.__port = str(port) + + def request(self, verb, url, input, headers): + fixAuthorizationHeader(headers) + expectation = self.__file.readline().strip() + self.__testCase.assertEqual(self.__protocol + " " + verb + " " + self.__host + " " + self.__port + " " + url + " " + str(headers) + " " + input, expectation) + + def getresponse(self): + status = int(self.__file.readline().strip()) + headers = eval(self.__file.readline().strip()) + output = self.__file.readline().strip() + + return FakeHttpResponse(status, headers, output) + + def close(self): + self.__file.readline() + + +def ReplayingHttpConnection(testCase, file, *args, **kwds): + return ReplayingConnection(testCase, file, "http", *args, **kwds) + + +def ReplayingHttpsConnection(testCase, file, *args, **kwds): + return ReplayingConnection(testCase, file, "https", *args, **kwds) + + +class BasicTestCase(unittest.TestCase): + recordMode = False + + def setUp(self): + unittest.TestCase.setUp(self) + self.__fileName = "" + self.__file = None + if self.recordMode: # pragma no cover + github.Requester.Requester.injectConnectionClasses( + lambda ignored, *args, **kwds: RecordingHttpConnection(self.__openFile("wb"), *args, **kwds), + lambda ignored, *args, **kwds: RecordingHttpsConnection(self.__openFile("wb"), *args, **kwds) + ) + import GithubCredentials + self.login = GithubCredentials.login + self.password = GithubCredentials.password + self.oauth_token = GithubCredentials.oauth_token + # @todo Remove client_id and client_secret from ReplayData (as we already remove login, password and oauth_token) + # self.client_id = GithubCredentials.client_id + # self.client_secret = GithubCredentials.client_secret + else: + github.Requester.Requester.injectConnectionClasses( + lambda ignored, *args, **kwds: ReplayingHttpConnection(self, self.__openFile("r"), *args, **kwds), + lambda ignored, *args, **kwds: ReplayingHttpsConnection(self, self.__openFile("r"), *args, **kwds) + ) + self.login = "login" + self.password = "password" + self.oauth_token = "oauth_token" + self.client_id = "client_id" + self.client_secret = "client_secret" + + def tearDown(self): + unittest.TestCase.tearDown(self) + self.__closeReplayFileIfNeeded() + + def __openFile(self, mode): + for (_, _, functionName, _) in traceback.extract_stack(): + if functionName.startswith("test") or functionName == "setUp" or functionName == "tearDown": + if functionName != "test": # because in class Hook(Framework.TestCase), method testTest calls Hook.test + fileName = os.path.join(os.path.dirname(__file__), "ReplayData", self.__class__.__name__ + "." + functionName + ".txt") + if fileName != self.__fileName: + self.__closeReplayFileIfNeeded() + self.__fileName = fileName + self.__file = open(self.__fileName, mode) + return self.__file + + def __closeReplayFileIfNeeded(self): + if self.__file is not None: + if not self.recordMode: # pragma no branch + self.assertEqual(self.__file.readline(), "") + self.__file.close() + + def assertListKeyEqual(self, elements, key, expectedKeys): + realKeys = [key(element) for element in elements] + self.assertEqual(realKeys, expectedKeys) + + def assertListKeyBegin(self, elements, key, expectedKeys): + realKeys = [key(element) for element in elements[: len(expectedKeys)]] + self.assertEqual(realKeys, expectedKeys) + + +class TestCase(BasicTestCase): + def setUp(self): + BasicTestCase.setUp(self) + self.g = github.Github(self.login, self.password) + + +def activateRecordMode(): # pragma no cover + BasicTestCase.recordMode = True diff --git a/github/tests/Gist.py b/github/tests/Gist.py new file mode 100644 index 00000000..7e72311f --- /dev/null +++ b/github/tests/Gist.py @@ -0,0 +1,89 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + +import github +import datetime + + +class Gist(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.gist = self.g.get_gist("2729810") + + def testAttributes(self): + self.assertEqual(self.gist.comments, 0) + self.assertEqual(self.gist.created_at, datetime.datetime(2012, 2, 29, 16, 47, 12)) + self.assertEqual(self.gist.description, "How to error 500 Github API v3, as requested by Rick (GitHub Staff)") + self.assertEqual(self.gist.files.keys(), ["fail_github.py"]) + self.assertEqual(self.gist.files["fail_github.py"].size, 1636) + self.assertEqual(self.gist.files["fail_github.py"].filename, "fail_github.py") + self.assertEqual(self.gist.files["fail_github.py"].language, "Python") + self.assertEqual(self.gist.files["fail_github.py"].content, 'import httplib\nimport base64\nimport json\n\nlogin = ""\npassword = ""\norgName = ""\nrepoName = "FailGithubApi"\n\ndef doRequest( verb, url, input ):\n input = json.dumps( input )\n cnx = httplib.HTTPSConnection( "api.github.com", strict = True )\n cnx.request( verb, url, input, { "Authorization" : "Basic " + base64.b64encode( login + ":" + password ).replace( \'\\n\', \'\' ) } )\n response = cnx.getresponse()\n status = response.status\n output = response.read()\n cnx.close()\n print verb, url, input, "=>", status, output\n print\n if status < 200 or status >= 300:\n exit( 1 )\n return json.loads( output )\n\n# Create a repo\ndoRequest( "POST", "/user/repos", { "name": repoName } )\n\n# Create a blob, a tree, a commit and the master branch\nb = doRequest(\n "POST", "/repos/%s/%s/git/blobs" % ( login, repoName ),\n { "content": "Content of the blob", "encoding": "latin1" }\n)\nt = doRequest(\n "POST", "/repos/%s/%s/git/trees" % ( login, repoName ),\n { "tree" : [ { "path": "foo.bar", "type": "blob", "mode": "100644", "sha": b["sha"] } ] }\n)\nc = doRequest(\n "POST", "/repos/%s/%s/git/commits" % ( login, repoName ),\n { "parents": [], "message": "Message of the commit", "tree": t["sha"] }\n)\ndoRequest(\n "POST", "/repos/%s/%s/git/refs" % ( login, repoName ),\n { "ref": "refs/heads/master", "sha": c["sha"] }\n)\n\n# Fork the repo\ndoRequest( "POST", "/repos/%s/%s/forks?org=%s" % ( login, repoName, orgName ), None )\n\n# Create a new blob => BOOM error 500\ndoRequest(\n "POST", "/repos/%s/%s/git/blobs" % ( orgName, repoName ),\n { "content": "Content of the new blob", "encoding": "latin1" }\n)\n') + self.assertEqual(self.gist.files["fail_github.py"].raw_url, "https://gist.github.com/raw/2729810/2fb3aa84e0efa50dc0f4c18b5df5b7b9ab27076b/fail_github.py") + self.assertEqual(self.gist.forks, []) + self.assertEqual(self.gist.git_pull_url, "git://gist.github.com/2729810.git") + self.assertEqual(self.gist.git_push_url, "git@gist.github.com:2729810.git") + self.assertEqual(len(self.gist.history), 1) + self.assertEqual(self.gist.history[0].change_status.additions, 52) + self.assertEqual(self.gist.history[0].change_status.deletions, 0) + self.assertEqual(self.gist.history[0].change_status.total, 52) + self.assertEqual(self.gist.history[0].committed_at, datetime.datetime(2012, 2, 29, 16, 47, 12)) + self.assertEqual(self.gist.history[0].url, "https://api.github.com/gists/2729810/a40de483e42ba33bda308371c0ef8383db73be9e") + self.assertEqual(self.gist.history[0].user.login, "jacquev6") + self.assertEqual(self.gist.history[0].version, "a40de483e42ba33bda308371c0ef8383db73be9e") + self.assertEqual(self.gist.html_url, "https://gist.github.com/2729810") + self.assertEqual(self.gist.id, "2729810") + self.assertEqual(self.gist.public, True) + self.assertEqual(self.gist.updated_at, datetime.datetime(2012, 2, 29, 16, 47, 12)) + self.assertEqual(self.gist.url, "https://api.github.com/gists/2729810") + self.assertEqual(self.gist.user.login, "jacquev6") + + def testEditWithoutParameters(self): + self.gist.edit() + self.assertEqual(self.gist.description, "Gist created by PyGithub") + self.assertEqual(self.gist.updated_at, datetime.datetime(2012, 5, 19, 7, 0, 58)) + + def testEditWithAllParameters(self): + self.gist.edit("Description edited by PyGithub", {"barbaz.txt": github.InputFileContent("File also created by PyGithub")}) + self.assertEqual(self.gist.description, "Description edited by PyGithub") + self.assertEqual(self.gist.updated_at, datetime.datetime(2012, 5, 19, 7, 6, 10)) + self.assertEqual(self.gist.files.keys(), ["foobar.txt", "barbaz.txt"]) + + def testCreateComment(self): + comment = self.gist.create_comment("Comment created by PyGithub") + self.assertEqual(comment.id, 323629) + + def testGetComments(self): + self.assertListKeyEqual(self.gist.get_comments(), lambda c: c.id, [323637]) + + def testStarring(self): + self.assertFalse(self.gist.is_starred()) + self.gist.set_starred() + self.assertTrue(self.gist.is_starred()) + self.gist.reset_starred() + self.assertFalse(self.gist.is_starred()) + + def testFork(self): + gist = self.g.get_gist("2729818") # Random gist + myGist = gist.create_fork() + self.assertEqual(myGist.id, "2729865") + self.assertEqual(myGist.fork_of, None) # WTF + sameGist = self.g.get_gist("2729865") + self.assertEqual(sameGist.fork_of.id, "2729818") + + def testDelete(self): + self.gist.delete() diff --git a/github/tests/GistComment.py b/github/tests/GistComment.py new file mode 100644 index 00000000..79fe1a1d --- /dev/null +++ b/github/tests/GistComment.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + +import datetime + + +class GistComment(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.comment = self.g.get_gist("2729810").get_comment(323629) + + def testAttributes(self): + self.assertEqual(self.comment.body, "Comment created by PyGithub") + self.assertEqual(self.comment.created_at, datetime.datetime(2012, 5, 19, 7, 7, 57)) + self.assertEqual(self.comment.id, 323629) + self.assertEqual(self.comment.updated_at, datetime.datetime(2012, 5, 19, 7, 7, 57)) + self.assertEqual(self.comment.url, "https://api.github.com/gists/2729810/comments/323629") + self.assertEqual(self.comment.user.login, "jacquev6") + + def testEdit(self): + self.comment.edit("Comment edited by PyGithub") + self.assertEqual(self.comment.body, "Comment edited by PyGithub") + self.assertEqual(self.comment.updated_at, datetime.datetime(2012, 5, 19, 7, 12, 32)) + + def testDelete(self): + self.comment.delete() diff --git a/github/tests/GitBlob.py b/github/tests/GitBlob.py new file mode 100644 index 00000000..e7896f7a --- /dev/null +++ b/github/tests/GitBlob.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + + +class GitBlob(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.blob = self.g.get_user().get_repo("PyGithub").get_git_blob("53bce9fa919b4544e67275089b3ec5b44be20667") + + def testAttributes(self): + self.assertTrue(self.blob.content.startswith("IyEvdXNyL2Jpbi9lbnYgcHl0aG9uCgpmcm9tIGRpc3R1dGlscy5jb3JlIGlt\ncG9ydCBzZXR1cAppbXBvcnQgdGV4dHdyYXAKCnNldHVwKAogICAgbmFtZSA9\n")) + self.assertTrue(self.blob.content.endswith("Z3JhbW1pbmcgTGFuZ3VhZ2UgOjogUHl0aG9uIiwKICAgICAgICAiVG9waWMg\nOjogU29mdHdhcmUgRGV2ZWxvcG1lbnQiLAogICAgXSwKKQo=\n")) + self.assertEqual(len(self.blob.content), 1757) + self.assertEqual(self.blob.encoding, "base64") + self.assertEqual(self.blob.size, 1295) + self.assertEqual(self.blob.sha, "53bce9fa919b4544e67275089b3ec5b44be20667") + self.assertEqual(self.blob.url, "https://api.github.com/repos/jacquev6/PyGithub/git/blobs/53bce9fa919b4544e67275089b3ec5b44be20667") diff --git a/github/tests/GitCommit.py b/github/tests/GitCommit.py new file mode 100644 index 00000000..fe327a4b --- /dev/null +++ b/github/tests/GitCommit.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import datetime + +import Framework + + +class GitCommit(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.commit = self.g.get_user().get_repo("PyGithub").get_git_commit("4303c5b90e2216d927155e9609436ccb8984c495") + + def testAttributes(self): + self.assertEqual(self.commit.author.name, "Vincent Jacques") + self.assertEqual(self.commit.author.email, "vincent@vincent-jacques.net") + self.assertEqual(self.commit.author.date, datetime.datetime(2012, 4, 17, 17, 55, 16)) + self.assertEqual(self.commit.committer.name, "Vincent Jacques") + self.assertEqual(self.commit.committer.email, "vincent@vincent-jacques.net") + self.assertEqual(self.commit.committer.date, datetime.datetime(2012, 4, 17, 17, 55, 16)) + self.assertEqual(self.commit.message, "Merge branch 'develop'\n") + self.assertEqual(len(self.commit.parents), 2) + self.assertEqual(self.commit.parents[0].sha, "936f4a97f1a86392637ec002bbf89ff036a5062d") + self.assertEqual(self.commit.parents[1].sha, "2a7e80e6421c5d4d201d60619068dea6bae612cb") + self.assertEqual(self.commit.sha, "4303c5b90e2216d927155e9609436ccb8984c495") + self.assertEqual(self.commit.tree.sha, "f492784d8ca837779650d1fb406a1a3587a764ad") + self.assertEqual(self.commit.url, "https://api.github.com/repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495") diff --git a/github/tests/GitRef.py b/github/tests/GitRef.py new file mode 100644 index 00000000..357ca8de --- /dev/null +++ b/github/tests/GitRef.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + + +class GitRef(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.ref = self.g.get_user().get_repo("PyGithub").get_git_ref("heads/BranchCreatedByPyGithub") + + def testAttributes(self): + self.assertEqual(self.ref.object.sha, "1292bf0e22c796e91cc3d6e24b544aece8c21f2a") + self.assertEqual(self.ref.object.type, "commit") + self.assertEqual(self.ref.object.url, "https://api.github.com/repos/jacquev6/PyGithub/git/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a") + self.assertEqual(self.ref.ref, "refs/heads/BranchCreatedByPyGithub") + self.assertEqual(self.ref.url, "https://api.github.com/repos/jacquev6/PyGithub/git/refs/heads/BranchCreatedByPyGithub") + + def testEdit(self): + self.ref.edit("04cde900a0775b51f762735637bd30de392a2793") + + def testEditWithForce(self): + self.ref.edit("4303c5b90e2216d927155e9609436ccb8984c495", force=True) + + def testDelete(self): + self.ref.delete() diff --git a/github/tests/GitTag.py b/github/tests/GitTag.py new file mode 100644 index 00000000..2a36dc42 --- /dev/null +++ b/github/tests/GitTag.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import datetime + +import Framework + + +class GitTag(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.tag = self.g.get_user().get_repo("PyGithub").get_git_tag("f5f37322407b02a80de4526ad88d5f188977bc3c") + + def testAttributes(self): + self.assertEqual(self.tag.message, "Version 0.6\n") + self.assertEqual(self.tag.object.sha, "4303c5b90e2216d927155e9609436ccb8984c495") + self.assertEqual(self.tag.object.type, "commit") + self.assertEqual(self.tag.object.url, "https://api.github.com/repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495") + self.assertEqual(self.tag.sha, "f5f37322407b02a80de4526ad88d5f188977bc3c") + self.assertEqual(self.tag.tag, "v0.6") + self.assertEqual(self.tag.tagger.date, datetime.datetime(2012, 5, 10, 18, 14, 15)) + self.assertEqual(self.tag.tagger.email, "vincent@vincent-jacques.net") + self.assertEqual(self.tag.tagger.name, "Vincent Jacques") + self.assertEqual(self.tag.url, "https://api.github.com/repos/jacquev6/PyGithub/git/tags/f5f37322407b02a80de4526ad88d5f188977bc3c") diff --git a/github/tests/GitTree.py b/github/tests/GitTree.py new file mode 100644 index 00000000..6ced3b3a --- /dev/null +++ b/github/tests/GitTree.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + + +class GitTree(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.tree = self.g.get_user().get_repo("PyGithub").get_git_tree("f492784d8ca837779650d1fb406a1a3587a764ad") + + def testAttributes(self): + self.assertEqual(self.tree.sha, "f492784d8ca837779650d1fb406a1a3587a764ad") + self.assertEqual(len(self.tree.tree), 11) + self.assertEqual(self.tree.tree[0].mode, "100644") + self.assertEqual(self.tree.tree[0].path, ".gitignore") + self.assertEqual(self.tree.tree[0].sha, "8a9af1462c3f4e3358315c2d2e6ef1e7334c59dd") + self.assertEqual(self.tree.tree[0].size, 53) + self.assertEqual(self.tree.tree[0].type, "blob") + self.assertEqual(self.tree.tree[0].url, "https://api.github.com/repos/jacquev6/PyGithub/git/blobs/8a9af1462c3f4e3358315c2d2e6ef1e7334c59dd") + self.assertEqual(self.tree.tree[6].mode, "040000") + self.assertEqual(self.tree.tree[6].path, "ReplayDataForIntegrationTest") + self.assertEqual(self.tree.tree[6].sha, "60b4602b2c2070246c5df078fb7a5150b45815eb") + self.assertEqual(self.tree.tree[6].size, None) + self.assertEqual(self.tree.tree[6].type, "tree") + self.assertEqual(self.tree.tree[6].url, "https://api.github.com/repos/jacquev6/PyGithub/git/trees/60b4602b2c2070246c5df078fb7a5150b45815eb") + self.assertEqual(self.tree.url, "https://api.github.com/repos/jacquev6/PyGithub/git/trees/f492784d8ca837779650d1fb406a1a3587a764ad") diff --git a/github/tests/Github_.py b/github/tests/Github_.py new file mode 100644 index 00000000..95a51b5d --- /dev/null +++ b/github/tests/Github_.py @@ -0,0 +1,94 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import datetime + +import Framework + + +class Github(Framework.TestCase): + def testGetGists(self): + self.assertListKeyBegin(self.g.get_gists(), lambda g: g.id, ["2729695", "2729656", "2729597", "2729584", "2729569", "2729554", "2729543", "2729537", "2729536", "2729533", "2729525", "2729522", "2729519", "2729515", "2729506", "2729487", "2729484", "2729482", "2729441", "2729432", "2729420", "2729398", "2729372", "2729371", "2729351", "2729346", "2729316", "2729304", "2729296", "2729276", "2729272", "2729265", "2729195", "2729160", "2729143", "2729127", "2729119", "2729113", "2729103", "2729069", "2729059", "2729051", "2729029", "2729027", "2729026", "2729022", "2729002", "2728985", "2728979", "2728964", "2728937", "2728933", "2728884", "2728869", "2728866", "2728855", "2728854", "2728853", "2728846", "2728825", "2728814", "2728813", "2728812", "2728805", "2728802", "2728800", "2728798", "2728797", "2728796", "2728793", "2728758", "2728754", "2728751", "2728748", "2728721", "2728716", "2728715", "2728705", "2728701", "2728699", "2728697", "2728688", "2728683", "2728677", "2728649", "2728640", "2728625", "2728620", "2728615", "2728614", "2728565", "2728564", "2728554", "2728523", "2728519", "2728511", "2728497", "2728496", "2728495", "2728487"]) + + def testLegacySearchRepos(self): + repos = self.g.legacy_search_repos("github api v3") + self.assertListKeyBegin(repos, lambda r: r.name, ["octokit", "github-v3-api", "github_v3_api"]) + self.assertEqual(repos[0].full_name, "pengwynn/octokit") + + # Attributes retrieved from legacy API without lazy completion call + self.assertEqual(repos[1].created_at, datetime.datetime(2011, 6, 23, 22, 52, 33)) + self.assertEqual(repos[1].name, "github-v3-api") + self.assertEqual(repos[1].watchers, 35) + self.assertEqual(repos[1].has_downloads, True) + self.assertEqual(repos[3].homepage, "http://peter-murach.github.com/github") + self.assertEqual(repos[1].url, "/repos/jwilger/github-v3-api") + self.assertEqual(repos[1].fork, False) + self.assertEqual(repos[1].has_issues, True) + self.assertEqual(repos[1].has_wiki, False) + self.assertEqual(repos[1].forks, 13) + self.assertEqual(repos[1].size, 212) + self.assertEqual(repos[1].private, False) + self.assertEqual(repos[1].open_issues, 2) + self.assertEqual(repos[3].pushed_at, datetime.datetime(2012, 6, 28, 21, 26, 31)) + self.assertEqual(repos[1].description, "Ruby Client for the GitHub v3 API") + self.assertEqual(repos[1].language, "Ruby") + self.assertEqual(repos[1].owner.login, "jwilger") + self.assertEqual(repos[1].owner.url, "/users/jwilger") + + def testLegacySearchReposPagination(self): + repos = self.g.legacy_search_repos("document") + self.assertListKeyBegin(repos, lambda r: r.name, ["git", "nimbus", "kss", "sstoolkit", "lawnchair", "appledoc", "jQ.Mobi", "ipython", "mongoengine", "ravendb", "substance", "symfony-docs", "JavaScript-Garden", "DocSets-for-iOS", "yard", "phpDocumentor2", "phpsh", "Tangle", "Ingredients", "documentjs", "xhp", "couchdb-lucene", "dox", "magento2", "javascriptmvc", "FastPdfKit", "roar", "DocumentUp", "NoRM", "jsdoc", "tagger", "mongodb-csharp", "php-github-api", "beautiful-docs", "mongodb-odm", "iodocs", "seesaw", "bcx-api", "developer.github.com", "amqp", "docsplit", "pycco", "standards-and-practices", "tidy-html5", "redis-doc", "tomdoc", "docs", "flourish", "userguide", "swagger-ui", "rfc", "Weasel-Diesel", "yuidoc", "apigen", "document-viewer", "develop.github.com", "Shanty-Mongo", "PTShowcaseViewController", "gravatar_image_tag", "api-wow-docs", "mongoid-tree", "safari-json-formatter", "mayan", "orm-documentation", "jsfiddle-docs-alpha", "core", "documentcloud", "flexible-nav", "writeCapture", "readium", "xmldocument", "Documentation-Examples", "grails-doc", "stdeb", "aws-autoscaling", "voteable_mongo", "review", "spreadsheet_on_rails", "UKSyntaxColoredTextDocument", "mandango", "bdoc", "Documentation", "documents.com", "rghost", "ticket_mule", "vendo", "khan-api", "spring-data-document-examples", "rspec_api_documentation", "axlsx", "phpdox", "documentation", "Sami", "innershiv", "doxyclean", "documents", "rvm-site", "jqapi", "documentation", "hadoopy", "VichUploaderBundle", "pdoc", "documentation", "wii-js", "oss-docs", "scala-maven-plugin", "Documents", "documenter", "behemoth", "documentation", "documentation", "propelorm.github.com", "Kobold2D", "AutoObjectDocumentation", "php-mongodb-admin", "django-mongokit", "puppet-docs", "docs", "Document", "vendorer", "symfony1-docs", "shocco", "documentation", "jog", "docs", "documentation", "documentation", "documentation", "documentation", "Documentation", "documentation", "documentation", "phpunit-documentation", "ADCtheme", "NelmioApiDocBundle", "iCloud-Singleton-CloudMe", "Documentation", "document", "document_mapper", "heroku-docs", "couchdb-odm", "documentation", "documentation", "document", "documentation", "NanoStore", "documentation", "Documentation", "documentation", "Documentation", "documentation", "document", "documentation", "documentation", "Documentation", "Documentation", "grendel", "ceylon-compiler", "mbtiles-spec", "documentation", "documents", "documents", "Documents", "Documentation", "documentation", "Documentation", "documentation", "documents", "Documentation", "documentation", "documentation", "documents", "Documentation", "documentation", "documenter", "documentation", "documents", "Documents", "documents", "documents", "documentation", "Document", "document", "rdoc", "mongoid_token", "travis-ci.github.com", "Documents", "Documents", "documents", "Document", "Documentation", "documents", "Documents", "Documentation", "documents", "documents", "documents", "documentation", "Documents", "Document", "documents", "documents", "Documentation", "Documentation", "Document", "documents", "Documents", "Documents", "Documentation", "Documents", "documents", "Documents", "document", "documents", "Documentation", "Documents", "documents", "documents", "Documents", "documents", "Documentation", "documentation", "Document", "Documents", "documents", "documents", "documents", "Documentation", "Documentation", "Documents", "Documents", "Documents", "Documenter", "document", "Documentation", "Documents", "Documents", "documentation", "documentation", "Document", "Documents", "Documentation", "Documentation", "Documents", "documents", "Documents", "document", "documentation", "Documents", "documentation", "documentation", "documentation", "Documentation", "Documents", "Documents", "documentation", "Documents", "Documents", "documentation", "documentation", "documents", "Documentation", "documents", "documentation", "Documentation", "Documents", "documentation", "documentation", "documents", "documentation", "Umbraco5Docs", "documents", "Documents", "Documentation", "documents", "document", "documents", "document", "documents", "documentation", "Documents", "documents", "document", "Documents", "Documentation", "Documentation", "documentation", "Documentation", "document", "documentation", "documents", "documents", "Documentations", "document", "documentation", "Documentation", "Document", "Documents", "Documents", "Document"]) + + def testLegacySearchReposExplicitPagination(self): + repos = self.g.legacy_search_repos("python") + self.assertEqual([r.name for r in repos.get_page(4)], ["assetic", "cartodb", "cuisine", "gae-sessions", "geoalchemy2", "Multicorn", "wmfr-timeline", "redis-rdb-tools", "applet-workflows", "TweetBuff", "groovy-core", "StarTrekGame", "Nuevo", "Cupid", "node-sqlserver", "Magnet2Torrent", "GroundControl", "mock-django", "4bit", "mock-django", "Fabulous", "SFML", "pydicas", "flixel", "up", "mongrel2", "SimpleHTTPServerJs", "ultimos", "Archipel", "JSbooks", "nova", "nodebox", "simplehttp", "dablooms", "solarized", "landslide", "jQuery-File-Upload", "jQuery-File-Upload", "jQuery-File-Upload", "password-manager", "electrum", "twitter_nlp", "djangbone", "pyxfst", "node-gyp", "flare", "www.gittip.com", "wymeditor", "Kokobox", "MyCQ", "runwalk", "git-sweep", "HPCPythonSC2012", "sundown", "node2dm", "statirator", "fantastic-futures", "chainsaw", "itcursos-gerenciador-tarefas", "TideSDK", "genmaybot", "melpa", "ConnectedWire", "tarantool", "anserindicus_sn", "luvit", "Minecraft-Overviewer", "Iconic", "pyist.net", "wikibok", "mejorenvo-scraper", "NewsBlur", "SocketRocket", "spf13-vim", "IWantToWorkAtGloboCom", "ruby-style-guide", "aery32-refguide", "fafsite", "compsense_demo", "enaml", "mpi4py", "fi.pycon.org", "scikits-image", "scikits-image", "uni", "mako.vim", "mako.vim", "slumber", "de-composer", "nvm", "helloshopply", "Alianza", "vimfiles", "socorro-crashstats", "menu", "analytics", "elFinder", "riak_wiki", "livestreamer", "git-goggles"]) + + def testLegacySearchReposWithLanguage(self): + repos = self.g.legacy_search_repos("document", language="Python") + self.assertListKeyBegin(repos, lambda r: r.name, ["ipython", "mongoengine", "tagger"]) + self.assertEqual(repos[0].full_name, "ipython/ipython") + + def testLegacySearchUsers(self): + users = self.g.legacy_search_users("vincent") + self.assertListKeyBegin(users, lambda u: u.login, ["nvie", "obra", "lusis"]) + + # Attributes retrieved from legacy API without lazy completion call + self.assertEqual(users[0].gravatar_id, "c5a7f21b46df698f3db31c37ed0cf55a") + self.assertEqual(users[0].name, "Vincent Driessen") + self.assertEqual(users[0].created_at, datetime.datetime(2009, 5, 12, 21, 19, 38)) + self.assertEqual(users[0].location, "Netherlands") + self.assertEqual(users[0].followers, 310) + self.assertEqual(users[0].public_repos, 63) + self.assertEqual(users[0].login, "nvie") + + def testLegacySearchUsersPagination(self): + self.assertEqual(len(list(self.g.legacy_search_users("Lucy"))), 146) + + def testLegacySearchUsersExplicitPagination(self): + users = self.g.legacy_search_users("Lucy") + self.assertEqual([u.login for u in users.get_page(1)], ["lucievh", "lucyim", "Lucief", "RevolverUpstairs", "seriousprogramming", "reicul", "davincidubai", "LucianaNascimentodoPrado", "lucia-huenchunao", "kraji20", "Lucywolo", "Luciel", "sunnysummer", "elush", "oprealuci", "Flika", "lsher", "datadrivenjournalism", "nill2020", "doobi", "lucilu", "deldeldel", "lucianacocca", "lucyli-sfdc", "lucysatchell", "UBM", "kolousek", "lucyzhang", "lmegia", "luisolivo", "Lucyzhen", "Luhzinha", "beautifly", "lucybm96", "BuonocoreL", "lucywilliams", "ZxOxZ", "Motwinb", "johnlucy", "Aquanimation", "alaltaieri", "lucylin", "lucychambers", "JuanSesma", "cdwwebware", "ZachWills"]) + + def testLegacySearchUserByEmail(self): + user = self.g.legacy_search_user_by_email("vincent@vincent-jacques.net") + self.assertEqual(user.login, "jacquev6") + self.assertEqual(user.followers, 13) + + def testGetHooks(self): + hooks = self.g.get_hooks() + hook = hooks[0] + self.assertEqual(hook.name, "activecollab") + self.assertEqual(hook.supported_events, ["push"]) + self.assertEqual(hook.events, ["push"]) + self.assertEqual(hook.schema, [["string", "url"], ["string", "token"], ["string", "project_id"], ["string", "milestone_id"], ["string", "category_id"]]) diff --git a/github/tests/Hook.py b/github/tests/Hook.py new file mode 100644 index 00000000..403a0e4e --- /dev/null +++ b/github/tests/Hook.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + +import datetime + + +class Hook(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.hook = self.g.get_user().get_repo("PyGithub").get_hook(257993) + + def testAttributes(self): + self.assertEqual(self.hook.active, True) # WTF + self.assertEqual(self.hook.config, {"url": "http://foobar.com"}) + self.assertEqual(self.hook.created_at, datetime.datetime(2012, 5, 19, 6, 1, 45)) + self.assertEqual(self.hook.events, ["push"]) + self.assertEqual(self.hook.id, 257993) + self.assertEqual(self.hook.last_response.status, "ok") + self.assertEqual(self.hook.last_response.message, "OK") + self.assertEqual(self.hook.last_response.code, 200) + self.assertEqual(self.hook.name, "web") + self.assertEqual(self.hook.updated_at, datetime.datetime(2012, 5, 29, 18, 49, 47)) + self.assertEqual(self.hook.url, "https://api.github.com/repos/jacquev6/PyGithub/hooks/257993") + + def testEditWithMinimalParameters(self): + self.hook.edit("web", {"url": "http://foobar.com/hook"}) + self.assertEqual(self.hook.config, {"url": "http://foobar.com/hook"}) + self.assertEqual(self.hook.updated_at, datetime.datetime(2012, 5, 19, 5, 8, 16)) + + def testDelete(self): + self.hook.delete() + + def testTest(self): + self.hook.test() # This does not update attributes of hook + + def testEditWithAllParameters(self): + self.hook.edit("web", {"url": "http://foobar.com"}, events=["fork", "push"]) + self.assertEqual(self.hook.events, ["fork", "push"]) + self.hook.edit("web", {"url": "http://foobar.com"}, add_events=["push"]) + self.assertEqual(self.hook.events, ["fork", "push"]) + self.hook.edit("web", {"url": "http://foobar.com"}, remove_events=["fork"]) + self.assertEqual(self.hook.events, ["push"]) + self.hook.edit("web", {"url": "http://foobar.com"}, active=True) + self.assertEqual(self.hook.active, True) diff --git a/github/tests/Issue.py b/github/tests/Issue.py new file mode 100644 index 00000000..7fe40498 --- /dev/null +++ b/github/tests/Issue.py @@ -0,0 +1,102 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + +import datetime + + +class Issue(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.repo = self.g.get_user().get_repo("PyGithub") + self.issue = self.repo.get_issue(28) + + def testAttributes(self): + self.assertEqual(self.issue.assignee.login, "jacquev6") + self.assertEqual(self.issue.body, "Body edited by PyGithub") + self.assertEqual(self.issue.closed_at, datetime.datetime(2012, 5, 26, 14, 59, 33)) + self.assertEqual(self.issue.closed_by.login, "jacquev6") + self.assertEqual(self.issue.comments, 0) + self.assertEqual(self.issue.created_at, datetime.datetime(2012, 5, 19, 10, 38, 23)) + self.assertEqual(self.issue.html_url, "https://github.com/jacquev6/PyGithub/issues/28") + self.assertEqual(self.issue.id, 4653757) + self.assertListKeyEqual(self.issue.labels, lambda l: l.name, ["Bug", "Project management", "Question"]) + self.assertEqual(self.issue.milestone.title, "Version 0.4") + self.assertEqual(self.issue.number, 28) + self.assertEqual(self.issue.pull_request.diff_url, None) + self.assertEqual(self.issue.pull_request.patch_url, None) + self.assertEqual(self.issue.pull_request.html_url, None) + self.assertEqual(self.issue.state, "closed") + self.assertEqual(self.issue.title, "Issue created by PyGithub") + self.assertEqual(self.issue.updated_at, datetime.datetime(2012, 5, 26, 14, 59, 33)) + self.assertEqual(self.issue.url, "https://api.github.com/repos/jacquev6/PyGithub/issues/28") + self.assertEqual(self.issue.user.login, "jacquev6") + + def testEditWithoutParameters(self): + self.issue.edit() + + def testEditWithAllParameters(self): + user = self.g.get_user("jacquev6") + milestone = self.repo.get_milestone(2) + self.issue.edit("Title edited by PyGithub", "Body edited by PyGithub", user, "open", milestone, ["Bug"]) + self.assertEqual(self.issue.assignee.login, "jacquev6") + self.assertEqual(self.issue.body, "Body edited by PyGithub") + self.assertEqual(self.issue.state, "open") + self.assertEqual(self.issue.title, "Title edited by PyGithub") + self.assertListKeyEqual(self.issue.labels, lambda l: l.name, ["Bug"]) + + def testEditResetMilestone(self): + self.assertEqual(self.issue.milestone.title, "Version 0.4") + self.issue.edit(milestone=None) + self.assertEqual(self.issue.milestone, None) + + def testEditResetAssignee(self): + self.assertEqual(self.issue.assignee.login, "jacquev6") + self.issue.edit(assignee=None) + self.assertEqual(self.issue.assignee, None) + + def testCreateComment(self): + comment = self.issue.create_comment("Comment created by PyGithub") + self.assertEqual(comment.id, 5808311) + + def testGetComments(self): + self.assertListKeyEqual(self.issue.get_comments(), lambda c: c.user.login, ["jacquev6", "roskakori"]) + + def testGetEvents(self): + self.assertListKeyEqual(self.issue.get_events(), lambda e: e.id, [15819975, 15820048]) + + def testGetLabels(self): + self.assertListKeyEqual(self.issue.get_labels(), lambda l: l.name, ["Bug", "Project management", "Question"]) + + def testAddAndRemoveLabels(self): + bug = self.repo.get_label("Bug") + question = self.repo.get_label("Question") + self.assertListKeyEqual(self.issue.get_labels(), lambda l: l.name, ["Bug", "Project management", "Question"]) + self.issue.remove_from_labels(bug) + self.assertListKeyEqual(self.issue.get_labels(), lambda l: l.name, ["Project management", "Question"]) + self.issue.remove_from_labels(question) + self.assertListKeyEqual(self.issue.get_labels(), lambda l: l.name, ["Project management"]) + self.issue.add_to_labels(bug, question) + self.assertListKeyEqual(self.issue.get_labels(), lambda l: l.name, ["Bug", "Project management", "Question"]) + + def testDeleteAndSetLabels(self): + bug = self.repo.get_label("Bug") + question = self.repo.get_label("Question") + self.assertListKeyEqual(self.issue.get_labels(), lambda l: l.name, ["Bug", "Project management", "Question"]) + self.issue.delete_labels() + self.assertListKeyEqual(self.issue.get_labels(), None, []) + self.issue.set_labels(bug, question) + self.assertListKeyEqual(self.issue.get_labels(), lambda l: l.name, ["Bug", "Question"]) diff --git a/test/Issue33.py b/github/tests/Issue33.py similarity index 63% rename from test/Issue33.py rename to github/tests/Issue33.py index c5e9ac0f..61d8e429 100644 --- a/test/Issue33.py +++ b/github/tests/Issue33.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -13,13 +15,14 @@ import Framework -class Issue33( Framework.TestCase ): # https://github.com/jacquev6/PyGithub/issues/33 - def setUp( self ): - Framework.TestCase.setUp( self ) - self.repo = self.g.get_user( "openframeworks" ).get_repo( "openFrameworks" ) - def testOpenIssues( self ): - self.assertEqual( len( list( self.repo.get_issues() ) ), 338 ) +class Issue33(Framework.TestCase): # https://github.com/jacquev6/PyGithub/issues/33 + def setUp(self): + Framework.TestCase.setUp(self) + self.repo = self.g.get_user("openframeworks").get_repo("openFrameworks") - def testClosedIssues( self ): - self.assertEqual( len( list( self.repo.get_issues( state = "closed" ) ) ), 950 ) + def testOpenIssues(self): + self.assertEqual(len(list(self.repo.get_issues())), 338) + + def testClosedIssues(self): + self.assertEqual(len(list(self.repo.get_issues(state="closed"))), 950) diff --git a/github/tests/Issue50.py b/github/tests/Issue50.py new file mode 100644 index 00000000..e4bf99df --- /dev/null +++ b/github/tests/Issue50.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import github + +import Framework + + +class Issue50(Framework.TestCase): # https://github.com/jacquev6/PyGithub/issues/50 + def setUp(self): + Framework.TestCase.setUp(self) + self.repo = self.g.get_user().get_repo("PyGithub") + self.issue = self.repo.get_issue(50) + self.labelName = "Label with spaces and strange characters (&*#$)" + + def testCreateLabel(self): + label = self.repo.create_label(self.labelName, "ffff00") + self.assertEqual(label.name, self.labelName) + + def testGetLabel(self): + label = self.repo.get_label(self.labelName) + self.assertEqual(label.name, self.labelName) + + def testGetLabels(self): + self.assertListKeyEqual(self.repo.get_labels(), lambda l: l.name, ["Refactoring", "Public interface", "Functionalities", "Project management", "Bug", "Question", "RequestedByUser", self.labelName]) + + def testAddLabelToIssue(self): + self.issue.add_to_labels(self.repo.get_label(self.labelName)) + + def testRemoveLabelFromIssue(self): + self.issue.remove_from_labels(self.repo.get_label(self.labelName)) + + def testSetIssueLabels(self): + self.issue.set_labels(self.repo.get_label("Bug"), self.repo.get_label("RequestedByUser"), self.repo.get_label(self.labelName)) + + def testIssueLabels(self): + self.assertListKeyEqual(self.issue.labels, lambda l: l.name, ["Bug", self.labelName, "RequestedByUser"]) + + def testIssueGetLabels(self): + self.assertListKeyEqual(self.issue.get_labels(), lambda l: l.name, ["Bug", self.labelName, "RequestedByUser"]) + + def testGetIssuesWithLabel(self): + self.assertListKeyEqual(self.repo.get_issues(labels=[self.repo.get_label(self.labelName)]), lambda i: i.number, [52, 50]) + + def testCreateIssueWithLabel(self): + issue = self.repo.create_issue("Issue created by PyGithub to test issue #50", labels=[self.repo.get_label(self.labelName)]) + self.assertListKeyEqual(issue.labels, lambda l: l.name, [self.labelName]) + self.assertEqual(issue.number, 52) diff --git a/test/Issue54.py b/github/tests/Issue54.py similarity index 59% rename from test/Issue54.py rename to github/tests/Issue54.py index c759831d..df9b2ab0 100644 --- a/test/Issue54.py +++ b/github/tests/Issue54.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -15,12 +17,13 @@ import datetime import Framework -class Issue54( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.repo = self.g.get_user().get_repo( "TestRepo" ) - def testConversion( self ): - commit = self.repo.get_git_commit( "73f320ae06cd565cf38faca34b6a482addfc721b" ) - self.assertEqual( commit.message, "Test commit created around Fri, 13 Jul 2012 18:43:21 GMT, that is vendredi 13 juillet 2012 20:43:21 GMT+2\n" ) - self.assertEqual( commit.author.date, datetime.datetime( 2012, 7, 13, 18, 47, 10 ) ) +class Issue54(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.repo = self.g.get_user().get_repo("TestRepo") + + def testConversion(self): + commit = self.repo.get_git_commit("73f320ae06cd565cf38faca34b6a482addfc721b") + self.assertEqual(commit.message, "Test commit created around Fri, 13 Jul 2012 18:43:21 GMT, that is vendredi 13 juillet 2012 20:43:21 GMT+2\n") + self.assertEqual(commit.author.date, datetime.datetime(2012, 7, 13, 18, 47, 10)) diff --git a/github/tests/Issue80.py b/github/tests/Issue80.py new file mode 100644 index 00000000..fb6643fd --- /dev/null +++ b/github/tests/Issue80.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import github + +import Framework + + +class Issue80(Framework.BasicTestCase): # https://github.com/jacquev6/PyGithub/issues/80 + def testIgnoreHttpsFromGithubEnterprise(self): + g = github.Github(self.login, self.password, base_url="http://my.enterprise.com/some/prefix") # http here + org = g.get_organization("BeaverSoftware") + self.assertEqual(org.url, "https://my.enterprise.com/some/prefix/orgs/BeaverSoftware") # https returned + self.assertListKeyEqual(org.get_repos(), lambda r: r.name, ["FatherBeaver", "TestPyGithub"]) # But still http in second request based on org.url + + def testIgnoreHttpsFromGithubEnterpriseWithPort(self): + g = github.Github(self.login, self.password, base_url="http://my.enterprise.com:1234/some/prefix") # http here + org = g.get_organization("BeaverSoftware") + self.assertEqual(org.url, "https://my.enterprise.com:1234/some/prefix/orgs/BeaverSoftware") # https returned + self.assertListKeyEqual(org.get_repos(), lambda r: r.name, ["FatherBeaver", "TestPyGithub"]) # But still http in second request based on org.url diff --git a/github/tests/Issue87.py b/github/tests/Issue87.py new file mode 100644 index 00000000..7edf0331 --- /dev/null +++ b/github/tests/Issue87.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import github + +import Framework + + +class Issue87(Framework.TestCase): # https://github.com/jacquev6/PyGithub/issues/87 + def setUp(self): + Framework.TestCase.setUp(self) + self.repo = self.g.get_user().get_repo("PyGithub") + + def testCreateIssueWithPercentInTitle(self): + issue = self.repo.create_issue("Issue with percent % in title created by PyGithub") + self.assertEqual(issue.number, 99) + + def testCreateIssueWithPercentInBody(self): + issue = self.repo.create_issue("Issue created by PyGithub", "Percent % in body") + self.assertEqual(issue.number, 98) + + def testCreateIssueWithEscapedPercentInTitle(self): + issue = self.repo.create_issue("Issue with escaped percent %25 in title created by PyGithub") + self.assertEqual(issue.number, 97) + + def testCreateIssueWithEscapedPercentInBody(self): + issue = self.repo.create_issue("Issue created by PyGithub", "Escaped percent %25 in body") + self.assertEqual(issue.number, 96) diff --git a/github/tests/IssueComment.py b/github/tests/IssueComment.py new file mode 100644 index 00000000..53fde395 --- /dev/null +++ b/github/tests/IssueComment.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + +import datetime + + +class IssueComment(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.comment = self.g.get_user().get_repo("PyGithub").get_issue(28).get_comment(5808311) + + def testAttributes(self): + self.assertEqual(self.comment.body, "Comment created by PyGithub") + self.assertEqual(self.comment.created_at, datetime.datetime(2012, 5, 20, 11, 46, 42)) + self.assertEqual(self.comment.id, 5808311) + self.assertEqual(self.comment.updated_at, datetime.datetime(2012, 5, 20, 11, 46, 42)) + self.assertEqual(self.comment.url, "https://api.github.com/repos/jacquev6/PyGithub/issues/comments/5808311") + self.assertEqual(self.comment.user.login, "jacquev6") + + def testEdit(self): + self.comment.edit("Comment edited by PyGithub") + self.assertEqual(self.comment.body, "Comment edited by PyGithub") + self.assertEqual(self.comment.updated_at, datetime.datetime(2012, 5, 20, 11, 53, 59)) + + def testDelete(self): + self.comment.delete() diff --git a/test/ContentFile.py b/github/tests/IssueEvent.py similarity index 51% rename from test/ContentFile.py rename to github/tests/IssueEvent.py index e5ad1d3c..96cb740a 100644 --- a/test/ContentFile.py +++ b/github/tests/IssueEvent.py @@ -1,33 +1,33 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import base64 - -import Framework - -import github -import datetime - -class ContentFile( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.file = self.g.get_user().get_repo( "PyGithub" ).get_readme() - - def testAttributes( self ): - self.assertEqual( self.file.type, "file" ) - self.assertEqual( self.file.encoding, "base64" ) - self.assertEqual( self.file.size, 7531 ) - self.assertEqual( self.file.name, "ReadMe.md" ) - self.assertEqual( self.file.path, "ReadMe.md" ) - self.assertEqual( len( base64.b64decode( self.file.content ) ), 7531 ) - self.assertEqual( self.file.sha, "5628799a7d517a4aaa0c1a7004d07569cd154df0" ) +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + +import datetime + + +class IssueEvent(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.event = self.g.get_user().get_repo("PyGithub").get_issues_event(16348656) + + def testAttributes(self): + self.assertEqual(self.event.actor.login, "jacquev6") + self.assertEqual(self.event.commit_id, "ed866fc43833802ab553e5ff8581c81bb00dd433") + self.assertEqual(self.event.created_at, datetime.datetime(2012, 5, 27, 7, 29, 25)) + self.assertEqual(self.event.event, "referenced") + self.assertEqual(self.event.id, 16348656) + self.assertEqual(self.event.issue.number, 30) + self.assertEqual(self.event.url, "https://api.github.com/repos/jacquev6/PyGithub/issues/events/16348656") diff --git a/test/Label.py b/github/tests/Label.py similarity index 51% rename from test/Label.py rename to github/tests/Label.py index 0e1c1ee4..3fa94ed0 100644 --- a/test/Label.py +++ b/github/tests/Label.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -13,21 +15,22 @@ import Framework -class Label( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.label = self.g.get_user().get_repo( "PyGithub" ).get_label( "Bug" ) - def testAttributes( self ): - self.assertEqual( self.label.color, "e10c02" ) - self.assertEqual( self.label.name, "Bug" ) - self.assertEqual( self.label.url, "https://api.github.com/repos/jacquev6/PyGithub/labels/Bug" ) +class Label(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.label = self.g.get_user().get_repo("PyGithub").get_label("Bug") - def testEdit( self ): - self.label.edit( "LabelEditedByPyGithub", "0000ff" ) - self.assertEqual( self.label.color, "0000ff" ) - self.assertEqual( self.label.name, "LabelEditedByPyGithub" ) - self.assertEqual( self.label.url, "https://api.github.com/repos/jacquev6/PyGithub/labels/LabelEditedByPyGithub" ) + def testAttributes(self): + self.assertEqual(self.label.color, "e10c02") + self.assertEqual(self.label.name, "Bug") + self.assertEqual(self.label.url, "https://api.github.com/repos/jacquev6/PyGithub/labels/Bug") - def testDelete( self ): + def testEdit(self): + self.label.edit("LabelEditedByPyGithub", "0000ff") + self.assertEqual(self.label.color, "0000ff") + self.assertEqual(self.label.name, "LabelEditedByPyGithub") + self.assertEqual(self.label.url, "https://api.github.com/repos/jacquev6/PyGithub/labels/LabelEditedByPyGithub") + + def testDelete(self): self.label.delete() diff --git a/github/tests/Logging_.py b/github/tests/Logging_.py new file mode 100644 index 00000000..79cc3e34 --- /dev/null +++ b/github/tests/Logging_.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import logging + +import github + +import Framework + + +class Logging(Framework.BasicTestCase): + class MockHandler: + def __init__(self): + self.level = logging.DEBUG + self.handled = None + + def handle(self, record): + self.handled = record.getMessage() + + def setUp(self): + Framework.BasicTestCase.setUp(self) + logger = logging.getLogger("github") + logger.setLevel(logging.DEBUG) + self.__handler = self.MockHandler() + logger.addHandler(self.__handler) + + def testLoggingWithBasicAuthentication(self): + self.assertEqual(github.Github(self.login, self.password).get_user().name, "Vincent Jacques") + self.assertEqual(self.__handler.handled, u'GET https://api.github.com/user {\'Authorization\': \'Basic (login and password removed)\'} None ==> 200 {\'status\': \'200 OK\', \'content-length\': \'806\', \'x-github-media-type\': \'github.beta; format=json\', \'x-content-type-options\': \'nosniff\', \'vary\': \'Accept, Authorization, Cookie\', \'x-ratelimit-remaining\': \'4993\', \'server\': \'nginx\', \'last-modified\': \'Fri, 14 Sep 2012 18:47:46 GMT\', \'connection\': \'keep-alive\', \'x-ratelimit-limit\': \'5000\', \'etag\': \'"434dfe5d3f50558fe3cea087cb95c401"\', \'cache-control\': \'private, s-maxage=60, max-age=60\', \'date\': \'Mon, 17 Sep 2012 17:12:32 GMT\', \'content-type\': \'application/json; charset=utf-8\'} {"owned_private_repos":3,"disk_usage":18612,"following":28,"type":"User","public_repos":13,"location":"Paris, France","company":"Criteo","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","plan":{"space":614400,"private_repos":5,"name":"micro","collaborators":1},"blog":"http://vincent-jacques.net","login":"jacquev6","public_gists":3,"html_url":"https://github.com/jacquev6","hireable":false,"created_at":"2010-07-09T06:10:06Z","private_gists":5,"followers":13,"name":"Vincent Jacques","email":"vincent@vincent-jacques.net","bio":"","total_private_repos":3,"collaborators":0,"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146,"url":"https://api.github.com/users/jacquev6"}') + + def testLoggingWithOAuthAuthentication(self): + self.assertEqual(github.Github(self.oauth_token).get_user().name, "Vincent Jacques") + self.assertEqual(self.__handler.handled, u'GET https://api.github.com/user {\'Authorization\': \'token (oauth token removed)\'} None ==> 200 {\'status\': \'200 OK\', \'x-ratelimit-remaining\': \'4993\', \'x-github-media-type\': \'github.beta; format=json\', \'x-content-type-options\': \'nosniff\', \'vary\': \'Accept, Authorization, Cookie\', \'content-length\': \'628\', \'server\': \'nginx\', \'last-modified\': \'Tue, 25 Sep 2012 07:42:42 GMT\', \'connection\': \'keep-alive\', \'x-ratelimit-limit\': \'5000\', \'etag\': \'"c23ad6b5815fc3d6ec6341c4a47afe85"\', \'cache-control\': \'private, max-age=60, s-maxage=60\', \'date\': \'Tue, 25 Sep 2012 20:36:54 GMT\', \'x-oauth-scopes\': \'\', \'content-type\': \'application/json; charset=utf-8\', \'x-accepted-oauth-scopes\': \'user\'} {"type":"User","bio":"","html_url":"https://github.com/jacquev6","login":"jacquev6","followers":14,"company":"Criteo","blog":"http://vincent-jacques.net","public_repos":13,"created_at":"2010-07-09T06:10:06Z","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","email":"vincent@vincent-jacques.net","following":29,"name":"Vincent Jacques","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","hireable":false,"id":327146,"public_gists":3,"location":"Paris, France","url":"https://api.github.com/users/jacquev6"}') + + def testLoggingWithoutAuthentication(self): + self.assertEqual(github.Github().get_user("jacquev6").name, "Vincent Jacques") + self.assertEqual(self.__handler.handled, u'GET https://api.github.com/users/jacquev6 {} None ==> 200 {\'status\': \'200 OK\', \'content-length\': \'628\', \'x-github-media-type\': \'github.beta; format=json\', \'x-content-type-options\': \'nosniff\', \'vary\': \'Accept\', \'x-ratelimit-remaining\': \'4989\', \'server\': \'nginx\', \'last-modified\': \'Tue, 25 Sep 2012 07:42:42 GMT\', \'connection\': \'keep-alive\', \'x-ratelimit-limit\': \'5000\', \'etag\': \'"9bd085221a16b6d2ea95e72634c3c1ac"\', \'cache-control\': \'public, max-age=60, s-maxage=60\', \'date\': \'Tue, 25 Sep 2012 20:38:56 GMT\', \'content-type\': \'application/json; charset=utf-8\'} {"type":"User","html_url":"https://github.com/jacquev6","login":"jacquev6","followers":14,"company":"Criteo","created_at":"2010-07-09T06:10:06Z","email":"vincent@vincent-jacques.net","hireable":false,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","public_gists":3,"bio":"","following":29,"name":"Vincent Jacques","blog":"http://vincent-jacques.net","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146,"public_repos":13,"location":"Paris, France","url":"https://api.github.com/users/jacquev6"}') + + def testLoggingWithBaseUrl(self): + # ReplayData forged, not recorded + self.assertEqual(github.Github(base_url="http://my.enterprise.com/my/prefix").get_user("jacquev6").name, "Vincent Jacques") + self.assertEqual(self.__handler.handled, u'GET http://my.enterprise.com/my/prefix/users/jacquev6 {} None ==> 200 {\'status\': \'200 OK\', \'content-length\': \'628\', \'x-github-media-type\': \'github.beta; format=json\', \'x-content-type-options\': \'nosniff\', \'vary\': \'Accept\', \'x-ratelimit-remaining\': \'4989\', \'server\': \'nginx\', \'last-modified\': \'Tue, 25 Sep 2012 07:42:42 GMT\', \'connection\': \'keep-alive\', \'x-ratelimit-limit\': \'5000\', \'etag\': \'"9bd085221a16b6d2ea95e72634c3c1ac"\', \'cache-control\': \'public, max-age=60, s-maxage=60\', \'date\': \'Tue, 25 Sep 2012 20:38:56 GMT\', \'content-type\': \'application/json; charset=utf-8\'} {"type":"User","html_url":"https://github.com/jacquev6","login":"jacquev6","followers":14,"company":"Criteo","created_at":"2010-07-09T06:10:06Z","email":"vincent@vincent-jacques.net","hireable":false,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","public_gists":3,"bio":"","following":29,"name":"Vincent Jacques","blog":"http://vincent-jacques.net","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146,"public_repos":13,"location":"Paris, France","url":"https://api.github.com/users/jacquev6"}') diff --git a/test/Markdown.py b/github/tests/Markdown.py similarity index 55% rename from test/Markdown.py rename to github/tests/Markdown.py index bab5ff01..ec480124 100644 --- a/test/Markdown.py +++ b/github/tests/Markdown.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -13,14 +15,15 @@ import Framework -class Markdown( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) + +class Markdown(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) self.text = "MyTitle\n=======\n\nIssue #1" - self.repo = self.g.get_user().get_repo( "PyGithub" ) + self.repo = self.g.get_user().get_repo("PyGithub") - def testRenderMarkdown( self ): - self.assertEqual( self.g.render_markdown( self.text ), '

MyTitle

Issue #1

' ) + def testRenderMarkdown(self): + self.assertEqual(self.g.render_markdown(self.text), '

MyTitle

Issue #1

') - def testRenderGithubFlavoredMarkdown( self ): - self.assertEqual( self.g.render_markdown( self.text, self.repo ), '

MyTitle

Issue #1

' ) + def testRenderGithubFlavoredMarkdown(self): + self.assertEqual(self.g.render_markdown(self.text, self.repo), '

MyTitle

Issue #1

') diff --git a/github/tests/Milestone.py b/github/tests/Milestone.py new file mode 100644 index 00000000..a4a17a17 --- /dev/null +++ b/github/tests/Milestone.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + +import datetime + + +class Milestone(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.milestone = self.g.get_user().get_repo("PyGithub").get_milestone(1) + + def testAttributes(self): + self.assertEqual(self.milestone.closed_issues, 2) + self.assertEqual(self.milestone.created_at, datetime.datetime(2012, 3, 8, 12, 22, 10)) + self.assertEqual(self.milestone.description, "") + self.assertEqual(self.milestone.due_on, datetime.datetime(2012, 3, 13, 7, 0, 0)) + self.assertEqual(self.milestone.id, 93546) + self.assertEqual(self.milestone.number, 1) + self.assertEqual(self.milestone.open_issues, 0) + self.assertEqual(self.milestone.state, "closed") + self.assertEqual(self.milestone.title, "Version 0.4") + self.assertEqual(self.milestone.url, "https://api.github.com/repos/jacquev6/PyGithub/milestones/1") + self.assertEqual(self.milestone.creator.login, "jacquev6") + + def testEditWithMinimalParameters(self): + self.milestone.edit("Title edited by PyGithub") + self.assertEqual(self.milestone.title, "Title edited by PyGithub") + + def testEditWithAllParameters(self): + self.milestone.edit("Title edited twice by PyGithub", "closed", "Description edited by PyGithub", due_on=datetime.date(2012, 6, 16)) + self.assertEqual(self.milestone.title, "Title edited twice by PyGithub") + self.assertEqual(self.milestone.state, "closed") + self.assertEqual(self.milestone.description, "Description edited by PyGithub") + self.assertEqual(self.milestone.due_on, datetime.datetime(2012, 6, 16, 7, 0, 0)) + + def testGetLabels(self): + self.assertListKeyEqual(self.milestone.get_labels(), lambda l: l.name, ["Public interface", "Project management"]) + + def testDelete(self): + self.milestone.delete() diff --git a/github/tests/NamedUser.py b/github/tests/NamedUser.py new file mode 100644 index 00000000..5cfbdaf0 --- /dev/null +++ b/github/tests/NamedUser.py @@ -0,0 +1,133 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + +import github +import datetime + + +class NamedUser(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.user = self.g.get_user("jacquev6") + + def testAttributesOfOtherUser(self): + self.user = self.g.get_user("nvie") + self.assertEqual(self.user.avatar_url, "https://secure.gravatar.com/avatar/c5a7f21b46df698f3db31c37ed0cf55a?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png") + self.assertEqual(self.user.bio, None) + self.assertEqual(self.user.blog, "http://nvie.com") + self.assertEqual(self.user.collaborators, None) + self.assertEqual(self.user.company, "3rd Cloud") + self.assertEqual(self.user.created_at, datetime.datetime(2009, 5, 12, 21, 19, 38)) + self.assertEqual(self.user.disk_usage, None) + self.assertEqual(self.user.email, "vincent@3rdcloud.com") + self.assertEqual(self.user.followers, 296) + self.assertEqual(self.user.following, 41) + self.assertEqual(self.user.gravatar_id, "c5a7f21b46df698f3db31c37ed0cf55a") + self.assertEqual(self.user.hireable, False) + self.assertEqual(self.user.html_url, "https://github.com/nvie") + self.assertEqual(self.user.id, 83844) + self.assertEqual(self.user.location, "Netherlands") + self.assertEqual(self.user.login, "nvie") + self.assertEqual(self.user.name, "Vincent Driessen") + self.assertEqual(self.user.owned_private_repos, None) + self.assertEqual(self.user.plan, None) + self.assertEqual(self.user.private_gists, None) + self.assertEqual(self.user.public_gists, 16) + self.assertEqual(self.user.public_repos, 61) + self.assertEqual(self.user.total_private_repos, None) + self.assertEqual(self.user.type, "User") + self.assertEqual(self.user.url, "https://api.github.com/users/nvie") + + def testAttributesOfSelf(self): + self.assertEqual(self.user.avatar_url, "https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png") + self.assertEqual(self.user.bio, "") + self.assertEqual(self.user.blog, "http://vincent-jacques.net") + self.assertEqual(self.user.collaborators, 0) + self.assertEqual(self.user.company, "Criteo") + self.assertEqual(self.user.created_at, datetime.datetime(2010, 7, 9, 6, 10, 6)) + self.assertEqual(self.user.disk_usage, 17080) + self.assertEqual(self.user.email, "vincent@vincent-jacques.net") + self.assertEqual(self.user.followers, 13) + self.assertEqual(self.user.following, 24) + self.assertEqual(self.user.gravatar_id, "b68de5ae38616c296fa345d2b9df2225") + self.assertEqual(self.user.hireable, False) + self.assertEqual(self.user.html_url, "https://github.com/jacquev6") + self.assertEqual(self.user.id, 327146) + self.assertEqual(self.user.location, "Paris, France") + self.assertEqual(self.user.login, "jacquev6") + self.assertEqual(self.user.name, "Vincent Jacques") + self.assertEqual(self.user.owned_private_repos, 5) + self.assertEqual(self.user.plan.name, "micro") + self.assertEqual(self.user.plan.collaborators, 1) + self.assertEqual(self.user.plan.space, 614400) + self.assertEqual(self.user.plan.private_repos, 5) + self.assertEqual(self.user.private_gists, 5) + self.assertEqual(self.user.public_gists, 2) + self.assertEqual(self.user.public_repos, 11) + self.assertEqual(self.user.total_private_repos, 5) + self.assertEqual(self.user.type, "User") + self.assertEqual(self.user.url, "https://api.github.com/users/jacquev6") + + def testCreateGist(self): + gist = self.user.create_gist(True, {"foobar.txt": github.InputFileContent("File created by PyGithub")}, "Gist created by PyGithub on a NamedUser") + self.assertEqual(gist.description, "Gist created by PyGithub on a NamedUser") + + def testCreateGistWithoutDescription(self): + gist = self.user.create_gist(True, {"foobar.txt": github.InputFileContent("File created by PyGithub")}) + self.assertEqual(gist.description, None) + + def testGetGists(self): + self.assertListKeyEqual(self.user.get_gists(), lambda g: g.description, ["Gist created by PyGithub", "FairThreadPoolPool.cpp", "How to error 500 Github API v3, as requested by Rick (GitHub Staff)", "Cadfael: order of episodes in French DVD edition"]) + + def testGetFollowers(self): + self.assertListKeyEqual(self.user.get_followers(), lambda f: f.login, ["jnorthrup", "brugidou", "regisb", "walidk", "afzalkhan", "sdanzan", "vineus", "gturri", "fjardon", "cjuniet", "jardon-u", "kamaradclimber", "L42y"]) + + def testGetFollowing(self): + self.assertListKeyEqual(self.user.get_following(), lambda f: f.login, ["nvie", "schacon", "jamis", "chad", "unclebob", "dabrahams", "jnorthrup", "brugidou", "regisb", "walidk", "tanzilli", "fjardon", "r3c", "sdanzan", "vineus", "cjuniet", "gturri", "ant9000", "asquini", "claudyus", "jardon-u", "s-bernard", "kamaradclimber", "Lyloa"]) + + def testGetOrgs(self): + self.assertListKeyEqual(self.user.get_orgs(), lambda o: o.login, ["BeaverSoftware"]) + + def testGetRepo(self): + self.assertEqual(self.user.get_repo("PyGithub").description, "Python library implementing the full Github API v3") + + def testGetRepos(self): + self.assertListKeyEqual(self.user.get_repos(), lambda r: r.name, ["TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE"]) + + def testGetReposWithType(self): + self.assertListKeyEqual(self.user.get_repos("owner"), lambda r: r.name, ["django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE"]) + + def testGetWatched(self): + self.assertListKeyEqual(self.user.get_watched(), lambda r: r.name, ["git", "boost.php", "capistrano", "boost.perl", "git-subtree", "git-hg", "homebrew", "celtic_knot", "twisted-intro", "markup", "hub", "gitflow", "murder", "boto", "agit", "d3", "pygit2", "git-pulls", "django_mathlatex", "scrumblr", "developer.github.com", "python-github3", "PlantUML", "bootstrap", "drawnby", "django-socketio", "django-realtime", "playground", "BozoCrack", "FatherBeaver", "PyGithub", "django", "django", "TestPyGithub"]) + + def testGetStarred(self): + self.assertListKeyEqual(self.user.get_starred(), lambda r: r.name, ["git", "boost.php", "capistrano", "boost.perl", "git-subtree", "git-hg", "homebrew", "celtic_knot", "twisted-intro", "markup", "hub", "gitflow", "murder", "boto", "agit", "d3", "pygit2", "git-pulls", "django_mathlatex", "scrumblr", "developer.github.com", "python-github3", "PlantUML", "bootstrap", "drawnby", "django-socketio", "django-realtime", "playground", "BozoCrack", "FatherBeaver", "amaunet", "django", "django", "moviePlanning", "folly"]) + + def testGetSubscriptions(self): + self.assertListKeyEqual(self.user.get_subscriptions(), lambda r: r.name, ["ViDE", "Boost.HierarchicalEnum", "QuadProgMm", "DrawSyntax", "DrawTurksHead", "PrivateStuff", "vincent-jacques.net", "Hacking", "C4Planner", "developer.github.com", "PyGithub", "PyGithub", "django", "CinePlanning", "PyGithub", "PyGithub", "PyGithub", "IpMap", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub"]) + + def testGetEvents(self): + self.assertListKeyBegin(self.user.get_events(), lambda e: e.type, ["GistEvent", "IssueCommentEvent", "PushEvent", "IssuesEvent"]) + + def testGetPublicEvents(self): + self.assertListKeyBegin(self.user.get_public_events(), lambda e: e.type, ["PushEvent", "CreateEvent", "GistEvent", "IssuesEvent"]) + + def testGetPublicReceivedEvents(self): + self.assertListKeyBegin(self.user.get_public_received_events(), lambda e: e.type, ["IssueCommentEvent", "IssueCommentEvent", "IssueCommentEvent", "IssueCommentEvent"]) + + def testGetReceivedEvents(self): + self.assertListKeyBegin(self.user.get_received_events(), lambda e: e.type, ["IssueCommentEvent", "IssueCommentEvent", "IssueCommentEvent", "IssueCommentEvent"]) diff --git a/github/tests/Organization.py b/github/tests/Organization.py new file mode 100644 index 00000000..08db9120 --- /dev/null +++ b/github/tests/Organization.py @@ -0,0 +1,123 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + +import datetime + + +class Organization(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.org = self.g.get_organization("BeaverSoftware") + + def testAttributes(self): + self.assertEqual(self.org.avatar_url, "https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png") + self.assertEqual(self.org.billing_email, "BeaverSoftware@vincent-jacques.net") + self.assertEqual(self.org.blog, None) + self.assertEqual(self.org.collaborators, 0) + self.assertEqual(self.org.company, None) + self.assertEqual(self.org.created_at, datetime.datetime(2012, 2, 9, 19, 20, 12)) + self.assertEqual(self.org.disk_usage, 112) + self.assertEqual(self.org.email, None) + self.assertEqual(self.org.followers, 0) + self.assertEqual(self.org.following, 0) + self.assertEqual(self.org.gravatar_id, None) + self.assertEqual(self.org.html_url, "https://github.com/BeaverSoftware") + self.assertEqual(self.org.id, 1424031) + self.assertEqual(self.org.location, "Paris, France") + self.assertEqual(self.org.login, "BeaverSoftware") + self.assertEqual(self.org.name, None) + self.assertEqual(self.org.owned_private_repos, 0) + self.assertEqual(self.org.plan.name, "free") + self.assertEqual(self.org.plan.private_repos, 0) + self.assertEqual(self.org.plan.space, 307200) + self.assertEqual(self.org.private_gists, 0) + self.assertEqual(self.org.public_gists, 0) + self.assertEqual(self.org.public_repos, 2) + self.assertEqual(self.org.total_private_repos, 0) + self.assertEqual(self.org.type, "Organization") + self.assertEqual(self.org.url, "https://api.github.com/orgs/BeaverSoftware") + + def testEditWithoutArguments(self): + self.org.edit() + + def testEditWithAllArguments(self): + self.org.edit("BeaverSoftware2@vincent-jacques.net", "http://vincent-jacques.net", "Company edited by PyGithub", "BeaverSoftware2@vincent-jacques.net", "Location edited by PyGithub", "Name edited by PyGithub") + self.assertEqual(self.org.billing_email, "BeaverSoftware2@vincent-jacques.net") + self.assertEqual(self.org.blog, "http://vincent-jacques.net") + self.assertEqual(self.org.company, "Company edited by PyGithub") + self.assertEqual(self.org.email, "BeaverSoftware2@vincent-jacques.net") + self.assertEqual(self.org.location, "Location edited by PyGithub") + self.assertEqual(self.org.name, "Name edited by PyGithub") + + def testCreateTeam(self): + team = self.org.create_team("Team created by PyGithub") + self.assertEqual(team.id, 189850) + + def testCreateTeamWithAllArguments(self): + 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): + lyloa = self.g.get_user("Lyloa") + self.assertFalse(self.org.has_in_public_members(lyloa)) + self.org.add_to_public_members(lyloa) + self.assertTrue(self.org.has_in_public_members(lyloa)) + self.org.remove_from_public_members(lyloa) + self.assertFalse(self.org.has_in_public_members(lyloa)) + + def testGetPublicMembers(self): + self.assertListKeyEqual(self.org.get_public_members(), lambda u: u.login, ["jacquev6"]) + + def testGetMembers(self): + self.assertListKeyEqual(self.org.get_members(), lambda u: u.login, ["cjuniet", "jacquev6", "Lyloa"]) + + def testMembers(self): + lyloa = self.g.get_user("Lyloa") + self.assertTrue(self.org.has_in_members(lyloa)) + self.org.remove_from_members(lyloa) + self.assertFalse(self.org.has_in_members(lyloa)) + + def testGetRepos(self): + self.assertListKeyEqual(self.org.get_repos(), lambda r: r.name, ["FatherBeaver", "TestPyGithub"]) + + def testGetReposWithType(self): + self.assertListKeyEqual(self.org.get_repos("public"), lambda r: r.name, ["FatherBeaver", "PyGithub"]) + + def testGetEvents(self): + self.assertListKeyEqual(self.org.get_events(), lambda e: e.type, ["CreateEvent", "CreateEvent", "PushEvent", "PushEvent", "DeleteEvent", "DeleteEvent", "PushEvent", "PushEvent", "DeleteEvent", "DeleteEvent", "PushEvent", "PushEvent", "PushEvent", "CreateEvent", "CreateEvent", "CreateEvent", "CreateEvent", "CreateEvent", "PushEvent", "PushEvent", "PushEvent", "PushEvent", "PushEvent", "PushEvent", "ForkEvent", "CreateEvent"]) + + def testGetTeams(self): + self.assertListKeyEqual(self.org.get_teams(), lambda t: t.name, ["Members", "Owners"]) + + def testCreateRepoWithMinimalArguments(self): + repo = self.org.create_repo("TestPyGithub") + self.assertEqual(repo.url, "https://api.github.com/repos/BeaverSoftware/TestPyGithub") + + def testCreateRepoWithAllArguments(self): + 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 testCreateRepositoryWithAutoInit(self): + repo = self.org.create_repo("TestPyGithub", auto_init=True, gitignore_template="Python") + self.assertEqual(repo.url, "https://api.github.com/repos/BeaverSoftware/TestPyGithub") + + def testCreateFork(self): + pygithub = self.g.get_user("jacquev6").get_repo("PyGithub") + repo = self.org.create_fork(pygithub) + self.assertEqual(repo.url, "https://api.github.com/repos/BeaverSoftware/PyGithub") diff --git a/github/tests/PaginatedList.py b/github/tests/PaginatedList.py new file mode 100644 index 00000000..9ad4e6d5 --- /dev/null +++ b/github/tests/PaginatedList.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + + +class PaginatedList(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.list = self.g.get_user("openframeworks").get_repo("openFrameworks").get_issues() + + def testIteration(self): + self.assertEqual(len(list(self.list)), 333) + + def testSeveralIterations(self): + self.assertEqual(len(list(self.list)), 333) + self.assertEqual(len(list(self.list)), 333) + self.assertEqual(len(list(self.list)), 333) + self.assertEqual(len(list(self.list)), 333) + + def testIntIndexingInFirstPage(self): + self.assertEqual(self.list[0].id, 4772349) + self.assertEqual(self.list[24].id, 4286936) + + def testIntIndexingInThirdPage(self): + self.assertEqual(self.list[50].id, 3911629) + self.assertEqual(self.list[74].id, 3605277) + + def testGetFirstPage(self): + self.assertListKeyEqual(self.list.get_page(0), lambda i: i.id, [4772349, 4767675, 4758608, 4700182, 4662873, 4608132, 4604661, 4588997, 4557803, 4554058, 4539985, 4507572, 4507492, 4507416, 4447561, 4406584, 4384548, 4383465, 4373361, 4373201, 4370619, 4356530, 4352401, 4317009, 4286936]) + + def testGetThirdPage(self): + self.assertListKeyEqual(self.list.get_page(2), lambda i: i.id, [3911629, 3911537, 3910580, 3910555, 3910549, 3897090, 3883598, 3856005, 3850655, 3825582, 3813852, 3812318, 3812275, 3807459, 3799872, 3799653, 3795495, 3754055, 3710293, 3662214, 3647640, 3631618, 3627067, 3614231, 3605277]) + + def testIntIndexingAfterIteration(self): + self.assertEqual(len(list(self.list)), 333) + self.assertEqual(self.list[11].id, 4507572) + self.assertEqual(self.list[73].id, 3614231) + self.assertEqual(self.list[332].id, 94898) + + def testSliceIndexingInFirstPage(self): + self.assertListKeyEqual(self.list[:13], lambda i: i.id, [4772349, 4767675, 4758608, 4700182, 4662873, 4608132, 4604661, 4588997, 4557803, 4554058, 4539985, 4507572, 4507492]) + self.assertListKeyEqual(self.list[:13:3], lambda i: i.id, [4772349, 4700182, 4604661, 4554058, 4507492]) + self.assertListKeyEqual(self.list[10:13], lambda i: i.id, [4539985, 4507572, 4507492]) + self.assertListKeyEqual(self.list[5:13:3], lambda i: i.id, [4608132, 4557803, 4507572]) + + def testSliceIndexingUntilFourthPage(self): + self.assertListKeyEqual(self.list[:99:10], lambda i: i.id, [4772349, 4539985, 4370619, 4207350, 4063366, 3911629, 3813852, 3647640, 3528378, 3438233]) + self.assertListKeyEqual(self.list[73:78], lambda i: i.id, [3614231, 3605277, 3596240, 3594731, 3593619]) + self.assertListKeyEqual(self.list[70:80:2], lambda i: i.id, [3647640, 3627067, 3605277, 3594731, 3593430]) + + def testSliceIndexingUntilEnd(self): + self.assertListKeyEqual(self.list[310::3], lambda i: i.id, [268332, 204247, 169176, 166211, 165898, 163959, 132373, 104702]) + self.assertListKeyEqual(self.list[310:], lambda i: i.id, [268332, 211418, 205935, 204247, 172424, 171615, 169176, 166214, 166212, 166211, 166209, 166208, 165898, 165537, 165409, 163959, 132671, 132377, 132373, 130269, 111018, 104702, 94898]) + + def testInterruptedIteration(self): + # No asserts, but checks that only three pages are fetched + l = 0 + for element in self.list: # pragma no branch (exits only by break) + l += 1 + if l == 75: + break + + def testInterruptedIterationInSlice(self): + # No asserts, but checks that only three pages are fetched + l = 0 + for element in self.list[:100]: # pragma no branch (exits only by break) + l += 1 + if l == 75: + break diff --git a/github/tests/PullRequest.py b/github/tests/PullRequest.py new file mode 100644 index 00000000..3cd42728 --- /dev/null +++ b/github/tests/PullRequest.py @@ -0,0 +1,103 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + +import datetime + + +class PullRequest(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + 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) + self.assertEqual(self.pull.assignee.login, "jacquev6") + self.assertEqual(self.pull.base.label, "jacquev6:topic/RewriteWithGeneratedCode") + self.assertEqual(self.pull.base.sha, "ed866fc43833802ab553e5ff8581c81bb00dd433") + self.assertEqual(self.pull.base.user.login, "jacquev6") + self.assertEqual(self.pull.base.ref, "topic/RewriteWithGeneratedCode") + self.assertEqual(self.pull.base.repo.full_name, "jacquev6/PyGithub") + self.assertEqual(self.pull.body, "Body edited by PyGithub") + self.assertEqual(self.pull.changed_files, 45) + self.assertEqual(self.pull.closed_at, datetime.datetime(2012, 5, 27, 10, 29, 7)) + self.assertEqual(self.pull.comments, 1) + self.assertEqual(self.pull.commits, 3) + self.assertEqual(self.pull.created_at, datetime.datetime(2012, 5, 27, 9, 25, 36)) + self.assertEqual(self.pull.deletions, 384) + self.assertEqual(self.pull.diff_url, "https://github.com/jacquev6/PyGithub/pull/31.diff") + self.assertEqual(self.pull.head.label, "BeaverSoftware:master") + self.assertEqual(self.pull.html_url, "https://github.com/jacquev6/PyGithub/pull/31") + self.assertEqual(self.pull.id, 1436215) + self.assertEqual(self.pull.issue_url, "https://github.com/jacquev6/PyGithub/issues/31") + self.assertEqual(self.pull.mergeable, False) + self.assertEqual(self.pull.merged, True) + self.assertEqual(self.pull.merged_at, datetime.datetime(2012, 5, 27, 10, 29, 7)) + self.assertEqual(self.pull.merged_by.login, "jacquev6") + self.assertEqual(self.pull.number, 31) + self.assertEqual(self.pull.patch_url, "https://github.com/jacquev6/PyGithub/pull/31.patch") + self.assertEqual(self.pull.review_comments, 1) + self.assertEqual(self.pull.state, "closed") + self.assertEqual(self.pull.title, "Title edited by PyGithub") + self.assertEqual(self.pull.updated_at, datetime.datetime(2012, 11, 3, 8, 19, 40)) + self.assertEqual(self.pull.url, "https://api.github.com/repos/jacquev6/PyGithub/pulls/31") + self.assertEqual(self.pull.user.login, "jacquev6") + + def testCreateComment(self): + 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): + self.assertListKeyEqual(self.pull.get_comments(), lambda c: c.id, [886298]) + + def testCreateIssueComment(self): + comment = self.pull.create_issue_comment("Issue comment created by PyGithub") + self.assertEqual(comment.id, 8387331) + + def testGetIssueComments(self): + self.assertListKeyEqual(self.pull.get_issue_comments(), lambda c: c.id, [8387331]) + + def testGetIssueComment(self): + comment = self.pull.get_issue_comment(8387331) + self.assertEqual(comment.body, "Issue comment created by PyGithub") + + def testEditWithoutArguments(self): + self.pull.edit() + + def testEditWithAllArguments(self): + self.pull.edit("Title edited by PyGithub", "Body edited by PyGithub", "open") + self.assertEqual(self.pull.title, "Title edited by PyGithub") + self.assertEqual(self.pull.body, "Body edited by PyGithub") + self.assertEqual(self.pull.state, "open") + + def testGetCommits(self): + self.assertListKeyEqual(self.pull.get_commits(), lambda c: c.sha, ["4aadfff21cdd2d2566b0e4bd7309c233b5f4ae23", "93dcae5cf207de376c91d0599226e7c7563e1d16", "8a4f306d4b223682dd19410d4a9150636ebe4206"]) + + def testGetFiles(self): + self.assertListKeyEqual(self.pull.get_files(), lambda f: f.filename, ["codegen/templates/GithubObject.py", "src/github/AuthenticatedUser.py", "src/github/Authorization.py", "src/github/Branch.py", "src/github/Commit.py", "src/github/CommitComment.py", "src/github/CommitFile.py", "src/github/CommitStats.py", "src/github/Download.py", "src/github/Event.py", "src/github/Gist.py", "src/github/GistComment.py", "src/github/GistHistoryState.py", "src/github/GitAuthor.py", "src/github/GitBlob.py", "src/github/GitCommit.py", "src/github/GitObject.py", "src/github/GitRef.py", "src/github/GitTag.py", "src/github/GitTree.py", "src/github/GitTreeElement.py", "src/github/Hook.py", "src/github/Issue.py", "src/github/IssueComment.py", "src/github/IssueEvent.py", "src/github/Label.py", "src/github/Milestone.py", "src/github/NamedUser.py", "src/github/Organization.py", "src/github/Permissions.py", "src/github/Plan.py", "src/github/PullRequest.py", "src/github/PullRequestComment.py", "src/github/PullRequestFile.py", "src/github/Repository.py", "src/github/RepositoryKey.py", "src/github/Tag.py", "src/github/Team.py", "src/github/UserKey.py", "test/Issue.py", "test/IssueEvent.py", "test/ReplayData/Issue.testAddAndRemoveLabels.txt", "test/ReplayData/Issue.testDeleteAndSetLabels.txt", "test/ReplayData/Issue.testGetLabels.txt", "test/ReplayData/IssueEvent.setUp.txt"]) + + def testMerge(self): + self.assertFalse(self.pull.is_merged()) + status = self.pull.merge() + self.assertEqual(status.sha, "688208b1a5a074871d0e9376119556897439697d") + self.assertEqual(status.merged, True) + self.assertEqual(status.message, "Pull Request successfully merged") + self.assertTrue(self.pull.is_merged()) + + def testMergeWithCommitMessage(self): + self.g.get_user().get_repo("PyGithub").get_pull(39).merge("Custom commit message created by PyGithub") diff --git a/github/tests/PullRequestComment.py b/github/tests/PullRequestComment.py new file mode 100644 index 00000000..fae74621 --- /dev/null +++ b/github/tests/PullRequestComment.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + +import datetime + + +class PullRequestComment(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.comment = self.g.get_user().get_repo("PyGithub").get_pull(31).get_comment(886298) + + def testAttributes(self): + self.assertEqual(self.comment.body, "Comment created by PyGithub") + self.assertEqual(self.comment.commit_id, "8a4f306d4b223682dd19410d4a9150636ebe4206") + self.assertEqual(self.comment.created_at, datetime.datetime(2012, 5, 27, 9, 40, 12)) + self.assertEqual(self.comment.id, 886298) + self.assertEqual(self.comment.original_commit_id, "8a4f306d4b223682dd19410d4a9150636ebe4206") + self.assertEqual(self.comment.original_position, 5) + self.assertEqual(self.comment.path, "src/github/Issue.py") + self.assertEqual(self.comment.position, 5) + self.assertEqual(self.comment.updated_at, datetime.datetime(2012, 5, 27, 9, 40, 12)) + self.assertEqual(self.comment.url, "https://api.github.com/repos/jacquev6/PyGithub/pulls/comments/886298") + self.assertEqual(self.comment.user.login, "jacquev6") + + def testEdit(self): + self.comment.edit("Comment edited by PyGithub") + self.assertEqual(self.comment.body, "Comment edited by PyGithub") + + def testDelete(self): + self.comment.delete() diff --git a/github/tests/PullRequestFile.py b/github/tests/PullRequestFile.py new file mode 100644 index 00000000..f2ee7817 --- /dev/null +++ b/github/tests/PullRequestFile.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + + +class PullRequestFile(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.file = self.g.get_user().get_repo("PyGithub").get_pull(31).get_files()[0] + + def testAttributes(self): + self.assertEqual(self.file.additions, 1) + self.assertEqual(self.file.blob_url, "https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/codegen/templates/GithubObject.py") + self.assertEqual(self.file.changes, 2) + self.assertEqual(self.file.deletions, 1) + self.assertEqual(self.file.filename, "codegen/templates/GithubObject.py") + self.assertEqual(self.file.patch, '@@ -70,7 +70,7 @@ def __useAttributes( self, attributes ):\n \n # @toto No need to check if attribute is in attributes when attribute is mandatory\n {% for attribute in class.attributes|dictsort:"name" %}\n- if "{{ attribute.name }}" in attributes and attributes[ "{{ attribute.name }}" ] is not None:\n+ if "{{ attribute.name }}" in attributes and attributes[ "{{ attribute.name }}" ] is not None: # pragma no branch\n \n {% if attribute.type.cardinality == "scalar" %}\n {% if attribute.type.simple %}') + self.assertEqual(self.file.raw_url, "https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/codegen/templates/GithubObject.py") + self.assertEqual(self.file.sha, "8a4f306d4b223682dd19410d4a9150636ebe4206") + self.assertEqual(self.file.status, "modified") diff --git a/test/RateLimiting.py b/github/tests/RateLimiting.py similarity index 75% rename from test/RateLimiting.py rename to github/tests/RateLimiting.py index 3cda5ca1..40da9752 100644 --- a/test/RateLimiting.py +++ b/github/tests/RateLimiting.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -13,8 +15,9 @@ import Framework -class RateLimiting( Framework.TestCase ): - def testRateLimiting( self ): - self.assertEqual( self.g.rate_limiting, ( 5000, 5000 ) ) - self.g.get_user( "jacquev6" ) - self.assertEqual( self.g.rate_limiting, ( 4999, 5000 ) ) + +class RateLimiting(Framework.TestCase): + def testRateLimiting(self): + self.assertEqual(self.g.rate_limiting, (5000, 5000)) + self.g.get_user("jacquev6") + self.assertEqual(self.g.rate_limiting, (4999, 5000)) diff --git a/test/ReplayData/AuthenticatedUser.testAttributes.txt b/github/tests/ReplayData/AuthenticatedUser.testAttributes.txt similarity index 100% rename from test/ReplayData/AuthenticatedUser.testAttributes.txt rename to github/tests/ReplayData/AuthenticatedUser.testAttributes.txt diff --git a/test/ReplayData/AuthenticatedUser.testCreateAuthorizationWithAllArguments.txt b/github/tests/ReplayData/AuthenticatedUser.testCreateAuthorizationWithAllArguments.txt similarity index 75% rename from test/ReplayData/AuthenticatedUser.testCreateAuthorizationWithAllArguments.txt rename to github/tests/ReplayData/AuthenticatedUser.testCreateAuthorizationWithAllArguments.txt index 9a6d5245..dd0590db 100644 --- a/test/ReplayData/AuthenticatedUser.testCreateAuthorizationWithAllArguments.txt +++ b/github/tests/ReplayData/AuthenticatedUser.testCreateAuthorizationWithAllArguments.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /authorizations {'Authorization': 'Basic login_and_password_removed'} {"note": "Note created by PyGithub", "scopes": ["repo"], "note_url": "http://vincent-jacques.net/PyGithub"} +https POST api.github.com None /authorizations {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"note": "Note created by PyGithub", "scopes": ["repo"], "note_url": "http://vincent-jacques.net/PyGithub"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4991'), ('content-length', '382'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"41f3600b4ddb741cd59a00a88321af92"'), ('date', 'Tue, 22 May 2012 18:27:36 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/authorizations/372294')] {"scopes":["repo"],"updated_at":"2012-05-22T18:27:36Z","app":{"url":"http://vincent-jacques.net/PyGithub","name":"Note created by PyGithub (API)"},"url":"https://api.github.com/authorizations/372294","token":"b7fd2a0346d9d590b1fad5e10971e8d29637a4ce","note":"Note created by PyGithub","note_url":"http://vincent-jacques.net/PyGithub","created_at":"2012-05-22T18:27:36Z","id":372294} diff --git a/test/ReplayData/AuthenticatedUser.testCreateAuthorizationWithoutArguments.txt b/github/tests/ReplayData/AuthenticatedUser.testCreateAuthorizationWithoutArguments.txt similarity index 83% rename from test/ReplayData/AuthenticatedUser.testCreateAuthorizationWithoutArguments.txt rename to github/tests/ReplayData/AuthenticatedUser.testCreateAuthorizationWithoutArguments.txt index 7cd1e25b..c06a1156 100644 --- a/test/ReplayData/AuthenticatedUser.testCreateAuthorizationWithoutArguments.txt +++ b/github/tests/ReplayData/AuthenticatedUser.testCreateAuthorizationWithoutArguments.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /authorizations {'Authorization': 'Basic login_and_password_removed'} {} +https POST api.github.com None /authorizations {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4987'), ('content-length', '328'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"4a48781fcd24441dade6248aab748487"'), ('date', 'Tue, 22 May 2012 18:03:17 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/authorizations/372259')] {"scopes":[],"updated_at":"2012-05-22T18:03:17Z","app":{"url":"http://developer.github.com/v3/oauth/#oauth-authorizations-api","name":"GitHub API"},"url":"https://api.github.com/authorizations/372259","token":"82459c4500086f8f0cc67d2936c17d1e27ad1c33","note":null,"created_at":"2012-05-22T18:03:17Z","note_url":null,"id":372259} diff --git a/test/ReplayData/AuthenticatedUser.testCreateFork.txt b/github/tests/ReplayData/AuthenticatedUser.testCreateFork.txt similarity index 100% rename from test/ReplayData/AuthenticatedUser.testCreateFork.txt rename to github/tests/ReplayData/AuthenticatedUser.testCreateFork.txt diff --git a/test/ReplayData/AuthenticatedUser.testCreateGist.txt b/github/tests/ReplayData/AuthenticatedUser.testCreateGist.txt similarity index 87% rename from test/ReplayData/AuthenticatedUser.testCreateGist.txt rename to github/tests/ReplayData/AuthenticatedUser.testCreateGist.txt index ed295580..d66d27b5 100644 --- a/test/ReplayData/AuthenticatedUser.testCreateGist.txt +++ b/github/tests/ReplayData/AuthenticatedUser.testCreateGist.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /gists {'Authorization': 'Basic login_and_password_removed'} {"files": {"foobar.txt": {"content": "File created by PyGithub"}}, "public": true, "description": "Gist created by PyGithub"} +https POST api.github.com None /gists {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"files": {"foobar.txt": {"content": "File created by PyGithub"}}, "public": true, "description": "Gist created by PyGithub"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4967'), ('content-length', '1446'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"4099af9b70c91fb9c1c8dc72bf773c33"'), ('date', 'Sat, 19 May 2012 07:00:58 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/gists/2729810')] {"updated_at":"2012-05-19T07:00:58Z","forks":[],"url":"https://api.github.com/gists/2729810","comments":0,"public":true,"git_pull_url":"git://gist.github.com/2729810.git","git_push_url":"git@gist.github.com:2729810.git","files":{"foobar.txt":{"type":"text/plain","raw_url":"https://gist.github.com/raw/2729810/73a1c7f17aa0ad5d7cbb5a8ca033ce47d3d23197/foobar.txt","size":24,"filename":"foobar.txt","content":"File created by PyGithub","language":"Text"}},"html_url":"https://gist.github.com/2729810","user":{"url":"https://api.github.com/users/jacquev6","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","id":327146},"description":"Gist created by PyGithub","created_at":"2012-05-19T07:00:58Z","id":"2729810","history":[{"change_status":{"deletions":0,"additions":1,"total":1},"url":"https://api.github.com/gists/2729810/35deb29ab1caf4c68c03d8244ad674b56de01a5c","committed_at":"2012-05-19T07:00:58Z","version":"35deb29ab1caf4c68c03d8244ad674b56de01a5c","user":{"url":"https://api.github.com/users/jacquev6","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","id":327146}}]} diff --git a/test/ReplayData/AuthenticatedUser.testCreateGistWithoutDescription.txt b/github/tests/ReplayData/AuthenticatedUser.testCreateGistWithoutDescription.txt similarity index 89% rename from test/ReplayData/AuthenticatedUser.testCreateGistWithoutDescription.txt rename to github/tests/ReplayData/AuthenticatedUser.testCreateGistWithoutDescription.txt index 106c7d35..3f968060 100644 --- a/test/ReplayData/AuthenticatedUser.testCreateGistWithoutDescription.txt +++ b/github/tests/ReplayData/AuthenticatedUser.testCreateGistWithoutDescription.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /gists {'Authorization': 'Basic login_and_password_removed'} {"files": {"foobar.txt": {"content": "File created by PyGithub"}}, "public": true} +https POST api.github.com None /gists {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"files": {"foobar.txt": {"content": "File created by PyGithub"}}, "public": true} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4981'), ('content-length', '1424'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"7abbb6858d17ad64e3d5874676725694"'), ('date', 'Sat, 26 May 2012 09:50:03 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/gists/2793179')] {"updated_at":"2012-05-26T09:50:02Z","url":"https://api.github.com/gists/2793179","comments":0,"public":true,"forks":[],"git_pull_url":"git://gist.github.com/2793179.git","files":{"foobar.txt":{"type":"text/plain","raw_url":"https://gist.github.com/raw/2793179/73a1c7f17aa0ad5d7cbb5a8ca033ce47d3d23197/foobar.txt","size":24,"filename":"foobar.txt","content":"File created by PyGithub","language":"Text"}},"user":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"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"},"description":null,"created_at":"2012-05-26T09:50:02Z","git_push_url":"git@gist.github.com:2793179.git","id":"2793179","history":[{"url":"https://api.github.com/gists/2793179/069e7c0041c34619b5aebf0e918536cb3bfeff9a","change_status":{"deletions":0,"additions":1,"total":1},"version":"069e7c0041c34619b5aebf0e918536cb3bfeff9a","committed_at":"2012-05-26T09:50:03Z","user":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"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"}}],"html_url":"https://gist.github.com/2793179"} diff --git a/test/ReplayData/AuthenticatedUser.testCreateKey.txt b/github/tests/ReplayData/AuthenticatedUser.testCreateKey.txt similarity index 60% rename from test/ReplayData/AuthenticatedUser.testCreateKey.txt rename to github/tests/ReplayData/AuthenticatedUser.testCreateKey.txt index 8d5714ac..43ec2673 100644 --- a/test/ReplayData/AuthenticatedUser.testCreateKey.txt +++ b/github/tests/ReplayData/AuthenticatedUser.testCreateKey.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /user/keys {'Authorization': 'Basic login_and_password_removed'} {"key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Mm0RjTNAYFfSCtUpO54usdseroUSIYg5KX4JoseTpqyiB/hqewjYLAdUq/tNIQzrkoEJWSyZrQt0ma7/YCyMYuNGd3DU6q6ZAyBeY3E9RyCiKjO3aTL2VKQGFvBVVmGdxGVSCITRphAcsKc/PF35/fg9XP9S0anMXcEFtdfMHz41SSw+XtE+Vc+6cX9FuI5qUfLGbkv8L1v3g4uw9VXlzq4GfTA+1S7D6mcoGHopAIXFlVr+2RfDKdSURMcB22z41fljO1MW4+zUS/4FyUTpL991es5fcwKXYoiE+x06VJeJJ1Krwx+DZj45uweV6cHXt2JwJEI9fWB6WyBlDejWw== vincent@IDEE", "title": "Key added through PyGithub"} +https POST api.github.com None /user/keys {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Mm0RjTNAYFfSCtUpO54usdseroUSIYg5KX4JoseTpqyiB/hqewjYLAdUq/tNIQzrkoEJWSyZrQt0ma7/YCyMYuNGd3DU6q6ZAyBeY3E9RyCiKjO3aTL2VKQGFvBVVmGdxGVSCITRphAcsKc/PF35/fg9XP9S0anMXcEFtdfMHz41SSw+XtE+Vc+6cX9FuI5qUfLGbkv8L1v3g4uw9VXlzq4GfTA+1S7D6mcoGHopAIXFlVr+2RfDKdSURMcB22z41fljO1MW4+zUS/4FyUTpL991es5fcwKXYoiE+x06VJeJJ1Krwx+DZj45uweV6cHXt2JwJEI9fWB6WyBlDejWw== vincent@IDEE", "title": "Key added through PyGithub"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4984'), ('content-length', '505'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"7261ec55c886d6bf42e48d5bf9544586"'), ('date', 'Sat, 26 May 2012 19:49:30 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/user/keys/2626650')] {"url":"https://api.github.com/user/keys/2626650","key":"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Mm0RjTNAYFfSCtUpO54usdseroUSIYg5KX4JoseTpqyiB/hqewjYLAdUq/tNIQzrkoEJWSyZrQt0ma7/YCyMYuNGd3DU6q6ZAyBeY3E9RyCiKjO3aTL2VKQGFvBVVmGdxGVSCITRphAcsKc/PF35/fg9XP9S0anMXcEFtdfMHz41SSw+XtE+Vc+6cX9FuI5qUfLGbkv8L1v3g4uw9VXlzq4GfTA+1S7D6mcoGHopAIXFlVr+2RfDKdSURMcB22z41fljO1MW4+zUS/4FyUTpL991es5fcwKXYoiE+x06VJeJJ1Krwx+DZj45uweV6cHXt2JwJEI9fWB6WyBlDejWw==","verified":true,"title":"Key added through PyGithub","id":2626650} diff --git a/test/ReplayData/AuthenticatedUser.testCreateRepository.txt b/github/tests/ReplayData/AuthenticatedUser.testCreateRepository.txt similarity index 90% rename from test/ReplayData/AuthenticatedUser.testCreateRepository.txt rename to github/tests/ReplayData/AuthenticatedUser.testCreateRepository.txt index 2c402e7f..d119017f 100644 --- a/test/ReplayData/AuthenticatedUser.testCreateRepository.txt +++ b/github/tests/ReplayData/AuthenticatedUser.testCreateRepository.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /user/repos {'Authorization': 'Basic login_and_password_removed'} {"name": "TestPyGithub"} +https POST api.github.com None /user/repos {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"name": "TestPyGithub"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4996'), ('content-length', '1035'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"0dee1203022ede8b8374b387ba479ffd"'), ('date', 'Thu, 10 May 2012 19:17:12 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/TestPyGithub')] {"mirror_url":null,"homepage":null,"clone_url":"https://github.com/jacquev6/TestPyGithub.git","html_url":"https://github.com/jacquev6/TestPyGithub","url":"https://api.github.com/repos/jacquev6/TestPyGithub","has_downloads":true,"watchers":1,"git_url":"git://github.com/jacquev6/TestPyGithub.git","permissions":{"admin":true,"pull":true,"push":true},"has_wiki":true,"has_issues":true,"fork":false,"forks":1,"language":null,"size":0,"description":null,"private":false,"created_at":"2012-05-10T19:17:12Z","open_issues":0,"svn_url":"https://github.com/jacquev6/TestPyGithub","owner":{"url":"https://api.github.com/users/jacquev6","login":"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","id":327146},"name":"TestPyGithub","pushed_at":"2012-05-10T19:17:12Z","id":4288693,"ssh_url":"git@github.com:jacquev6/TestPyGithub.git","updated_at":"2012-05-10T19:17:12Z"} diff --git a/test/ReplayData/AuthenticatedUser.testCreateRepositoryWithAllArguments.txt b/github/tests/ReplayData/AuthenticatedUser.testCreateRepositoryWithAllArguments.txt similarity index 82% rename from test/ReplayData/AuthenticatedUser.testCreateRepositoryWithAllArguments.txt rename to github/tests/ReplayData/AuthenticatedUser.testCreateRepositoryWithAllArguments.txt index 13165ee5..bf6e746c 100644 --- a/test/ReplayData/AuthenticatedUser.testCreateRepositoryWithAllArguments.txt +++ b/github/tests/ReplayData/AuthenticatedUser.testCreateRepositoryWithAllArguments.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /user/repos {'Authorization': 'Basic login_and_password_removed'} {"has_wiki": false, "name": "TestPyGithub", "has_downloads": false, "private": false, "has_issues": false, "homepage": "http://foobar.com", "description": "Repo created by PyGithub"} +https POST api.github.com None /user/repos {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"has_wiki": false, "name": "TestPyGithub", "has_downloads": false, "private": false, "has_issues": false, "homepage": "http://foobar.com", "description": "Repo created by PyGithub"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4979'), ('content-length', '1111'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"1c6473a60481c33b28a926041f763fce"'), ('date', 'Sat, 26 May 2012 09:55:27 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/TestPyGithub')] {"clone_url":"https://github.com/jacquev6/TestPyGithub.git","has_downloads":false,"watchers":1,"git_url":"git://github.com/jacquev6/TestPyGithub.git","updated_at":"2012-05-26T09:55:27Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":"http://foobar.com","url":"https://api.github.com/repos/jacquev6/TestPyGithub","has_wiki":false,"has_issues":false,"fork":false,"forks":1,"mirror_url":null,"size":0,"private":false,"open_issues":0,"svn_url":"https://github.com/jacquev6/TestPyGithub","owner":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"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"},"name":"TestPyGithub","language":null,"description":"Repo created by PyGithub","ssh_url":"git@github.com:jacquev6/TestPyGithub.git","pushed_at":"2012-05-26T09:55:27Z","created_at":"2012-05-26T09:55:27Z","id":4454027,"html_url":"https://github.com/jacquev6/TestPyGithub","full_name":"jacquev6/TestPyGithub"} diff --git a/github/tests/ReplayData/AuthenticatedUser.testCreateRepositoryWithAutoInit.txt b/github/tests/ReplayData/AuthenticatedUser.testCreateRepositoryWithAutoInit.txt new file mode 100644 index 00000000..eddc90a5 --- /dev/null +++ b/github/tests/ReplayData/AuthenticatedUser.testCreateRepositoryWithAutoInit.txt @@ -0,0 +1,5 @@ +https POST api.github.com None /user/repos {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"gitignore_template": "Python", "name": "TestPyGithub", "auto_init": true} +201 +[('status', '201 Created'), ('content-length', '1176'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-limit', '5000'), ('x-ratelimit-remaining', '4999'), ('server', 'nginx'), ('connection', 'keep-alive'), ('etag', '"762d15bfe4477f7ec15c3c08a07da857"'), ('location', 'https://api.github.com/repos/jacquev6/TestPyGithub'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Sat, 03 Nov 2012 09:01:00 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"watchers":0,"pushed_at":"2012-11-03T09:00:59Z","forks":0,"has_issues":true,"has_downloads":true,"open_issues_count":0,"description":null,"html_url":"https://github.com/jacquev6/TestPyGithub","owner":{"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"url":"https://api.github.com/repos/jacquev6/TestPyGithub","updated_at":"2012-11-03T09:01:00Z","permissions":{"push":true,"pull":true,"admin":true},"mirror_url":null,"clone_url":"https://github.com/jacquev6/TestPyGithub.git","language":null,"has_wiki":true,"ssh_url":"git@github.com:jacquev6/TestPyGithub.git","svn_url":"https://github.com/jacquev6/TestPyGithub","size":0,"fork":false,"full_name":"jacquev6/TestPyGithub","open_issues":0,"git_url":"git://github.com/jacquev6/TestPyGithub.git","forks_count":0,"name":"TestPyGithub","created_at":"2012-11-03T09:00:59Z","homepage":null,"private":false,"id":6517838,"master_branch":"master","network_count":0,"watchers_count":0} + diff --git a/test/ReplayData/AuthenticatedUser.testEditWithAllArguments.txt b/github/tests/ReplayData/AuthenticatedUser.testEditWithAllArguments.txt similarity index 76% rename from test/ReplayData/AuthenticatedUser.testEditWithAllArguments.txt rename to github/tests/ReplayData/AuthenticatedUser.testEditWithAllArguments.txt index e41cab66..24074c54 100644 --- a/test/ReplayData/AuthenticatedUser.testEditWithAllArguments.txt +++ b/github/tests/ReplayData/AuthenticatedUser.testEditWithAllArguments.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /user {'Authorization': 'Basic login_and_password_removed'} {"bio": "Bio edited by PyGithub", "name": "Name edited by PyGithub", "company": "Company edited by PyGithub", "blog": "Blog edited by PyGithub", "location": "Location edited by PyGithub", "hireable": true, "email": "Email edited by PyGithub"} +https PATCH api.github.com None /user {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"bio": "Bio edited by PyGithub", "name": "Name edited by PyGithub", "company": "Company edited by PyGithub", "blog": "Blog edited by PyGithub", "location": "Location edited by PyGithub", "hireable": true, "email": "Email edited by PyGithub"} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4998'), ('content-length', '858'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"4695e7d2dc3084a322fe83f342448a79"'), ('date', 'Tue, 08 May 2012 10:04:55 GMT'), ('content-type', 'application/json; charset=utf-8')] {"private_gists":5,"type":"User","hireable":true,"following":24,"company":"Company edited by PyGithub","blog":"Blog edited by PyGithub","bio":"Bio edited by PyGithub","html_url":"https://github.com/jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","total_private_repos":5,"public_repos":10,"url":"https://api.github.com/users/jacquev6","owned_private_repos":5,"login":"jacquev6","collaborators":0,"email":"Email edited by PyGithub","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","disk_usage":16692,"plan":{"private_repos":5,"collaborators":1,"space":614400,"name":"micro"},"created_at":"2010-07-09T06:10:06Z","name":"Name edited by PyGithub","public_gists":1,"followers":13,"id":327146,"location":"Location edited by PyGithub"} diff --git a/test/ReplayData/AuthenticatedUser.testEditWithoutArguments.txt b/github/tests/ReplayData/AuthenticatedUser.testEditWithoutArguments.txt similarity index 89% rename from test/ReplayData/AuthenticatedUser.testEditWithoutArguments.txt rename to github/tests/ReplayData/AuthenticatedUser.testEditWithoutArguments.txt index ddb6d975..6059546d 100644 --- a/test/ReplayData/AuthenticatedUser.testEditWithoutArguments.txt +++ b/github/tests/ReplayData/AuthenticatedUser.testEditWithoutArguments.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /user {'Authorization': 'Basic login_and_password_removed'} {} +https PATCH api.github.com None /user {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4996'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"811fb4d5df8bae5b1ef7d63537891a1c"'), ('date', 'Tue, 08 May 2012 10:05:35 GMT'), ('content-type', 'application/json; charset=utf-8')] {"private_gists":5,"collaborators":0,"type":"User","bio":"","url":"https://api.github.com/users/jacquev6","public_repos":10,"followers":13,"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","total_private_repos":5,"disk_usage":16692,"plan":{"collaborators":1,"space":614400,"name":"micro","private_repos":5},"html_url":"https://github.com/jacquev6","owned_private_repos":5,"login":"jacquev6","blog":"http://vincent-jacques.net","email":"vincent@vincent-jacques.net","created_at":"2010-07-09T06:10:06Z","company":"Criteo","location":"Paris, France","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","following":24,"name":"Vincent Jacques","public_gists":1,"hireable":false,"id":327146} diff --git a/test/ReplayData/AuthenticatedUser.testEmails.txt b/github/tests/ReplayData/AuthenticatedUser.testEmails.txt similarity index 86% rename from test/ReplayData/AuthenticatedUser.testEmails.txt rename to github/tests/ReplayData/AuthenticatedUser.testEmails.txt index c97445e8..6257091e 100644 --- a/test/ReplayData/AuthenticatedUser.testEmails.txt +++ b/github/tests/ReplayData/AuthenticatedUser.testEmails.txt @@ -3,7 +3,7 @@ https GET api.github.com None /user/emails {'Authorization': 'Basic login_and_pa [('status', '200 OK'), ('x-ratelimit-remaining', '4934'), ('content-length', '64'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"ea6dacf29569317ccf460b4bb07075e5"'), ('date', 'Sun, 20 May 2012 12:41:39 GMT'), ('content-type', 'application/json; charset=utf-8')] ["vincent@vincent-jacques.net","github.com@vincent-jacques.net"] -https POST api.github.com None /user/emails {'Authorization': 'Basic login_and_password_removed'} ["1@foobar.com", "2@foobar.com"] +https POST api.github.com None /user/emails {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} ["1@foobar.com", "2@foobar.com"] 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4933'), ('content-length', '94'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"8efae10ea5e433b0d68201389058e4ee"'), ('date', 'Sun, 20 May 2012 12:41:40 GMT'), ('content-type', 'application/json; charset=utf-8')] ["vincent@vincent-jacques.net","1@foobar.com","2@foobar.com","github.com@vincent-jacques.net"] @@ -13,7 +13,7 @@ https GET api.github.com None /user/emails {'Authorization': 'Basic login_and_pa [('status', '200 OK'), ('content-length', '94'), ('x-ratelimit-remaining', '4932'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"8efae10ea5e433b0d68201389058e4ee"'), ('date', 'Sun, 20 May 2012 12:41:41 GMT'), ('content-type', 'application/json; charset=utf-8')] ["vincent@vincent-jacques.net","1@foobar.com","2@foobar.com","github.com@vincent-jacques.net"] -https DELETE api.github.com None /user/emails {'Authorization': 'Basic login_and_password_removed'} ["1@foobar.com", "2@foobar.com"] +https DELETE api.github.com None /user/emails {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} ["1@foobar.com", "2@foobar.com"] 204 [('status', '204 No Content'), ('x-ratelimit-remaining', '4931'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"d41d8cd98f00b204e9800998ecf8427e"'), ('date', 'Sun, 20 May 2012 12:41:41 GMT')] diff --git a/test/ReplayData/AuthenticatedUser.testFollowing.txt b/github/tests/ReplayData/AuthenticatedUser.testFollowing.txt similarity index 100% rename from test/ReplayData/AuthenticatedUser.testFollowing.txt rename to github/tests/ReplayData/AuthenticatedUser.testFollowing.txt diff --git a/test/ReplayData/AuthenticatedUser.testGetAuthorizations.txt b/github/tests/ReplayData/AuthenticatedUser.testGetAuthorizations.txt similarity index 100% rename from test/ReplayData/AuthenticatedUser.testGetAuthorizations.txt rename to github/tests/ReplayData/AuthenticatedUser.testGetAuthorizations.txt diff --git a/test/ReplayData/AuthenticatedUser.testGetEvents.txt b/github/tests/ReplayData/AuthenticatedUser.testGetEvents.txt similarity index 100% rename from test/ReplayData/AuthenticatedUser.testGetEvents.txt rename to github/tests/ReplayData/AuthenticatedUser.testGetEvents.txt diff --git a/test/ReplayData/AuthenticatedUser.testGetGists.txt b/github/tests/ReplayData/AuthenticatedUser.testGetGists.txt similarity index 100% rename from test/ReplayData/AuthenticatedUser.testGetGists.txt rename to github/tests/ReplayData/AuthenticatedUser.testGetGists.txt diff --git a/test/ReplayData/AuthenticatedUser.testGetIssues.txt b/github/tests/ReplayData/AuthenticatedUser.testGetIssues.txt similarity index 100% rename from test/ReplayData/AuthenticatedUser.testGetIssues.txt rename to github/tests/ReplayData/AuthenticatedUser.testGetIssues.txt diff --git a/test/ReplayData/AuthenticatedUser.testGetKeys.txt b/github/tests/ReplayData/AuthenticatedUser.testGetKeys.txt similarity index 100% rename from test/ReplayData/AuthenticatedUser.testGetKeys.txt rename to github/tests/ReplayData/AuthenticatedUser.testGetKeys.txt diff --git a/test/ReplayData/AuthenticatedUser.testGetOrganizationEvents.txt b/github/tests/ReplayData/AuthenticatedUser.testGetOrganizationEvents.txt similarity index 100% rename from test/ReplayData/AuthenticatedUser.testGetOrganizationEvents.txt rename to github/tests/ReplayData/AuthenticatedUser.testGetOrganizationEvents.txt diff --git a/test/ReplayData/AuthenticatedUser.testGetOrgs.txt b/github/tests/ReplayData/AuthenticatedUser.testGetOrgs.txt similarity index 100% rename from test/ReplayData/AuthenticatedUser.testGetOrgs.txt rename to github/tests/ReplayData/AuthenticatedUser.testGetOrgs.txt diff --git a/test/ReplayData/AuthenticatedUser.testGetRepos.txt b/github/tests/ReplayData/AuthenticatedUser.testGetRepos.txt similarity index 100% rename from test/ReplayData/AuthenticatedUser.testGetRepos.txt rename to github/tests/ReplayData/AuthenticatedUser.testGetRepos.txt diff --git a/test/ReplayData/AuthenticatedUser.testGetReposWithArguments.txt b/github/tests/ReplayData/AuthenticatedUser.testGetReposWithArguments.txt similarity index 100% rename from test/ReplayData/AuthenticatedUser.testGetReposWithArguments.txt rename to github/tests/ReplayData/AuthenticatedUser.testGetReposWithArguments.txt diff --git a/test/ReplayData/AuthenticatedUser.testGetStarredGists.txt b/github/tests/ReplayData/AuthenticatedUser.testGetStarredGists.txt similarity index 100% rename from test/ReplayData/AuthenticatedUser.testGetStarredGists.txt rename to github/tests/ReplayData/AuthenticatedUser.testGetStarredGists.txt diff --git a/test/ReplayData/AuthenticatedUser.testStarring.txt b/github/tests/ReplayData/AuthenticatedUser.testStarring.txt similarity index 100% rename from test/ReplayData/AuthenticatedUser.testStarring.txt rename to github/tests/ReplayData/AuthenticatedUser.testStarring.txt diff --git a/test/ReplayData/AuthenticatedUser.testSubscriptions.txt b/github/tests/ReplayData/AuthenticatedUser.testSubscriptions.txt similarity index 100% rename from test/ReplayData/AuthenticatedUser.testSubscriptions.txt rename to github/tests/ReplayData/AuthenticatedUser.testSubscriptions.txt diff --git a/test/ReplayData/AuthenticatedUser.testWatching.txt b/github/tests/ReplayData/AuthenticatedUser.testWatching.txt similarity index 100% rename from test/ReplayData/AuthenticatedUser.testWatching.txt rename to github/tests/ReplayData/AuthenticatedUser.testWatching.txt diff --git a/test/ReplayData/Authentication.testBasicAuthentication.txt b/github/tests/ReplayData/Authentication.testBasicAuthentication.txt similarity index 100% rename from test/ReplayData/Authentication.testBasicAuthentication.txt rename to github/tests/ReplayData/Authentication.testBasicAuthentication.txt diff --git a/test/ReplayData/Authentication.testNoAuthentication.txt b/github/tests/ReplayData/Authentication.testNoAuthentication.txt similarity index 100% rename from test/ReplayData/Authentication.testNoAuthentication.txt rename to github/tests/ReplayData/Authentication.testNoAuthentication.txt diff --git a/test/ReplayData/Authentication.testOAuthAuthentication.txt b/github/tests/ReplayData/Authentication.testOAuthAuthentication.txt similarity index 100% rename from test/ReplayData/Authentication.testOAuthAuthentication.txt rename to github/tests/ReplayData/Authentication.testOAuthAuthentication.txt diff --git a/github/tests/ReplayData/Authentication.testSecretKeyAuthentication.txt b/github/tests/ReplayData/Authentication.testSecretKeyAuthentication.txt new file mode 100644 index 00000000..009c043a --- /dev/null +++ b/github/tests/ReplayData/Authentication.testSecretKeyAuthentication.txt @@ -0,0 +1,10 @@ +https GET api.github.com None /orgs/BeaverSoftware?client_secret=client_secret&client_id=client_id {} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4997'), ('content-length', '716'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"bd349122929faf5f9be3e53d9ad41d08"'), ('date', 'Fri, 11 May 2012 09:07:56 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"type":"Organization","url":"https://api.github.com/orgs/BeaverSoftware","billing_email":"BeaverSoftware@vincent-jacques.net","disk_usage":112,"plan":{"private_repos":0,"space":307200,"name":"free"},"html_url":"https://github.com/BeaverSoftware","blog":null,"login":"BeaverSoftware","public_gists":0,"email":null,"avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","total_private_repos":0,"private_gists":0,"collaborators":0,"created_at":"2012-02-09T19:20:12Z","company":null,"location":"Paris, France","followers":0,"following":0,"name":null,"owned_private_repos":0,"id":1424031,"public_repos":2} + +https GET api.github.com None /orgs/BeaverSoftware/repos?client_secret=client_secret&type=public&client_id=client_id {} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4987'), ('content-length', '2291'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"4bcc5321db433ac18171c121303c77d2"'), ('date', 'Tue, 29 May 2012 18:11:16 GMT'), ('content-type', 'application/json; charset=utf-8')] +[{"mirror_url":null,"clone_url":"https://github.com/BeaverSoftware/FatherBeaver.git","has_downloads":true,"watchers":2,"updated_at":"2012-02-16T21:51:15Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":"","url":"https://api.github.com/repos/BeaverSoftware/FatherBeaver","html_url":"https://github.com/BeaverSoftware/FatherBeaver","has_wiki":true,"has_issues":true,"fork":false,"git_url":"git://github.com/BeaverSoftware/FatherBeaver.git","forks":1,"size":0,"private":false,"open_issues":0,"svn_url":"https://github.com/BeaverSoftware/FatherBeaver","owner":{"url":"https://api.github.com/users/BeaverSoftware","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","id":1424031},"name":"FatherBeaver","language":null,"description":"","ssh_url":"git@github.com:BeaverSoftware/FatherBeaver.git","pushed_at":null,"created_at":"2012-02-09T19:32:21Z","id":3400397,"full_name":"BeaverSoftware/FatherBeaver"},{"mirror_url":null,"clone_url":"https://github.com/BeaverSoftware/PyGithub.git","has_downloads":true,"watchers":1,"updated_at":"2012-05-29T18:09:14Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/BeaverSoftware/PyGithub","html_url":"https://github.com/BeaverSoftware/PyGithub","has_wiki":false,"has_issues":false,"fork":true,"git_url":"git://github.com/BeaverSoftware/PyGithub.git","forks":0,"size":428,"private":false,"open_issues":0,"svn_url":"https://github.com/BeaverSoftware/PyGithub","owner":{"url":"https://api.github.com/users/BeaverSoftware","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","id":1424031},"name":"PyGithub","language":"Python","description":"Python library implementing the full Github API v3","ssh_url":"git@github.com:BeaverSoftware/PyGithub.git","pushed_at":"2012-05-29T18:05:10Z","created_at":"2012-05-29T18:03:19Z","id":4485562,"full_name":"BeaverSoftware/PyGithub"}] + diff --git a/github/tests/ReplayData/Authentication.testUserAgent.txt b/github/tests/ReplayData/Authentication.testUserAgent.txt new file mode 100644 index 00000000..dfe9ff7c --- /dev/null +++ b/github/tests/ReplayData/Authentication.testUserAgent.txt @@ -0,0 +1,5 @@ +https GET api.github.com None /users/jacquev6 {'User-Agent': 'PyGithubTester'} null +200 +[('status', '200 OK'), ('content-length', '1250'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('vary', 'Accept'), ('x-ratelimit-remaining', '57'), ('server', 'nginx'), ('last-modified', 'Mon, 19 Nov 2012 19:05:48 GMT'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '60'), ('etag', '"20bb1bc354d1c62d7c5e8b918cdbe6a1"'), ('cache-control', 'public, s-maxage=60, max-age=60'), ('date', 'Mon, 19 Nov 2012 20:14:08 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"public_repos":19,"type":"User","followers_url":"https://api.github.com/users/jacquev6/followers","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-user-420.png","received_events_url":"https://api.github.com/users/jacquev6/received_events","following_url":"https://api.github.com/users/jacquev6/following","login":"jacquev6","blog":"http://vincent-jacques.net","following":37,"html_url":"https://github.com/jacquev6","created_at":"2010-07-09T06:10:06Z","subscriptions_url":"https://api.github.com/users/jacquev6/subscriptions","hireable":false,"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","starred_url":"https://api.github.com/users/jacquev6/starred{/owner}{/repo}","gists_url":"https://api.github.com/users/jacquev6/gists{/gist_id}","bio":"","name":"Vincent Jacques","email":"vincent@vincent-jacques.net","repos_url":"https://api.github.com/users/jacquev6/repos","public_gists":2,"followers":18,"company":"Criteo","location":"Paris, France","id":327146,"events_url":"https://api.github.com/users/jacquev6/events{/privacy}","organizations_url":"https://api.github.com/users/jacquev6/orgs"} + diff --git a/test/ReplayData/Authorization.setUp.txt b/github/tests/ReplayData/Authorization.setUp.txt similarity index 100% rename from test/ReplayData/Authorization.setUp.txt rename to github/tests/ReplayData/Authorization.setUp.txt diff --git a/test/ReplayData/Authorization.testDelete.txt b/github/tests/ReplayData/Authorization.testDelete.txt similarity index 100% rename from test/ReplayData/Authorization.testDelete.txt rename to github/tests/ReplayData/Authorization.testDelete.txt diff --git a/test/ReplayData/Authorization.testEdit.txt b/github/tests/ReplayData/Authorization.testEdit.txt similarity index 78% rename from test/ReplayData/Authorization.testEdit.txt rename to github/tests/ReplayData/Authorization.testEdit.txt index bb0ab20e..9a62dc6c 100644 --- a/test/ReplayData/Authorization.testEdit.txt +++ b/github/tests/ReplayData/Authorization.testEdit.txt @@ -1,24 +1,24 @@ -https PATCH api.github.com None /authorizations/372259 {'Authorization': 'Basic login_and_password_removed'} {} +https PATCH api.github.com None /authorizations/372259 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4998'), ('content-length', '328'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"39fec03a7cbd97abde96cccbd1921277"'), ('date', 'Tue, 22 May 2012 18:24:09 GMT'), ('content-type', 'application/json; charset=utf-8')] {"scopes":[],"updated_at":"2012-05-22T18:24:09Z","app":{"url":"http://developer.github.com/v3/oauth/#oauth-authorizations-api","name":"GitHub API"},"note_url":null,"url":"https://api.github.com/authorizations/372259","token":"82459c4500086f8f0cc67d2936c17d1e27ad1c33","note":null,"created_at":"2012-05-22T18:03:17Z","id":372259} -https PATCH api.github.com None /authorizations/372259 {'Authorization': 'Basic login_and_password_removed'} {"scopes": ["user"]} +https PATCH api.github.com None /authorizations/372259 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"scopes": ["user"]} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4997'), ('content-length', '334'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"6476c8dce7e66cb43e71317294fd5b42"'), ('date', 'Tue, 22 May 2012 18:24:09 GMT'), ('content-type', 'application/json; charset=utf-8')] {"scopes":["user"],"updated_at":"2012-05-22T18:24:09Z","app":{"url":"http://developer.github.com/v3/oauth/#oauth-authorizations-api","name":"GitHub API"},"note_url":null,"url":"https://api.github.com/authorizations/372259","token":"82459c4500086f8f0cc67d2936c17d1e27ad1c33","note":null,"created_at":"2012-05-22T18:03:17Z","id":372259} -https PATCH api.github.com None /authorizations/372259 {'Authorization': 'Basic login_and_password_removed'} {"add_scopes": ["repo"]} +https PATCH api.github.com None /authorizations/372259 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"add_scopes": ["repo"]} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4996'), ('content-length', '341'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"aef23fb8f728fcd7acf751015c21661a"'), ('date', 'Tue, 22 May 2012 18:24:10 GMT'), ('content-type', 'application/json; charset=utf-8')] {"scopes":["user","repo"],"updated_at":"2012-05-22T18:24:10Z","app":{"url":"http://developer.github.com/v3/oauth/#oauth-authorizations-api","name":"GitHub API"},"url":"https://api.github.com/authorizations/372259","token":"82459c4500086f8f0cc67d2936c17d1e27ad1c33","note":null,"note_url":null,"created_at":"2012-05-22T18:03:17Z","id":372259} -https PATCH api.github.com None /authorizations/372259 {'Authorization': 'Basic login_and_password_removed'} {"remove_scopes": ["repo"]} +https PATCH api.github.com None /authorizations/372259 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"remove_scopes": ["repo"]} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4995'), ('content-length', '334'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"dff7e491f5d3c779385b9f3a41694a32"'), ('date', 'Tue, 22 May 2012 18:24:11 GMT'), ('content-type', 'application/json; charset=utf-8')] {"scopes":["user"],"updated_at":"2012-05-22T18:24:11Z","app":{"url":"http://developer.github.com/v3/oauth/#oauth-authorizations-api","name":"GitHub API"},"note_url":null,"url":"https://api.github.com/authorizations/372259","token":"82459c4500086f8f0cc67d2936c17d1e27ad1c33","note":null,"created_at":"2012-05-22T18:03:17Z","id":372259} -https PATCH api.github.com None /authorizations/372259 {'Authorization': 'Basic login_and_password_removed'} {"note": "Note created by PyGithub", "note_url": "http://vincent-jacques.net/PyGithub"} +https PATCH api.github.com None /authorizations/372259 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"note": "Note created by PyGithub", "note_url": "http://vincent-jacques.net/PyGithub"} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '382'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"5881b7d6eaa13e3b8539ca6ffc334be1"'), ('date', 'Tue, 22 May 2012 18:24:11 GMT'), ('content-type', 'application/json; charset=utf-8')] {"note_url":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/authorizations/372259","app":{"url":"http://vincent-jacques.net/PyGithub","name":"Note created by PyGithub (API)"},"scopes":["user"],"note":"Note created by PyGithub","token":"82459c4500086f8f0cc67d2936c17d1e27ad1c33","created_at":"2012-05-22T18:03:17Z","updated_at":"2012-05-22T18:24:11Z","id":372259} diff --git a/test/ReplayData/Branch.setUp.txt b/github/tests/ReplayData/Branch.setUp.txt similarity index 100% rename from test/ReplayData/Branch.setUp.txt rename to github/tests/ReplayData/Branch.setUp.txt diff --git a/test/ReplayData/Branch.testCommitCommentsOnLine.txt b/github/tests/ReplayData/Branch.testCommitCommentsOnLine.txt similarity index 100% rename from test/ReplayData/Branch.testCommitCommentsOnLine.txt rename to github/tests/ReplayData/Branch.testCommitCommentsOnLine.txt diff --git a/test/ReplayData/Commit.setUp.txt b/github/tests/ReplayData/Commit.setUp.txt similarity index 100% rename from test/ReplayData/Commit.setUp.txt rename to github/tests/ReplayData/Commit.setUp.txt diff --git a/test/ReplayData/Commit.testCreateComment.txt b/github/tests/ReplayData/Commit.testCreateComment.txt similarity index 86% rename from test/ReplayData/Commit.testCreateComment.txt rename to github/tests/ReplayData/Commit.testCreateComment.txt index 5d27f84e..0e25a78e 100644 --- a/test/ReplayData/Commit.testCreateComment.txt +++ b/github/tests/ReplayData/Commit.testCreateComment.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a/comments {'Authorization': 'Basic login_and_password_removed'} {"body": "Comment created by PyGithub"} +https POST api.github.com None /repos/jacquev6/PyGithub/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a/comments {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"body": "Comment created by PyGithub"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4982'), ('content-length', '714'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"bd72e3550c9b90814f0be2b54ab2cc8e"'), ('date', 'Tue, 22 May 2012 18:40:18 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/comments/1361949')] {"updated_at":"2012-05-22T18:40:18Z","position":null,"body":"Comment created by PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub/comments/1361949","commit_id":"1292bf0e22c796e91cc3d6e24b544aece8c21f2a","created_at":"2012-05-22T18:40:18Z","path":null,"line":null,"user":{"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","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146},"id":1361949,"html_url":"https://github.com/jacquev6/PyGithub/commit/1292bf0e22c796e91cc3d6e24b544aece8c21f2a#commitcomment-1361949"} diff --git a/test/ReplayData/Commit.testCreateCommentOnFileLine.txt b/github/tests/ReplayData/Commit.testCreateCommentOnFileLine.txt similarity index 82% rename from test/ReplayData/Commit.testCreateCommentOnFileLine.txt rename to github/tests/ReplayData/Commit.testCreateCommentOnFileLine.txt index 5ea9b85c..7fa9270d 100644 --- a/test/ReplayData/Commit.testCreateCommentOnFileLine.txt +++ b/github/tests/ReplayData/Commit.testCreateCommentOnFileLine.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a/comments {'Authorization': 'Basic login_and_password_removed'} {"body": "Comment created by PyGithub", "path": "codegen/templates/GithubObject.MethodBody.UseResult.py", "line": 26} +https POST api.github.com None /repos/jacquev6/PyGithub/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a/comments {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"body": "Comment created by PyGithub", "path": "codegen/templates/GithubObject.MethodBody.UseResult.py", "line": 26} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4970'), ('content-length', '764'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"d2cb361ce6c53a0fc986e74f8547088f"'), ('date', 'Tue, 22 May 2012 18:49:34 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/comments/1362000')] {"updated_at":"2012-05-22T18:49:34Z","position":null,"body":"Comment created by PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub/comments/1362000","commit_id":"1292bf0e22c796e91cc3d6e24b544aece8c21f2a","created_at":"2012-05-22T18:49:34Z","path":"codegen/templates/GithubObject.MethodBody.UseResult.py","line":26,"user":{"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","login":"jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146},"id":1362000,"html_url":"https://github.com/jacquev6/PyGithub/commit/1292bf0e22c796e91cc3d6e24b544aece8c21f2a#commitcomment-1362000"} diff --git a/test/ReplayData/Commit.testCreateCommentOnFilePosition.txt b/github/tests/ReplayData/Commit.testCreateCommentOnFilePosition.txt similarity index 82% rename from test/ReplayData/Commit.testCreateCommentOnFilePosition.txt rename to github/tests/ReplayData/Commit.testCreateCommentOnFilePosition.txt index 5e59d2ec..031becfb 100644 --- a/test/ReplayData/Commit.testCreateCommentOnFilePosition.txt +++ b/github/tests/ReplayData/Commit.testCreateCommentOnFilePosition.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a/comments {'Authorization': 'Basic login_and_password_removed'} {"body": "Comment also created by PyGithub", "path": "codegen/templates/GithubObject.MethodBody.UseResult.py", "position": 3} +https POST api.github.com None /repos/jacquev6/PyGithub/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a/comments {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"body": "Comment also created by PyGithub", "path": "codegen/templates/GithubObject.MethodBody.UseResult.py", "position": 3} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4966'), ('content-length', '768'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"b3d062ed01b92c31d072c7177113c0b1"'), ('date', 'Tue, 22 May 2012 18:50:02 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/comments/1362001')] {"url":"https://api.github.com/repos/jacquev6/PyGithub/comments/1362001","path":"codegen/templates/GithubObject.MethodBody.UseResult.py","body":"Comment also created by PyGithub","html_url":"https://github.com/jacquev6/PyGithub/commit/1292bf0e22c796e91cc3d6e24b544aece8c21f2a#commitcomment-1362001","created_at":"2012-05-22T18:50:02Z","commit_id":"1292bf0e22c796e91cc3d6e24b544aece8c21f2a","position":3,"updated_at":"2012-05-22T18:50:02Z","id":1362001,"line":null,"user":{"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}} diff --git a/test/ReplayData/Commit.testCreateStatusWithAllParameters.txt b/github/tests/ReplayData/Commit.testCreateStatusWithAllParameters.txt similarity index 81% rename from test/ReplayData/Commit.testCreateStatusWithAllParameters.txt rename to github/tests/ReplayData/Commit.testCreateStatusWithAllParameters.txt index 34f81d21..ae008886 100644 --- a/test/ReplayData/Commit.testCreateStatusWithAllParameters.txt +++ b/github/tests/ReplayData/Commit.testCreateStatusWithAllParameters.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/statuses/1292bf0e22c796e91cc3d6e24b544aece8c21f2a {'Authorization': 'Basic login_and_password_removed'} {"state": "success", "target_url": "https://github.com/jacquev6/PyGithub/issues/67", "description": "Status successfuly created by PyGithub"} +https POST api.github.com None /repos/jacquev6/PyGithub/statuses/1292bf0e22c796e91cc3d6e24b544aece8c21f2a {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"state": "success", "target_url": "https://github.com/jacquev6/PyGithub/issues/67", "description": "Status successfuly created by PyGithub"} 201 [('status', '201 Created'), ('content-length', '603'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-limit', '5000'), ('x-ratelimit-remaining', '4975'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('etag', '"06233b816702bedc54a6f68734a910bc"'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/statuses/277040'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Sat, 08 Sep 2012 11:30:56 GMT'), ('content-type', 'application/json; charset=utf-8')] {"creator":{"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","url":"https://api.github.com/users/jacquev6","login":"jacquev6","id":327146},"state":"success","updated_at":"2012-09-08T11:30:56Z","target_url":"https://github.com/jacquev6/PyGithub/issues/67","url":"https://api.github.com/repos/jacquev6/PyGithub/statuses/277040","description":"Status successfuly created by PyGithub","id":277040,"created_at":"2012-09-08T11:30:56Z"} diff --git a/test/ReplayData/Commit.testCreateStatusWithoutOptionalParameters.txt b/github/tests/ReplayData/Commit.testCreateStatusWithoutOptionalParameters.txt similarity index 88% rename from test/ReplayData/Commit.testCreateStatusWithoutOptionalParameters.txt rename to github/tests/ReplayData/Commit.testCreateStatusWithoutOptionalParameters.txt index bfd5ac0a..2860f991 100644 --- a/test/ReplayData/Commit.testCreateStatusWithoutOptionalParameters.txt +++ b/github/tests/ReplayData/Commit.testCreateStatusWithoutOptionalParameters.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/statuses/1292bf0e22c796e91cc3d6e24b544aece8c21f2a {'Authorization': 'Basic login_and_password_removed'} {"state": "pending"} +https POST api.github.com None /repos/jacquev6/PyGithub/statuses/1292bf0e22c796e91cc3d6e24b544aece8c21f2a {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"state": "pending"} 201 [('status', '201 Created'), ('content-length', '523'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-remaining', '4979'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/statuses/277031'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Sat, 08 Sep 2012 11:27:12 GMT'), ('etag', '"7e28427673d50844a69c0871e5e39a69"'), ('content-type', 'application/json; charset=utf-8')] {"description":null,"created_at":"2012-09-08T11:27:12Z","target_url":null,"state":"pending","updated_at":"2012-09-08T11:27:12Z","url":"https://api.github.com/repos/jacquev6/PyGithub/statuses/277031","id":277031,"creator":{"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","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-user-420.png","id":327146}} diff --git a/test/ReplayData/Commit.testGetComments.txt b/github/tests/ReplayData/Commit.testGetComments.txt similarity index 100% rename from test/ReplayData/Commit.testGetComments.txt rename to github/tests/ReplayData/Commit.testGetComments.txt diff --git a/test/ReplayData/CommitComment.setUp.txt b/github/tests/ReplayData/CommitComment.setUp.txt similarity index 100% rename from test/ReplayData/CommitComment.setUp.txt rename to github/tests/ReplayData/CommitComment.setUp.txt diff --git a/test/ReplayData/CommitComment.testDelete.txt b/github/tests/ReplayData/CommitComment.testDelete.txt similarity index 100% rename from test/ReplayData/CommitComment.testDelete.txt rename to github/tests/ReplayData/CommitComment.testDelete.txt diff --git a/test/ReplayData/CommitComment.testEdit.txt b/github/tests/ReplayData/CommitComment.testEdit.txt similarity index 88% rename from test/ReplayData/CommitComment.testEdit.txt rename to github/tests/ReplayData/CommitComment.testEdit.txt index 162dc43e..e6601d28 100644 --- a/test/ReplayData/CommitComment.testEdit.txt +++ b/github/tests/ReplayData/CommitComment.testEdit.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /repos/jacquev6/PyGithub/comments/1361949 {'Authorization': 'Basic login_and_password_removed'} {"body": "Comment edited by PyGithub"} +https PATCH api.github.com None /repos/jacquev6/PyGithub/comments/1361949 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"body": "Comment edited by PyGithub"} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4978'), ('content-length', '713'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"97ffd9ff8370f4f284873a6397d7cafd"'), ('date', 'Tue, 22 May 2012 18:43:17 GMT'), ('content-type', 'application/json; charset=utf-8')] {"updated_at":"2012-05-22T18:43:17Z","position":null,"body":"Comment edited by PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub/comments/1361949","commit_id":"6945921c529be14c3a8f566dd1e483674516d46d","created_at":"2012-05-22T18:40:18Z","path":null,"line":null,"user":{"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","login":"jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146},"id":1361949,"html_url":"https://github.com/jacquev6/PyGithub/commit/6945921c529be14c3a8f566dd1e483674516d46d#commitcomment-1361949"} diff --git a/test/ReplayData/CommitStatus.setUp.txt b/github/tests/ReplayData/CommitStatus.setUp.txt similarity index 100% rename from test/ReplayData/CommitStatus.setUp.txt rename to github/tests/ReplayData/CommitStatus.setUp.txt diff --git a/test/ReplayData/ContentFile.setUp.txt b/github/tests/ReplayData/ContentFile.setUp.txt similarity index 100% rename from test/ReplayData/ContentFile.setUp.txt rename to github/tests/ReplayData/ContentFile.setUp.txt diff --git a/test/ReplayData/Download.setUp.txt b/github/tests/ReplayData/Download.setUp.txt similarity index 100% rename from test/ReplayData/Download.setUp.txt rename to github/tests/ReplayData/Download.setUp.txt diff --git a/test/ReplayData/Download.testDelete.txt b/github/tests/ReplayData/Download.testDelete.txt similarity index 100% rename from test/ReplayData/Download.testDelete.txt rename to github/tests/ReplayData/Download.testDelete.txt diff --git a/test/ReplayData/Enterprise.testHttp.txt b/github/tests/ReplayData/Enterprise.testHttp.txt similarity index 100% rename from test/ReplayData/Enterprise.testHttp.txt rename to github/tests/ReplayData/Enterprise.testHttp.txt diff --git a/test/ReplayData/Enterprise.testHttps.txt b/github/tests/ReplayData/Enterprise.testHttps.txt similarity index 100% rename from test/ReplayData/Enterprise.testHttps.txt rename to github/tests/ReplayData/Enterprise.testHttps.txt diff --git a/test/ReplayData/Enterprise.testLongUrl.txt b/github/tests/ReplayData/Enterprise.testLongUrl.txt similarity index 100% rename from test/ReplayData/Enterprise.testLongUrl.txt rename to github/tests/ReplayData/Enterprise.testLongUrl.txt diff --git a/test/ReplayData/Enterprise.testSpecificPort.txt b/github/tests/ReplayData/Enterprise.testSpecificPort.txt similarity index 100% rename from test/ReplayData/Enterprise.testSpecificPort.txt rename to github/tests/ReplayData/Enterprise.testSpecificPort.txt diff --git a/test/ReplayData/Event.setUp.txt b/github/tests/ReplayData/Event.setUp.txt similarity index 100% rename from test/ReplayData/Event.setUp.txt rename to github/tests/ReplayData/Event.setUp.txt diff --git a/test/ReplayData/Exceptions.testBadAuthentication.txt b/github/tests/ReplayData/Exceptions.testBadAuthentication.txt similarity index 100% rename from test/ReplayData/Exceptions.testBadAuthentication.txt rename to github/tests/ReplayData/Exceptions.testBadAuthentication.txt diff --git a/test/ReplayData/Exceptions.testInvalidInput.txt b/github/tests/ReplayData/Exceptions.testInvalidInput.txt similarity index 77% rename from test/ReplayData/Exceptions.testInvalidInput.txt rename to github/tests/ReplayData/Exceptions.testInvalidInput.txt index 321d2aae..3524884d 100644 --- a/test/ReplayData/Exceptions.testInvalidInput.txt +++ b/github/tests/ReplayData/Exceptions.testInvalidInput.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /user/keys {'Authorization': 'Basic login_and_password_removed'} {"key": "xxx", "title": "Bad key"} +https POST api.github.com None /user/keys {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"key": "xxx", "title": "Bad key"} 422 [('status', '422 Unprocessable Entity'), ('x-ratelimit-remaining', '4995'), ('content-length', '221'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"73f756ef75655dd74463eb1bf4cfefe1"'), ('date', 'Wed, 30 May 2012 07:00:27 GMT'), ('content-type', 'application/json; charset=utf-8')] {"message":"Validation Failed","errors":[{"field":"key","resource":"PublicKey","message":"key is invalid. It must begin with 'ssh-rsa' or 'ssh-dss'. Check that you're copying the public half of the key","code":"custom"}]} diff --git a/test/ReplayData/Exceptions.testUnknownObject.txt b/github/tests/ReplayData/Exceptions.testUnknownObject.txt similarity index 100% rename from test/ReplayData/Exceptions.testUnknownObject.txt rename to github/tests/ReplayData/Exceptions.testUnknownObject.txt diff --git a/test/ReplayData/Exceptions.testUnknownUser.txt b/github/tests/ReplayData/Exceptions.testUnknownUser.txt similarity index 100% rename from test/ReplayData/Exceptions.testUnknownUser.txt rename to github/tests/ReplayData/Exceptions.testUnknownUser.txt diff --git a/test/ReplayData/Gist.setUp.txt b/github/tests/ReplayData/Gist.setUp.txt similarity index 100% rename from test/ReplayData/Gist.setUp.txt rename to github/tests/ReplayData/Gist.setUp.txt diff --git a/test/ReplayData/Gist.testCreateComment.txt b/github/tests/ReplayData/Gist.testCreateComment.txt similarity index 82% rename from test/ReplayData/Gist.testCreateComment.txt rename to github/tests/ReplayData/Gist.testCreateComment.txt index bfac7a39..17822052 100644 --- a/test/ReplayData/Gist.testCreateComment.txt +++ b/github/tests/ReplayData/Gist.testCreateComment.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /gists/2729810/comments {'Authorization': 'Basic login_and_password_removed'} {"body": "Comment created by PyGithub"} +https POST api.github.com None /gists/2729810/comments {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"body": "Comment created by PyGithub"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4992'), ('content-length', '479'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"77456eabf6ebaafc2808cfbd4dfa5904"'), ('date', 'Sat, 19 May 2012 07:07:57 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/gists/comments/323629')] {"updated_at":"2012-05-19T07:07:57Z","body":"Comment created by PyGithub","url":"https://api.github.com/gists/comments/323629","created_at":"2012-05-19T07:07:57Z","user":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","id":327146},"id":323629} diff --git a/test/ReplayData/Gist.testDelete.txt b/github/tests/ReplayData/Gist.testDelete.txt similarity index 100% rename from test/ReplayData/Gist.testDelete.txt rename to github/tests/ReplayData/Gist.testDelete.txt diff --git a/test/ReplayData/Gist.testEditWithAllParameters.txt b/github/tests/ReplayData/Gist.testEditWithAllParameters.txt similarity index 92% rename from test/ReplayData/Gist.testEditWithAllParameters.txt rename to github/tests/ReplayData/Gist.testEditWithAllParameters.txt index 38805d60..9a17f9bf 100644 --- a/test/ReplayData/Gist.testEditWithAllParameters.txt +++ b/github/tests/ReplayData/Gist.testEditWithAllParameters.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /gists/2729810 {'Authorization': 'Basic login_and_password_removed'} {"files": {"barbaz.txt": {"content": "File also created by PyGithub"}}, "description": "Description edited by PyGithub"} +https PATCH api.github.com None /gists/2729810 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"files": {"barbaz.txt": {"content": "File also created by PyGithub"}}, "description": "Description edited by PyGithub"} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '2759'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"14d4466c0580c6f8e9be17f81eb1c3b0"'), ('date', 'Sat, 19 May 2012 07:06:10 GMT'), ('content-type', 'application/json; charset=utf-8')] {"updated_at":"2012-05-19T07:06:10Z","forks":[],"url":"https://api.github.com/gists/2729810","comments":0,"public":true,"git_pull_url":"git://gist.github.com/2729810.git","files":{"barbaz.txt":{"type":"text/plain","raw_url":"https://gist.github.com/raw/2729810/92be1df4e473d2541c5c166ad145a39d0324de8b/barbaz.txt","size":29,"filename":"barbaz.txt","content":"File also created by PyGithub","language":"Text"},"foobar.txt":{"type":"text/plain","raw_url":"https://gist.github.com/raw/2729810/73a1c7f17aa0ad5d7cbb5a8ca033ce47d3d23197/foobar.txt","size":24,"filename":"foobar.txt","content":"File created by PyGithub","language":"Text"}},"html_url":"https://gist.github.com/2729810","git_push_url":"git@gist.github.com:2729810.git","user":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","id":327146},"description":"Description edited by PyGithub","created_at":"2012-05-19T07:00:58Z","id":"2729810","history":[{"url":"https://api.github.com/gists/2729810/67524fb6eb4883d979e8b4cf133003fa81a6a472","change_status":{"deletions":0,"additions":0,"total":0},"committed_at":"2012-05-19T07:06:10Z","version":"67524fb6eb4883d979e8b4cf133003fa81a6a472","user":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","id":327146}},{"url":"https://api.github.com/gists/2729810/e730170a9599696a9d776f8bb5028b35f937b6de","change_status":{"deletions":0,"additions":1,"total":1},"committed_at":"2012-05-19T07:04:31Z","version":"e730170a9599696a9d776f8bb5028b35f937b6de","user":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","id":327146}},{"url":"https://api.github.com/gists/2729810/35deb29ab1caf4c68c03d8244ad674b56de01a5c","change_status":{"deletions":0,"additions":1,"total":1},"committed_at":"2012-05-19T07:00:58Z","version":"35deb29ab1caf4c68c03d8244ad674b56de01a5c","user":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","id":327146}}]} diff --git a/test/ReplayData/Gist.testEditWithoutParameters.txt b/github/tests/ReplayData/Gist.testEditWithoutParameters.txt similarity index 92% rename from test/ReplayData/Gist.testEditWithoutParameters.txt rename to github/tests/ReplayData/Gist.testEditWithoutParameters.txt index af76f58f..fb12bbe7 100644 --- a/test/ReplayData/Gist.testEditWithoutParameters.txt +++ b/github/tests/ReplayData/Gist.testEditWithoutParameters.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /gists/2729810 {'Authorization': 'Basic login_and_password_removed'} {} +https PATCH api.github.com None /gists/2729810 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4998'), ('content-length', '1446'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"9d90688efdf43c600be9c6c068f007dd"'), ('date', 'Sat, 19 May 2012 07:03:55 GMT'), ('content-type', 'application/json; charset=utf-8')] {"updated_at":"2012-05-19T07:00:58Z","git_push_url":"git@gist.github.com:2729810.git","forks":[],"url":"https://api.github.com/gists/2729810","comments":0,"public":true,"files":{"foobar.txt":{"type":"text/plain","raw_url":"https://gist.github.com/raw/2729810/73a1c7f17aa0ad5d7cbb5a8ca033ce47d3d23197/foobar.txt","size":24,"filename":"foobar.txt","content":"File created by PyGithub","language":"Text"}},"html_url":"https://gist.github.com/2729810","user":{"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","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"description":"Gist created by PyGithub","created_at":"2012-05-19T07:00:58Z","id":"2729810","history":[{"url":"https://api.github.com/gists/2729810/35deb29ab1caf4c68c03d8244ad674b56de01a5c","version":"35deb29ab1caf4c68c03d8244ad674b56de01a5c","change_status":{"deletions":0,"additions":1,"total":1},"committed_at":"2012-05-19T07:00:58Z","user":{"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","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146}}],"git_pull_url":"git://gist.github.com/2729810.git"} diff --git a/test/ReplayData/Gist.testFork.txt b/github/tests/ReplayData/Gist.testFork.txt similarity index 100% rename from test/ReplayData/Gist.testFork.txt rename to github/tests/ReplayData/Gist.testFork.txt diff --git a/test/ReplayData/Gist.testGetComments.txt b/github/tests/ReplayData/Gist.testGetComments.txt similarity index 100% rename from test/ReplayData/Gist.testGetComments.txt rename to github/tests/ReplayData/Gist.testGetComments.txt diff --git a/test/ReplayData/Gist.testStarring.txt b/github/tests/ReplayData/Gist.testStarring.txt similarity index 100% rename from test/ReplayData/Gist.testStarring.txt rename to github/tests/ReplayData/Gist.testStarring.txt diff --git a/test/ReplayData/GistComment.setUp.txt b/github/tests/ReplayData/GistComment.setUp.txt similarity index 86% rename from test/ReplayData/GistComment.setUp.txt rename to github/tests/ReplayData/GistComment.setUp.txt index 1f35ba10..bad1d596 100644 --- a/test/ReplayData/GistComment.setUp.txt +++ b/github/tests/ReplayData/GistComment.setUp.txt @@ -3,8 +3,8 @@ https GET api.github.com None /gists/2729810 {'Authorization': 'Basic login_and_ [('status', '200 OK'), ('x-ratelimit-remaining', '4970'), ('content-length', '3280'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"b01fb6ac81527f99db9f6f586b048ee3"'), ('date', 'Sat, 19 May 2012 06:58:15 GMT'), ('content-type', 'application/json; charset=utf-8')] {"updated_at":"2012-02-29T16:47:12Z","forks":[],"url":"https://api.github.com/gists/2729810","comments":0,"public":true,"git_pull_url":"git://gist.github.com/2729810.git","files":{"fail_github.py":{"type":"application/python","raw_url":"https://gist.github.com/raw/2729810/2fb3aa84e0efa50dc0f4c18b5df5b7b9ab27076b/fail_github.py","size":1636,"filename":"fail_github.py","content":"import httplib\nimport base64\nimport json\n\nlogin = \"\"\npassword = \"\"\norgName = \"\"\nrepoName = \"FailGithubApi\"\n\ndef doRequest( verb, url, input ):\n input = json.dumps( input )\n cnx = httplib.HTTPSConnection( \"api.github.com\", strict = True )\n cnx.request( verb, url, input, { \"Authorization\" : \"Basic \" + base64.b64encode( login + \":\" + password ).replace( '\\n', '' ) } )\n response = cnx.getresponse()\n status = response.status\n output = response.read()\n cnx.close()\n print verb, url, input, \"=>\", status, output\n print\n if status < 200 or status >= 300:\n exit( 1 )\n return json.loads( output )\n\n# Create a repo\ndoRequest( \"POST\", \"/user/repos\", { \"name\": repoName } )\n\n# Create a blob, a tree, a commit and the master branch\nb = doRequest(\n \"POST\", \"/repos/%s/%s/git/blobs\" % ( login, repoName ),\n { \"content\": \"Content of the blob\", \"encoding\": \"latin1\" }\n)\nt = doRequest(\n \"POST\", \"/repos/%s/%s/git/trees\" % ( login, repoName ),\n { \"tree\" : [ { \"path\": \"foo.bar\", \"type\": \"blob\", \"mode\": \"100644\", \"sha\": b[\"sha\"] } ] }\n)\nc = doRequest(\n \"POST\", \"/repos/%s/%s/git/commits\" % ( login, repoName ),\n { \"parents\": [], \"message\": \"Message of the commit\", \"tree\": t[\"sha\"] }\n)\ndoRequest(\n \"POST\", \"/repos/%s/%s/git/refs\" % ( login, repoName ),\n { \"ref\": \"refs/heads/master\", \"sha\": c[\"sha\"] }\n)\n\n# Fork the repo\ndoRequest( \"POST\", \"/repos/%s/%s/forks?org=%s\" % ( login, repoName, orgName ), None )\n\n# Create a new blob => BOOM error 500\ndoRequest(\n \"POST\", \"/repos/%s/%s/git/blobs\" % ( orgName, repoName ),\n { \"content\": \"Content of the new blob\", \"encoding\": \"latin1\" }\n)\n","language":"Python"}},"html_url":"https://gist.github.com/2729810","git_push_url":"git@gist.github.com:2729810.git","user":{"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","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"description":"How to error 500 Github API v3, as requested by Rick (GitHub Staff)","created_at":"2012-02-29T16:47:12Z","id":"2729810","history":[{"url":"https://api.github.com/gists/2729810/a40de483e42ba33bda308371c0ef8383db73be9e","change_status":{"deletions":0,"additions":52,"total":52},"committed_at":"2012-02-29T16:47:12Z","version":"a40de483e42ba33bda308371c0ef8383db73be9e","user":{"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","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146}}]} -https GET api.github.com None /gists/comments/323629 {'Authorization': 'Basic login_and_password_removed'} null +https GET api.github.com None /gists/2729810/comments/323629 {'Authorization': 'Basic login_and_password_removed'} null 200 [('status', '200 OK'), ('content-length', '479'), ('x-ratelimit-limit', '5000'), ('x-ratelimit-remaining', '4988'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('etag', '"c2581153865c9b18a576589587e1fb98"'), ('date', 'Sat, 19 May 2012 07:12:31 GMT'), ('content-type', 'application/json; charset=utf-8')] -{"url":"https://api.github.com/gists/comments/323629","body":"Comment created by PyGithub","created_at":"2012-05-19T07:07:57Z","updated_at":"2012-05-19T07:07:57Z","id":323629,"user":{"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","login":"jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146}} +{"url":"https://api.github.com/gists/2729810/comments/323629","body":"Comment created by PyGithub","created_at":"2012-05-19T07:07:57Z","updated_at":"2012-05-19T07:07:57Z","id":323629,"user":{"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","login":"jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146}} diff --git a/test/ReplayData/GistComment.testDelete.txt b/github/tests/ReplayData/GistComment.testDelete.txt similarity index 67% rename from test/ReplayData/GistComment.testDelete.txt rename to github/tests/ReplayData/GistComment.testDelete.txt index 55599972..871d1fac 100644 --- a/test/ReplayData/GistComment.testDelete.txt +++ b/github/tests/ReplayData/GistComment.testDelete.txt @@ -1,4 +1,4 @@ -https DELETE api.github.com None /gists/comments/323629 {'Authorization': 'Basic login_and_password_removed'} null +https DELETE api.github.com None /gists/2729810/comments/323629 {'Authorization': 'Basic login_and_password_removed'} null 204 [('status', '204 No Content'), ('x-ratelimit-remaining', '4984'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"d41d8cd98f00b204e9800998ecf8427e"'), ('date', 'Sat, 19 May 2012 07:14:33 GMT')] diff --git a/github/tests/ReplayData/GistComment.testEdit.txt b/github/tests/ReplayData/GistComment.testEdit.txt new file mode 100644 index 00000000..0fd1d93d --- /dev/null +++ b/github/tests/ReplayData/GistComment.testEdit.txt @@ -0,0 +1,5 @@ +https PATCH api.github.com None /gists/2729810/comments/323629 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"body": "Comment edited by PyGithub"} +200 +[('status', '200 OK'), ('content-length', '478'), ('x-ratelimit-limit', '5000'), ('x-ratelimit-remaining', '4987'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('etag', '"cea8090368993f1fb95c32cdcf4245d3"'), ('date', 'Sat, 19 May 2012 07:12:32 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"url":"https://api.github.com/gists/2729810/comments/323629","body":"Comment edited by PyGithub","created_at":"2012-05-19T07:07:57Z","updated_at":"2012-05-19T07:12:32Z","id":323629,"user":{"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","login":"jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146}} + diff --git a/test/ReplayData/GitBlob.setUp.txt b/github/tests/ReplayData/GitBlob.setUp.txt similarity index 100% rename from test/ReplayData/GitBlob.setUp.txt rename to github/tests/ReplayData/GitBlob.setUp.txt diff --git a/test/ReplayData/GitCommit.setUp.txt b/github/tests/ReplayData/GitCommit.setUp.txt similarity index 100% rename from test/ReplayData/GitCommit.setUp.txt rename to github/tests/ReplayData/GitCommit.setUp.txt diff --git a/test/ReplayData/GitRef.setUp.txt b/github/tests/ReplayData/GitRef.setUp.txt similarity index 100% rename from test/ReplayData/GitRef.setUp.txt rename to github/tests/ReplayData/GitRef.setUp.txt diff --git a/test/ReplayData/GitRef.testDelete.txt b/github/tests/ReplayData/GitRef.testDelete.txt similarity index 100% rename from test/ReplayData/GitRef.testDelete.txt rename to github/tests/ReplayData/GitRef.testDelete.txt diff --git a/test/ReplayData/GitRef.testEdit.txt b/github/tests/ReplayData/GitRef.testEdit.txt similarity index 80% rename from test/ReplayData/GitRef.testEdit.txt rename to github/tests/ReplayData/GitRef.testEdit.txt index c2c099ac..41c2d5c6 100644 --- a/test/ReplayData/GitRef.testEdit.txt +++ b/github/tests/ReplayData/GitRef.testEdit.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /repos/jacquev6/PyGithub/git/refs/heads/BranchCreatedByPyGithub {'Authorization': 'Basic login_and_password_removed'} {"sha": "04cde900a0775b51f762735637bd30de392a2793"} +https PATCH api.github.com None /repos/jacquev6/PyGithub/git/refs/heads/BranchCreatedByPyGithub {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"sha": "04cde900a0775b51f762735637bd30de392a2793"} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4986'), ('content-length', '322'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"ced480ad69948233f6520f7cd945eb34"'), ('date', 'Thu, 10 May 2012 18:49:20 GMT'), ('content-type', 'application/json; charset=utf-8')] {"url":"https://api.github.com/repos/jacquev6/PyGithub/git/refs/heads/BranchCreatedByPyGithub","object":{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/04cde900a0775b51f762735637bd30de392a2793","type":"commit","sha":"04cde900a0775b51f762735637bd30de392a2793"},"ref":"refs/heads/BranchCreatedByPyGithub"} diff --git a/test/ReplayData/GitRef.testEditWithForce.txt b/github/tests/ReplayData/GitRef.testEditWithForce.txt similarity index 78% rename from test/ReplayData/GitRef.testEditWithForce.txt rename to github/tests/ReplayData/GitRef.testEditWithForce.txt index 2a0e6a5c..6c35c919 100644 --- a/test/ReplayData/GitRef.testEditWithForce.txt +++ b/github/tests/ReplayData/GitRef.testEditWithForce.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /repos/jacquev6/PyGithub/git/refs/heads/BranchCreatedByPyGithub {'Authorization': 'Basic login_and_password_removed'} {"sha": "4303c5b90e2216d927155e9609436ccb8984c495", "force": true} +https PATCH api.github.com None /repos/jacquev6/PyGithub/git/refs/heads/BranchCreatedByPyGithub {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"sha": "4303c5b90e2216d927155e9609436ccb8984c495", "force": true} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4985'), ('content-length', '322'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"fb39f29de1defbab14def8a331d00c69"'), ('date', 'Thu, 10 May 2012 18:49:21 GMT'), ('content-type', 'application/json; charset=utf-8')] {"url":"https://api.github.com/repos/jacquev6/PyGithub/git/refs/heads/BranchCreatedByPyGithub","object":{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495","type":"commit","sha":"4303c5b90e2216d927155e9609436ccb8984c495"},"ref":"refs/heads/BranchCreatedByPyGithub"} diff --git a/test/ReplayData/GitTag.setUp.txt b/github/tests/ReplayData/GitTag.setUp.txt similarity index 100% rename from test/ReplayData/GitTag.setUp.txt rename to github/tests/ReplayData/GitTag.setUp.txt diff --git a/test/ReplayData/GitTree.setUp.txt b/github/tests/ReplayData/GitTree.setUp.txt similarity index 100% rename from test/ReplayData/GitTree.setUp.txt rename to github/tests/ReplayData/GitTree.setUp.txt diff --git a/test/ReplayData/Github.testGetGists.txt b/github/tests/ReplayData/Github.testGetGists.txt similarity index 100% rename from test/ReplayData/Github.testGetGists.txt rename to github/tests/ReplayData/Github.testGetGists.txt diff --git a/test/ReplayData/Github.testGetHooks.txt b/github/tests/ReplayData/Github.testGetHooks.txt similarity index 100% rename from test/ReplayData/Github.testGetHooks.txt rename to github/tests/ReplayData/Github.testGetHooks.txt diff --git a/test/ReplayData/Github.testLegacySearchRepos.txt b/github/tests/ReplayData/Github.testLegacySearchRepos.txt similarity index 100% rename from test/ReplayData/Github.testLegacySearchRepos.txt rename to github/tests/ReplayData/Github.testLegacySearchRepos.txt diff --git a/test/ReplayData/Github.testLegacySearchReposExplicitPagination.txt b/github/tests/ReplayData/Github.testLegacySearchReposExplicitPagination.txt similarity index 100% rename from test/ReplayData/Github.testLegacySearchReposExplicitPagination.txt rename to github/tests/ReplayData/Github.testLegacySearchReposExplicitPagination.txt diff --git a/test/ReplayData/Github.testLegacySearchReposPagination.txt b/github/tests/ReplayData/Github.testLegacySearchReposPagination.txt similarity index 100% rename from test/ReplayData/Github.testLegacySearchReposPagination.txt rename to github/tests/ReplayData/Github.testLegacySearchReposPagination.txt diff --git a/test/ReplayData/Github.testLegacySearchReposWithLanguage.txt b/github/tests/ReplayData/Github.testLegacySearchReposWithLanguage.txt similarity index 100% rename from test/ReplayData/Github.testLegacySearchReposWithLanguage.txt rename to github/tests/ReplayData/Github.testLegacySearchReposWithLanguage.txt diff --git a/test/ReplayData/Github.testLegacySearchUserByEmail.txt b/github/tests/ReplayData/Github.testLegacySearchUserByEmail.txt similarity index 100% rename from test/ReplayData/Github.testLegacySearchUserByEmail.txt rename to github/tests/ReplayData/Github.testLegacySearchUserByEmail.txt diff --git a/test/ReplayData/Github.testLegacySearchUsers.txt b/github/tests/ReplayData/Github.testLegacySearchUsers.txt similarity index 100% rename from test/ReplayData/Github.testLegacySearchUsers.txt rename to github/tests/ReplayData/Github.testLegacySearchUsers.txt diff --git a/test/ReplayData/Github.testLegacySearchUsersExplicitPagination.txt b/github/tests/ReplayData/Github.testLegacySearchUsersExplicitPagination.txt similarity index 100% rename from test/ReplayData/Github.testLegacySearchUsersExplicitPagination.txt rename to github/tests/ReplayData/Github.testLegacySearchUsersExplicitPagination.txt diff --git a/test/ReplayData/Github.testLegacySearchUsersPagination.txt b/github/tests/ReplayData/Github.testLegacySearchUsersPagination.txt similarity index 100% rename from test/ReplayData/Github.testLegacySearchUsersPagination.txt rename to github/tests/ReplayData/Github.testLegacySearchUsersPagination.txt diff --git a/test/ReplayData/Github.testSearchRepos.txt b/github/tests/ReplayData/Github.testSearchRepos.txt similarity index 100% rename from test/ReplayData/Github.testSearchRepos.txt rename to github/tests/ReplayData/Github.testSearchRepos.txt diff --git a/test/ReplayData/Github.testSearchUserByEmail.txt b/github/tests/ReplayData/Github.testSearchUserByEmail.txt similarity index 100% rename from test/ReplayData/Github.testSearchUserByEmail.txt rename to github/tests/ReplayData/Github.testSearchUserByEmail.txt diff --git a/test/ReplayData/Github.testSearchUsers.txt b/github/tests/ReplayData/Github.testSearchUsers.txt similarity index 100% rename from test/ReplayData/Github.testSearchUsers.txt rename to github/tests/ReplayData/Github.testSearchUsers.txt diff --git a/test/ReplayData/Hook.setUp.txt b/github/tests/ReplayData/Hook.setUp.txt similarity index 100% rename from test/ReplayData/Hook.setUp.txt rename to github/tests/ReplayData/Hook.setUp.txt diff --git a/test/ReplayData/Hook.testDelete.txt b/github/tests/ReplayData/Hook.testDelete.txt similarity index 100% rename from test/ReplayData/Hook.testDelete.txt rename to github/tests/ReplayData/Hook.testDelete.txt diff --git a/test/ReplayData/Hook.testEditWithAllParameters.txt b/github/tests/ReplayData/Hook.testEditWithAllParameters.txt similarity index 79% rename from test/ReplayData/Hook.testEditWithAllParameters.txt rename to github/tests/ReplayData/Hook.testEditWithAllParameters.txt index ec23510d..241cd01a 100644 --- a/test/ReplayData/Hook.testEditWithAllParameters.txt +++ b/github/tests/ReplayData/Hook.testEditWithAllParameters.txt @@ -1,19 +1,19 @@ -https PATCH api.github.com None /repos/jacquev6/PyGithub/hooks/257993 {'Authorization': 'Basic login_and_password_removed'} {"config": {"url": "http://foobar.com"}, "name": "web", "events": ["fork", "push"]} +https PATCH api.github.com None /repos/jacquev6/PyGithub/hooks/257993 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"config": {"url": "http://foobar.com"}, "name": "web", "events": ["fork", "push"]} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4987'), ('content-length', '305'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"43f8b86dbc2f5bbfde20abb9d9142206"'), ('date', 'Sat, 19 May 2012 06:03:18 GMT'), ('content-type', 'application/json; charset=utf-8')] {"updated_at":"2012-05-19T06:03:18Z","url":"https://api.github.com/repos/jacquev6/PyGithub/hooks/257993","last_response":{"status":"unused","message":null,"code":null},"config":{"url":"http://foobar.com"},"active":true,"events":["fork","push"],"name":"web","created_at":"2012-05-19T06:01:45Z","id":257993} -https PATCH api.github.com None /repos/jacquev6/PyGithub/hooks/257993 {'Authorization': 'Basic login_and_password_removed'} {"config": {"url": "http://foobar.com"}, "name": "web", "add_events": ["push"]} +https PATCH api.github.com None /repos/jacquev6/PyGithub/hooks/257993 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"config": {"url": "http://foobar.com"}, "name": "web", "add_events": ["push"]} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4986'), ('content-length', '305'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"f372cc9359ed1d3b3fb8d484a09b36d7"'), ('date', 'Sat, 19 May 2012 06:03:19 GMT'), ('content-type', 'application/json; charset=utf-8')] {"updated_at":"2012-05-19T06:03:19Z","url":"https://api.github.com/repos/jacquev6/PyGithub/hooks/257993","last_response":{"status":"unused","message":null,"code":null},"config":{"url":"http://foobar.com"},"active":true,"events":["fork","push"],"name":"web","created_at":"2012-05-19T06:01:45Z","id":257993} -https PATCH api.github.com None /repos/jacquev6/PyGithub/hooks/257993 {'Authorization': 'Basic login_and_password_removed'} {"remove_events": ["fork"], "config": {"url": "http://foobar.com"}, "name": "web"} +https PATCH api.github.com None /repos/jacquev6/PyGithub/hooks/257993 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"remove_events": ["fork"], "config": {"url": "http://foobar.com"}, "name": "web"} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4985'), ('content-length', '298'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"223ecc83a014738547fd99c826e3f125"'), ('date', 'Sat, 19 May 2012 06:03:19 GMT'), ('content-type', 'application/json; charset=utf-8')] {"updated_at":"2012-05-19T06:03:19Z","url":"https://api.github.com/repos/jacquev6/PyGithub/hooks/257993","config":{"url":"http://foobar.com"},"active":true,"last_response":{"status":"unused","message":null,"code":null},"events":["push"],"name":"web","created_at":"2012-05-19T06:01:45Z","id":257993} -https PATCH api.github.com None /repos/jacquev6/PyGithub/hooks/257993 {'Authorization': 'Basic login_and_password_removed'} {"active": true, "config": {"url": "http://foobar.com"}, "name": "web"} +https PATCH api.github.com None /repos/jacquev6/PyGithub/hooks/257993 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"active": true, "config": {"url": "http://foobar.com"}, "name": "web"} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4984'), ('content-length', '298'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"711cf06c29a923c290e1af74dc3e019d"'), ('date', 'Sat, 19 May 2012 06:03:20 GMT'), ('content-type', 'application/json; charset=utf-8')] {"updated_at":"2012-05-19T06:03:20Z","url":"https://api.github.com/repos/jacquev6/PyGithub/hooks/257993","last_response":{"status":"unused","message":null,"code":null},"config":{"url":"http://foobar.com"},"active":true,"events":["push"],"name":"web","created_at":"2012-05-19T06:01:45Z","id":257993} diff --git a/test/ReplayData/Hook.testEditWithMinimalParameters.txt b/github/tests/ReplayData/Hook.testEditWithMinimalParameters.txt similarity index 81% rename from test/ReplayData/Hook.testEditWithMinimalParameters.txt rename to github/tests/ReplayData/Hook.testEditWithMinimalParameters.txt index 14d546f5..64a21ca1 100644 --- a/test/ReplayData/Hook.testEditWithMinimalParameters.txt +++ b/github/tests/ReplayData/Hook.testEditWithMinimalParameters.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /repos/jacquev6/PyGithub/hooks/257993 {'Authorization': 'Basic login_and_password_removed'} {"config": {"url": "http://foobar.com/hook"}, "name": "web"} +https PATCH api.github.com None /repos/jacquev6/PyGithub/hooks/257993 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"config": {"url": "http://foobar.com/hook"}, "name": "web"} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4990'), ('content-length', '303'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"8628a600a78bd5171c9e8d23b1ec22de"'), ('date', 'Sat, 19 May 2012 05:08:16 GMT'), ('content-type', 'application/json; charset=utf-8')] {"last_response":{"status":"unused","message":null,"code":null},"updated_at":"2012-05-19T05:08:16Z","url":"https://api.github.com/repos/jacquev6/PyGithub/hooks/257993","config":{"url":"http://foobar.com/hook"},"active":true,"events":["push"],"name":"web","created_at":"2012-05-19T05:03:14Z","id":257993} diff --git a/test/ReplayData/Hook.testTest.txt b/github/tests/ReplayData/Hook.testTest.txt similarity index 100% rename from test/ReplayData/Hook.testTest.txt rename to github/tests/ReplayData/Hook.testTest.txt diff --git a/test/ReplayData/Issue.setUp.txt b/github/tests/ReplayData/Issue.setUp.txt similarity index 100% rename from test/ReplayData/Issue.setUp.txt rename to github/tests/ReplayData/Issue.setUp.txt diff --git a/test/ReplayData/Issue.testAddAndRemoveLabels.txt b/github/tests/ReplayData/Issue.testAddAndRemoveLabels.txt similarity index 98% rename from test/ReplayData/Issue.testAddAndRemoveLabels.txt rename to github/tests/ReplayData/Issue.testAddAndRemoveLabels.txt index c0e75161..4360d538 100644 --- a/test/ReplayData/Issue.testAddAndRemoveLabels.txt +++ b/github/tests/ReplayData/Issue.testAddAndRemoveLabels.txt @@ -33,7 +33,7 @@ https GET api.github.com None /repos/jacquev6/PyGithub/issues/28/labels {'Author [('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')] [{"url":"https://api.github.com/repos/jacquev6/PyGithub/labels/Project+management","name":"Project management","color":"444444"}] -https POST api.github.com None /repos/jacquev6/PyGithub/issues/28/labels {'Authorization': 'Basic login_and_password_removed'} ["Bug", "Question"] +https POST api.github.com None /repos/jacquev6/PyGithub/issues/28/labels {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} ["Bug", "Question"] 200 [('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')] [{"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"}] diff --git a/test/ReplayData/Issue.testCreateComment.txt b/github/tests/ReplayData/Issue.testCreateComment.txt similarity index 87% rename from test/ReplayData/Issue.testCreateComment.txt rename to github/tests/ReplayData/Issue.testCreateComment.txt index 79aad351..7d78a56d 100644 --- a/test/ReplayData/Issue.testCreateComment.txt +++ b/github/tests/ReplayData/Issue.testCreateComment.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/issues/28/comments {'Authorization': 'Basic login_and_password_removed'} {"body": "Comment created by PyGithub"} +https POST api.github.com None /repos/jacquev6/PyGithub/issues/28/comments {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"body": "Comment created by PyGithub"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4996'), ('content-length', '506'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"08cea7c821f6f3378e38921a9e7bc05e"'), ('date', 'Sun, 20 May 2012 11:46:43 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/issues/comments/5808311')] {"updated_at":"2012-05-20T11:46:42Z","body":"Comment created by PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub/issues/comments/5808311","created_at":"2012-05-20T11:46:42Z","user":{"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","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"id":5808311} diff --git a/test/ReplayData/Issue.testDeleteAndSetLabels.txt b/github/tests/ReplayData/Issue.testDeleteAndSetLabels.txt similarity index 97% rename from test/ReplayData/Issue.testDeleteAndSetLabels.txt rename to github/tests/ReplayData/Issue.testDeleteAndSetLabels.txt index 5468e70d..c4365074 100644 --- a/test/ReplayData/Issue.testDeleteAndSetLabels.txt +++ b/github/tests/ReplayData/Issue.testDeleteAndSetLabels.txt @@ -23,7 +23,7 @@ https GET api.github.com None /repos/jacquev6/PyGithub/issues/28/labels {'Author [('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')] [] -https PUT api.github.com None /repos/jacquev6/PyGithub/issues/28/labels {'Authorization': 'Basic login_and_password_removed'} ["Bug", "Question"] +https PUT api.github.com None /repos/jacquev6/PyGithub/issues/28/labels {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} ["Bug", "Question"] 200 [('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')] [{"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"}] diff --git a/test/ReplayData/Issue.testEditResetAssignee.txt b/github/tests/ReplayData/Issue.testEditResetAssignee.txt similarity index 95% rename from test/ReplayData/Issue.testEditResetAssignee.txt rename to github/tests/ReplayData/Issue.testEditResetAssignee.txt index 55566f70..3ca0a070 100644 --- a/test/ReplayData/Issue.testEditResetAssignee.txt +++ b/github/tests/ReplayData/Issue.testEditResetAssignee.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /repos/jacquev6/PyGithub/issues/28 {'Authorization': 'Basic login_and_password_removed'} {"assignee": ""} +https PATCH api.github.com None /repos/jacquev6/PyGithub/issues/28 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"assignee": ""} 200 [('status', '200 OK'), ('content-length', '1853'), ('x-ratelimit-limit', '5000'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-remaining', '4980'), ('server', 'nginx'), ('connection', 'keep-alive'), ('etag', '"6947b498e9fd9f792130d6c80982b949"'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Tue, 11 Sep 2012 18:47:24 GMT'), ('x-github-media-type', 'github.beta; format=json'), ('content-type', 'application/json; charset=utf-8')] {"body":"Body edited by PyGithub","closed_at":"2012-05-26T14:59:33Z","milestone":{"due_on":"2012-03-13T07:00:00Z","description":"","created_at":"2012-03-08T12:22:10Z","closed_issues":3,"title":"Version 0.4","open_issues":0,"state":"closed","creator":{"login":"jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","url":"https://api.github.com/users/jacquev6","id":327146},"number":1,"url":"https://api.github.com/repos/jacquev6/PyGithub/milestones/1","id":93546},"labels":[{"color":"e10c02","name":"Bug","url":"https://api.github.com/repos/jacquev6/PyGithub/labels/Bug"},{"color":"02e10c","name":"Question","url":"https://api.github.com/repos/jacquev6/PyGithub/labels/Question"}],"user":{"login":"jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","url":"https://api.github.com/users/jacquev6","id":327146},"pull_request":{"html_url":null,"patch_url":null,"diff_url":null},"created_at":"2012-05-19T10:38:23Z","comments":0,"closed_by":{"login":"jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","url":"https://api.github.com/users/jacquev6","id":327146},"title":"Issue created by PyGithub","html_url":"https://github.com/jacquev6/PyGithub/issues/28","assignee":null,"state":"closed","number":28,"updated_at":"2012-09-11T18:47:24Z","url":"https://api.github.com/repos/jacquev6/PyGithub/issues/28","id":4653757} diff --git a/test/ReplayData/Issue.testEditResetMilestone.txt b/github/tests/ReplayData/Issue.testEditResetMilestone.txt similarity index 94% rename from test/ReplayData/Issue.testEditResetMilestone.txt rename to github/tests/ReplayData/Issue.testEditResetMilestone.txt index d6db72bf..a3f07035 100644 --- a/test/ReplayData/Issue.testEditResetMilestone.txt +++ b/github/tests/ReplayData/Issue.testEditResetMilestone.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /repos/jacquev6/PyGithub/issues/28 {'Authorization': 'Basic login_and_password_removed'} {"milestone": ""} +https PATCH api.github.com None /repos/jacquev6/PyGithub/issues/28 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"milestone": ""} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4976'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-limit', '5000'), ('content-length', '1296'), ('server', 'nginx'), ('connection', 'keep-alive'), ('etag', '"71423b9f379e4978b85005a6dc6820ed"'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Tue, 11 Sep 2012 18:48:34 GMT'), ('content-type', 'application/json; charset=utf-8')] {"body":"Body edited by PyGithub","closed_at":"2012-05-26T14:59:33Z","milestone":null,"labels":[{"color":"e10c02","name":"Bug","url":"https://api.github.com/repos/jacquev6/PyGithub/labels/Bug"},{"color":"02e10c","name":"Question","url":"https://api.github.com/repos/jacquev6/PyGithub/labels/Question"}],"user":{"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","login":"jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","url":"https://api.github.com/users/jacquev6","id":327146},"pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"created_at":"2012-05-19T10:38:23Z","comments":0,"closed_by":{"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","login":"jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","url":"https://api.github.com/users/jacquev6","id":327146},"title":"Issue created by PyGithub","assignee":null,"state":"closed","number":28,"html_url":"https://github.com/jacquev6/PyGithub/issues/28","updated_at":"2012-09-11T18:48:34Z","url":"https://api.github.com/repos/jacquev6/PyGithub/issues/28","id":4653757} diff --git a/test/ReplayData/Issue.testEditWithAllParameters.txt b/github/tests/ReplayData/Issue.testEditWithAllParameters.txt similarity index 95% rename from test/ReplayData/Issue.testEditWithAllParameters.txt rename to github/tests/ReplayData/Issue.testEditWithAllParameters.txt index 1eec03f5..1409f5c1 100644 --- a/test/ReplayData/Issue.testEditWithAllParameters.txt +++ b/github/tests/ReplayData/Issue.testEditWithAllParameters.txt @@ -8,7 +8,7 @@ https GET api.github.com None /repos/jacquev6/PyGithub/milestones/2 {'Authorizat [('status', '200 OK'), ('x-ratelimit-remaining', '4996'), ('content-length', '899'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"3a7652875cbbfe2a93b7307ab7a3deac"'), ('date', 'Fri, 01 Jun 2012 18:53:25 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"},"closed_issues":13,"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","due_on":"2012-06-04T07:00:00Z","open_issues":6,"number":2,"id":93547} -https PATCH api.github.com None /repos/jacquev6/PyGithub/issues/28 {'Authorization': 'Basic login_and_password_removed'} {"body": "Body edited by PyGithub", "title": "Title edited by PyGithub", "labels": ["Bug"], "assignee": "jacquev6", "state": "open", "milestone": 2} +https PATCH api.github.com None /repos/jacquev6/PyGithub/issues/28 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"body": "Body edited by PyGithub", "title": "Title edited by PyGithub", "labels": ["Bug"], "assignee": "jacquev6", "state": "open", "milestone": 2} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4992'), ('content-length', '2034'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"98bbbf2b2187bf5cdd9aead53ecc2b97"'), ('date', 'Sat, 19 May 2012 10:42:26 GMT'), ('content-type', 'application/json; charset=utf-8')] {"assignee":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","id":327146},"updated_at":"2012-05-19T10:42:25Z","body":"Body edited by PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub/issues/28","comments":0,"number":28,"title":"Title edited by PyGithub","pull_request":{"diff_url":null,"patch_url":null,"html_url":null},"closed_at":null,"labels":[{"url":"https://api.github.com/repos/jacquev6/PyGithub/labels/Bug","name":"Bug","color":"e10c02"}],"closed_by":null,"html_url":"https://github.com/jacquev6/PyGithub/issues/28","created_at":"2012-05-19T10:38:23Z","state":"open","user":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","id":327146},"id":4653757,"milestone":{"url":"https://api.github.com/repos/jacquev6/PyGithub/milestones/2","due_on":null,"closed_issues":1,"creator":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","id":327146},"number":2,"open_issues":11,"title":"Version 1.0: coherent public interface","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}} diff --git a/test/ReplayData/Issue.testEditWithoutParameters.txt b/github/tests/ReplayData/Issue.testEditWithoutParameters.txt similarity index 92% rename from test/ReplayData/Issue.testEditWithoutParameters.txt rename to github/tests/ReplayData/Issue.testEditWithoutParameters.txt index 046a536c..bc00ef8e 100644 --- a/test/ReplayData/Issue.testEditWithoutParameters.txt +++ b/github/tests/ReplayData/Issue.testEditWithoutParameters.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /repos/jacquev6/PyGithub/issues/28 {'Authorization': 'Basic login_and_password_removed'} {} +https PATCH api.github.com None /repos/jacquev6/PyGithub/issues/28 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4996'), ('content-length', '748'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"771af112ee4f9ad5858f5c9b5141b319"'), ('date', 'Sat, 19 May 2012 10:41:03 GMT'), ('content-type', 'application/json; charset=utf-8')] {"assignee":null,"updated_at":"2012-05-19T10:38:23Z","body":null,"url":"https://api.github.com/repos/jacquev6/PyGithub/issues/28","comments":0,"number":28,"title":"Issue created by PyGithub","pull_request":{"patch_url":null,"diff_url":null,"html_url":null},"closed_at":null,"labels":[],"closed_by":null,"html_url":"https://github.com/jacquev6/PyGithub/issues/28","created_at":"2012-05-19T10:38:23Z","state":"open","user":{"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","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"id":4653757,"milestone":null} diff --git a/test/ReplayData/Issue.testGetComments.txt b/github/tests/ReplayData/Issue.testGetComments.txt similarity index 100% rename from test/ReplayData/Issue.testGetComments.txt rename to github/tests/ReplayData/Issue.testGetComments.txt diff --git a/test/ReplayData/Issue.testGetEvents.txt b/github/tests/ReplayData/Issue.testGetEvents.txt similarity index 100% rename from test/ReplayData/Issue.testGetEvents.txt rename to github/tests/ReplayData/Issue.testGetEvents.txt diff --git a/test/ReplayData/Issue.testGetLabels.txt b/github/tests/ReplayData/Issue.testGetLabels.txt similarity index 100% rename from test/ReplayData/Issue.testGetLabels.txt rename to github/tests/ReplayData/Issue.testGetLabels.txt diff --git a/test/ReplayData/Issue33.setUp.txt b/github/tests/ReplayData/Issue33.setUp.txt similarity index 100% rename from test/ReplayData/Issue33.setUp.txt rename to github/tests/ReplayData/Issue33.setUp.txt diff --git a/test/ReplayData/Issue33.testClosedIssues.txt b/github/tests/ReplayData/Issue33.testClosedIssues.txt similarity index 100% rename from test/ReplayData/Issue33.testClosedIssues.txt rename to github/tests/ReplayData/Issue33.testClosedIssues.txt diff --git a/test/ReplayData/Issue33.testOpenIssues.txt b/github/tests/ReplayData/Issue33.testOpenIssues.txt similarity index 100% rename from test/ReplayData/Issue33.testOpenIssues.txt rename to github/tests/ReplayData/Issue33.testOpenIssues.txt diff --git a/test/ReplayData/Issue50.setUp.txt b/github/tests/ReplayData/Issue50.setUp.txt similarity index 100% rename from test/ReplayData/Issue50.setUp.txt rename to github/tests/ReplayData/Issue50.setUp.txt diff --git a/test/ReplayData/Issue50.testAddLabelToIssue.txt b/github/tests/ReplayData/Issue50.testAddLabelToIssue.txt similarity index 91% rename from test/ReplayData/Issue50.testAddLabelToIssue.txt rename to github/tests/ReplayData/Issue50.testAddLabelToIssue.txt index b7e329d5..4841e774 100644 --- a/test/ReplayData/Issue50.testAddLabelToIssue.txt +++ b/github/tests/ReplayData/Issue50.testAddLabelToIssue.txt @@ -3,7 +3,7 @@ https GET api.github.com None /repos/jacquev6/PyGithub/labels/Label%20with%20spa [('status', '200 OK'), ('content-length', '197'), ('x-ratelimit-limit', '5000'), ('vary', 'Accept, Authorization, Cookie'), ('x-ratelimit-remaining', '4918'), ('server', 'nginx/1.0.13'), ('last-modified', 'Thu, 28 Jun 2012 19:29:52 GMT'), ('connection', 'keep-alive'), ('etag', '"c536d81e7479c8c9acfa7deeddeb6e72"'), ('cache-control', 'private, max-age=60'), ('date', 'Thu, 28 Jun 2012 19:54:44 GMT'), ('content-type', 'application/json; charset=utf-8')] {"color":"ffff00","name":"Label with spaces and strange characters (&*#$)","url":"https://api.github.com/repos/jacquev6/PyGithub/labels/Label+with+spaces+and+strange+characters+%28%26%2A%23%24%29"} -https POST api.github.com None /repos/jacquev6/PyGithub/issues/50/labels {'Authorization': 'Basic login_and_password_removed'} ["Label with spaces and strange characters (&*#$)"] +https POST api.github.com None /repos/jacquev6/PyGithub/issues/50/labels {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} ["Label with spaces and strange characters (&*#$)"] 200 [('status', '200 OK'), ('content-length', '419'), ('x-ratelimit-limit', '5000'), ('x-ratelimit-remaining', '4917'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('etag', '"e1d0a1c54608a676af0cdc1f63e04da7"'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Thu, 28 Jun 2012 19:54:44 GMT'), ('content-type', 'application/json; charset=utf-8')] [{"color":"e10c02","name":"Bug","url":"https://api.github.com/repos/jacquev6/PyGithub/labels/Bug"},{"color":"ffff00","name":"Label with spaces and strange characters (&*#$)","url":"https://api.github.com/repos/jacquev6/PyGithub/labels/Label+with+spaces+and+strange+characters+%28%26%2A%23%24%29"},{"color":"e10c02","name":"RequestedByUser","url":"https://api.github.com/repos/jacquev6/PyGithub/labels/RequestedByUser"}] diff --git a/test/ReplayData/Issue50.testCreateIssueWithLabel.txt b/github/tests/ReplayData/Issue50.testCreateIssueWithLabel.txt similarity index 91% rename from test/ReplayData/Issue50.testCreateIssueWithLabel.txt rename to github/tests/ReplayData/Issue50.testCreateIssueWithLabel.txt index a7d404b9..d41d7171 100644 --- a/test/ReplayData/Issue50.testCreateIssueWithLabel.txt +++ b/github/tests/ReplayData/Issue50.testCreateIssueWithLabel.txt @@ -3,7 +3,7 @@ https GET api.github.com None /repos/jacquev6/PyGithub/labels/Label%20with%20spa [('status', '200 OK'), ('content-length', '197'), ('x-ratelimit-limit', '5000'), ('vary', 'Accept, Authorization, Cookie'), ('x-ratelimit-remaining', '4908'), ('server', 'nginx/1.0.13'), ('last-modified', 'Thu, 28 Jun 2012 19:29:52 GMT'), ('connection', 'keep-alive'), ('etag', '"c536d81e7479c8c9acfa7deeddeb6e72"'), ('cache-control', 'private, max-age=60'), ('date', 'Thu, 28 Jun 2012 19:56:20 GMT'), ('content-type', 'application/json; charset=utf-8')] {"color":"ffff00","name":"Label with spaces and strange characters (&*#$)","url":"https://api.github.com/repos/jacquev6/PyGithub/labels/Label+with+spaces+and+strange+characters+%28%26%2A%23%24%29"} -https POST api.github.com None /repos/jacquev6/PyGithub/issues {'Authorization': 'Basic login_and_password_removed'} {"labels": ["Label with spaces and strange characters (&*#$)"], "title": "Issue created by PyGithub to test issue #50"} +https POST api.github.com None /repos/jacquev6/PyGithub/issues {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"labels": ["Label with spaces and strange characters (&*#$)"], "title": "Issue created by PyGithub to test issue #50"} 201 [('status', '201 Created'), ('content-length', '963'), ('x-ratelimit-limit', '5000'), ('x-ratelimit-remaining', '4907'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('etag', '"e1e5db9ef97e084a3d36ede8dc41c0d9"'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/issues/52'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Thu, 28 Jun 2012 19:56:21 GMT'), ('content-type', 'application/json; charset=utf-8')] {"labels":[{"color":"ffff00","name":"Label with spaces and strange characters (&*#$)","url":"https://api.github.com/repos/jacquev6/PyGithub/labels/Label+with+spaces+and+strange+characters+%28%26%2A%23%24%29"}],"body":null,"state":"open","closed_at":null,"assignee":null,"comments":0,"title":"Issue created by PyGithub to test issue #50","created_at":"2012-06-28T19:56:21Z","number":52,"milestone":null,"html_url":"https://github.com/jacquev6/PyGithub/issues/52","url":"https://api.github.com/repos/jacquev6/PyGithub/issues/52","closed_by":null,"user":{"login":"jacquev6","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","id":327146},"id":5330629,"pull_request":{"diff_url":null,"patch_url":null,"html_url":null},"updated_at":"2012-06-28T19:56:21Z"} diff --git a/test/ReplayData/Issue50.testCreateLabel.txt b/github/tests/ReplayData/Issue50.testCreateLabel.txt similarity index 82% rename from test/ReplayData/Issue50.testCreateLabel.txt rename to github/tests/ReplayData/Issue50.testCreateLabel.txt index 5372bd48..75ecf7e3 100644 --- a/test/ReplayData/Issue50.testCreateLabel.txt +++ b/github/tests/ReplayData/Issue50.testCreateLabel.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/labels {'Authorization': 'Basic login_and_password_removed'} {"color": "ffff00", "name": "Label with spaces and strange characters (&*#$)"} +https POST api.github.com None /repos/jacquev6/PyGithub/labels {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"color": "ffff00", "name": "Label with spaces and strange characters (&*#$)"} 201 [('status', '201 Created'), ('content-length', '197'), ('etag', '"99cbb3bf0f7ee7d6278c2ddd3ef42577"'), ('x-ratelimit-remaining', '4968'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/labels/Label+with+spaces+and+strange+characters+%28%26%2A%23%24%29'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Thu, 28 Jun 2012 19:29:52 GMT'), ('content-type', 'application/json; charset=utf-8')] {"color":"ffff00","name":"Label with spaces and strange characters (&*#$)","url":"https://api.github.com/repos/jacquev6/PyGithub/labels/Label+with+spaces+and+strange+characters+%28%26%2A%23%24%29"} diff --git a/test/ReplayData/Issue50.testGetIssuesWithLabel.txt b/github/tests/ReplayData/Issue50.testGetIssuesWithLabel.txt similarity index 100% rename from test/ReplayData/Issue50.testGetIssuesWithLabel.txt rename to github/tests/ReplayData/Issue50.testGetIssuesWithLabel.txt diff --git a/test/ReplayData/Issue50.testGetLabel.txt b/github/tests/ReplayData/Issue50.testGetLabel.txt similarity index 100% rename from test/ReplayData/Issue50.testGetLabel.txt rename to github/tests/ReplayData/Issue50.testGetLabel.txt diff --git a/test/ReplayData/Issue50.testGetLabels.txt b/github/tests/ReplayData/Issue50.testGetLabels.txt similarity index 100% rename from test/ReplayData/Issue50.testGetLabels.txt rename to github/tests/ReplayData/Issue50.testGetLabels.txt diff --git a/test/ReplayData/Issue50.testIssueGetLabels.txt b/github/tests/ReplayData/Issue50.testIssueGetLabels.txt similarity index 100% rename from test/ReplayData/Issue50.testIssueGetLabels.txt rename to github/tests/ReplayData/Issue50.testIssueGetLabels.txt diff --git a/test/ReplayData/Issue50.testRemoveLabelFromIssue.txt b/github/tests/ReplayData/Issue50.testRemoveLabelFromIssue.txt similarity index 100% rename from test/ReplayData/Issue50.testRemoveLabelFromIssue.txt rename to github/tests/ReplayData/Issue50.testRemoveLabelFromIssue.txt diff --git a/test/ReplayData/Issue50.testSetIssueLabels.txt b/github/tests/ReplayData/Issue50.testSetIssueLabels.txt similarity index 94% rename from test/ReplayData/Issue50.testSetIssueLabels.txt rename to github/tests/ReplayData/Issue50.testSetIssueLabels.txt index 4951cf68..28902a6f 100644 --- a/test/ReplayData/Issue50.testSetIssueLabels.txt +++ b/github/tests/ReplayData/Issue50.testSetIssueLabels.txt @@ -13,7 +13,7 @@ https GET api.github.com None /repos/jacquev6/PyGithub/labels/Label%20with%20spa [('status', '200 OK'), ('x-ratelimit-remaining', '4887'), ('x-ratelimit-limit', '5000'), ('vary', 'Accept, Authorization, Cookie'), ('content-length', '197'), ('server', 'nginx/1.0.13'), ('last-modified', 'Thu, 28 Jun 2012 19:29:52 GMT'), ('connection', 'keep-alive'), ('etag', '"c536d81e7479c8c9acfa7deeddeb6e72"'), ('cache-control', 'private, max-age=60'), ('date', 'Thu, 28 Jun 2012 20:04:07 GMT'), ('content-type', 'application/json; charset=utf-8')] {"color":"ffff00","name":"Label with spaces and strange characters (&*#$)","url":"https://api.github.com/repos/jacquev6/PyGithub/labels/Label+with+spaces+and+strange+characters+%28%26%2A%23%24%29"} -https PUT api.github.com None /repos/jacquev6/PyGithub/issues/50/labels {'Authorization': 'Basic login_and_password_removed'} ["Bug", "RequestedByUser", "Label with spaces and strange characters (&*#$)"] +https PUT api.github.com None /repos/jacquev6/PyGithub/issues/50/labels {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} ["Bug", "RequestedByUser", "Label with spaces and strange characters (&*#$)"] 200 [('status', '200 OK'), ('content-length', '419'), ('x-ratelimit-limit', '5000'), ('x-ratelimit-remaining', '4886'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('etag', '"e1d0a1c54608a676af0cdc1f63e04da7"'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Thu, 28 Jun 2012 20:04:08 GMT'), ('content-type', 'application/json; charset=utf-8')] [{"color":"e10c02","name":"Bug","url":"https://api.github.com/repos/jacquev6/PyGithub/labels/Bug"},{"color":"ffff00","name":"Label with spaces and strange characters (&*#$)","url":"https://api.github.com/repos/jacquev6/PyGithub/labels/Label+with+spaces+and+strange+characters+%28%26%2A%23%24%29"},{"color":"e10c02","name":"RequestedByUser","url":"https://api.github.com/repos/jacquev6/PyGithub/labels/RequestedByUser"}] diff --git a/test/ReplayData/Issue54.setUp.txt b/github/tests/ReplayData/Issue54.setUp.txt similarity index 100% rename from test/ReplayData/Issue54.setUp.txt rename to github/tests/ReplayData/Issue54.setUp.txt diff --git a/test/ReplayData/Issue54.testConversion.txt b/github/tests/ReplayData/Issue54.testConversion.txt similarity index 100% rename from test/ReplayData/Issue54.testConversion.txt rename to github/tests/ReplayData/Issue54.testConversion.txt diff --git a/test/ReplayData/Issue80.testIgnoreHttpsFromGithubEnterprise.txt b/github/tests/ReplayData/Issue80.testIgnoreHttpsFromGithubEnterprise.txt similarity index 100% rename from test/ReplayData/Issue80.testIgnoreHttpsFromGithubEnterprise.txt rename to github/tests/ReplayData/Issue80.testIgnoreHttpsFromGithubEnterprise.txt diff --git a/test/ReplayData/Issue80.testIgnoreHttpsFromGithubEnterpriseWithPort.txt b/github/tests/ReplayData/Issue80.testIgnoreHttpsFromGithubEnterpriseWithPort.txt similarity index 100% rename from test/ReplayData/Issue80.testIgnoreHttpsFromGithubEnterpriseWithPort.txt rename to github/tests/ReplayData/Issue80.testIgnoreHttpsFromGithubEnterpriseWithPort.txt diff --git a/github/tests/ReplayData/Issue87.setUp.txt b/github/tests/ReplayData/Issue87.setUp.txt new file mode 100644 index 00000000..f7c35ef7 --- /dev/null +++ b/github/tests/ReplayData/Issue87.setUp.txt @@ -0,0 +1,10 @@ +https GET api.github.com None /user {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('content-length', '806'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('vary', 'Accept, Authorization, Cookie'), ('x-ratelimit-remaining', '4703'), ('server', 'nginx'), ('last-modified', 'Tue, 25 Sep 2012 07:42:42 GMT'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"e199a6b2e012ed6ffb1e6a935f4ba856"'), ('cache-control', 'private, s-maxage=60, max-age=60'), ('date', 'Tue, 25 Sep 2012 19:50:45 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"type":"User","blog":"http://vincent-jacques.net","public_gists":3,"html_url":"https://github.com/jacquev6","login":"jacquev6","followers":14,"company":"Criteo","hireable":false,"private_gists":5,"plan":{"space":614400,"private_repos":5,"name":"micro","collaborators":1},"created_at":"2010-07-09T06:10:06Z","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","email":"vincent@vincent-jacques.net","bio":"","disk_usage":18788,"public_repos":13,"total_private_repos":4,"following":29,"name":"Vincent Jacques","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","owned_private_repos":4,"collaborators":1,"id":327146,"location":"Paris, France","url":"https://api.github.com/users/jacquev6"} + +https GET api.github.com None /repos/jacquev6/PyGithub {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('content-length', '1238'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('vary', 'Accept, Authorization, Cookie'), ('x-ratelimit-remaining', '4702'), ('server', 'nginx'), ('last-modified', 'Mon, 24 Sep 2012 18:51:20 GMT'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"d0aaa41da0d7452a0dad489a3a4fcd35"'), ('cache-control', 'private, s-maxage=60, max-age=60'), ('date', 'Tue, 25 Sep 2012 19:50:46 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"open_issues":16,"mirror_url":null,"has_issues":true,"language":"Python","homepage":"http://vincent-jacques.net/PyGithub","owner":{"login":"jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146,"url":"https://api.github.com/users/jacquev6"},"html_url":"https://github.com/jacquev6/PyGithub","master_branch":"master","description":"Python library implementing the full Github API v3","forks_count":20,"has_downloads":true,"created_at":"2012-02-25T12:53:47Z","svn_url":"https://github.com/jacquev6/PyGithub","git_url":"git://github.com/jacquev6/PyGithub.git","network_count":20,"watchers_count":79,"size":408,"fork":false,"ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-09-17T19:28:28Z","forks":20,"has_wiki":true,"name":"PyGithub","permissions":{"pull":true,"admin":true,"push":true},"watchers":79,"open_issues_count":16,"clone_url":"https://github.com/jacquev6/PyGithub.git","private":false,"updated_at":"2012-09-24T18:51:20Z","full_name":"jacquev6/PyGithub","id":3544490,"url":"https://api.github.com/repos/jacquev6/PyGithub"} + diff --git a/github/tests/ReplayData/Issue87.testCreateIssueWithEscapedPercentInBody.txt b/github/tests/ReplayData/Issue87.testCreateIssueWithEscapedPercentInBody.txt new file mode 100644 index 00000000..e3867a23 --- /dev/null +++ b/github/tests/ReplayData/Issue87.testCreateIssueWithEscapedPercentInBody.txt @@ -0,0 +1,5 @@ +https POST api.github.com None /repos/jacquev6/PyGithub/issues {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"body": "Escaped percent %25 in body", "title": "Issue created by PyGithub"} +201 +[('status', '201 Created'), ('content-length', '778'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('etag', '"5b11ec85aeed655554b5e7b977975ea0"'), ('x-ratelimit-remaining', '4710'), ('server', 'nginx'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/issues/96'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Tue, 25 Sep 2012 19:50:41 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"closed_by":null,"created_at":"2012-09-25T19:50:41Z","comments":0,"title":"Issue created by PyGithub","state":"open","assignee":null,"number":96,"updated_at":"2012-09-25T19:50:41Z","html_url":"https://github.com/jacquev6/PyGithub/issues/96","milestone":null,"body":"Escaped percent %25 in body","labels":[],"user":{"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","id":327146,"login":"jacquev6","url":"https://api.github.com/users/jacquev6"},"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"closed_at":null,"id":7132212,"url":"https://api.github.com/repos/jacquev6/PyGithub/issues/96"} + diff --git a/github/tests/ReplayData/Issue87.testCreateIssueWithEscapedPercentInTitle.txt b/github/tests/ReplayData/Issue87.testCreateIssueWithEscapedPercentInTitle.txt new file mode 100644 index 00000000..4dc0eae7 --- /dev/null +++ b/github/tests/ReplayData/Issue87.testCreateIssueWithEscapedPercentInTitle.txt @@ -0,0 +1,5 @@ +https POST api.github.com None /repos/jacquev6/PyGithub/issues {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"title": "Issue with escaped percent %25 in title created by PyGithub"} +201 +[('status', '201 Created'), ('x-ratelimit-remaining', '4707'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('etag', '"50db679c69dac05fd00490516c95521a"'), ('content-length', '787'), ('server', 'nginx'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/issues/97'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Tue, 25 Sep 2012 19:50:43 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"body":null,"assignee":null,"labels":[],"user":{"login":"jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146,"url":"https://api.github.com/users/jacquev6"},"html_url":"https://github.com/jacquev6/PyGithub/issues/97","milestone":null,"created_at":"2012-09-25T19:50:43Z","comments":0,"title":"Issue with escaped percent %25 in title created by PyGithub","pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"closed_at":null,"state":"open","closed_by":null,"number":97,"updated_at":"2012-09-25T19:50:43Z","id":7132216,"url":"https://api.github.com/repos/jacquev6/PyGithub/issues/97"} + diff --git a/github/tests/ReplayData/Issue87.testCreateIssueWithPercentInBody.txt b/github/tests/ReplayData/Issue87.testCreateIssueWithPercentInBody.txt new file mode 100644 index 00000000..06d9b8fb --- /dev/null +++ b/github/tests/ReplayData/Issue87.testCreateIssueWithPercentInBody.txt @@ -0,0 +1,5 @@ +https POST api.github.com None /repos/jacquev6/PyGithub/issues {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"body": "Percent % in body", "title": "Issue created by PyGithub"} +201 +[('status', '201 Created'), ('content-length', '768'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-remaining', '4704'), ('server', 'nginx'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/issues/98'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Tue, 25 Sep 2012 19:50:45 GMT'), ('etag', '"41fe20e6fee4a38d4b11589129459e15"'), ('content-type', 'application/json; charset=utf-8')] +{"body":"Percent % in body","assignee":null,"labels":[],"user":{"login":"jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146,"url":"https://api.github.com/users/jacquev6"},"html_url":"https://github.com/jacquev6/PyGithub/issues/98","milestone":null,"created_at":"2012-09-25T19:50:45Z","comments":0,"title":"Issue created by PyGithub","pull_request":{"html_url":null,"diff_url":null,"patch_url":null},"closed_at":null,"state":"open","closed_by":null,"number":98,"updated_at":"2012-09-25T19:50:45Z","id":7132217,"url":"https://api.github.com/repos/jacquev6/PyGithub/issues/98"} + diff --git a/github/tests/ReplayData/Issue87.testCreateIssueWithPercentInTitle.txt b/github/tests/ReplayData/Issue87.testCreateIssueWithPercentInTitle.txt new file mode 100644 index 00000000..8a56d50e --- /dev/null +++ b/github/tests/ReplayData/Issue87.testCreateIssueWithPercentInTitle.txt @@ -0,0 +1,5 @@ +https POST api.github.com None /repos/jacquev6/PyGithub/issues {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"title": "Issue with percent % in title created by PyGithub"} +201 +[('status', '201 Created'), ('x-ratelimit-remaining', '4701'), ('x-ratelimit-limit', '5000'), ('x-content-type-options', 'nosniff'), ('content-length', '777'), ('server', 'nginx'), ('connection', 'keep-alive'), ('etag', '"4f8b2cd3aecb26240538f54c3e4ff8f6"'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/issues/99'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Tue, 25 Sep 2012 19:50:46 GMT'), ('x-github-media-type', 'github.beta; format=json'), ('content-type', 'application/json; charset=utf-8')] +{"body":null,"assignee":null,"labels":[],"user":{"login":"jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146,"url":"https://api.github.com/users/jacquev6"},"closed_at":null,"milestone":null,"created_at":"2012-09-25T19:50:46Z","comments":0,"closed_by":null,"title":"Issue with percent % in title created by PyGithub","pull_request":{"patch_url":null,"diff_url":null,"html_url":null},"state":"open","number":99,"updated_at":"2012-09-25T19:50:46Z","id":7132221,"html_url":"https://github.com/jacquev6/PyGithub/issues/99","url":"https://api.github.com/repos/jacquev6/PyGithub/issues/99"} + diff --git a/test/ReplayData/IssueComment.setUp.txt b/github/tests/ReplayData/IssueComment.setUp.txt similarity index 100% rename from test/ReplayData/IssueComment.setUp.txt rename to github/tests/ReplayData/IssueComment.setUp.txt diff --git a/test/ReplayData/IssueComment.testDelete.txt b/github/tests/ReplayData/IssueComment.testDelete.txt similarity index 100% rename from test/ReplayData/IssueComment.testDelete.txt rename to github/tests/ReplayData/IssueComment.testDelete.txt diff --git a/test/ReplayData/IssueComment.testEdit.txt b/github/tests/ReplayData/IssueComment.testEdit.txt similarity index 85% rename from test/ReplayData/IssueComment.testEdit.txt rename to github/tests/ReplayData/IssueComment.testEdit.txt index 5d8b4785..fcfe6a13 100644 --- a/test/ReplayData/IssueComment.testEdit.txt +++ b/github/tests/ReplayData/IssueComment.testEdit.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /repos/jacquev6/PyGithub/issues/comments/5808311 {'Authorization': 'Basic login_and_password_removed'} {"body": "Comment edited by PyGithub"} +https PATCH api.github.com None /repos/jacquev6/PyGithub/issues/comments/5808311 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"body": "Comment edited by PyGithub"} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4980'), ('content-length', '505'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"1599061186ef7ca2dbf5bdee1711746a"'), ('date', 'Sun, 20 May 2012 11:53:59 GMT'), ('content-type', 'application/json; charset=utf-8')] {"updated_at":"2012-05-20T11:53:59Z","body":"Comment edited by PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub/issues/comments/5808311","created_at":"2012-05-20T11:46:42Z","user":{"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","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"id":5808311} diff --git a/test/ReplayData/IssueEvent.setUp.txt b/github/tests/ReplayData/IssueEvent.setUp.txt similarity index 100% rename from test/ReplayData/IssueEvent.setUp.txt rename to github/tests/ReplayData/IssueEvent.setUp.txt diff --git a/test/ReplayData/IssueEvent.testAttributes.txt b/github/tests/ReplayData/IssueEvent.testAttributes.txt similarity index 100% rename from test/ReplayData/IssueEvent.testAttributes.txt rename to github/tests/ReplayData/IssueEvent.testAttributes.txt diff --git a/test/ReplayData/Label.setUp.txt b/github/tests/ReplayData/Label.setUp.txt similarity index 100% rename from test/ReplayData/Label.setUp.txt rename to github/tests/ReplayData/Label.setUp.txt diff --git a/test/ReplayData/Label.testDelete.txt b/github/tests/ReplayData/Label.testDelete.txt similarity index 100% rename from test/ReplayData/Label.testDelete.txt rename to github/tests/ReplayData/Label.testDelete.txt diff --git a/test/ReplayData/Label.testEdit.txt b/github/tests/ReplayData/Label.testEdit.txt similarity index 77% rename from test/ReplayData/Label.testEdit.txt rename to github/tests/ReplayData/Label.testEdit.txt index 0275ae11..2de51a02 100644 --- a/test/ReplayData/Label.testEdit.txt +++ b/github/tests/ReplayData/Label.testEdit.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /repos/jacquev6/PyGithub/labels/Bug {'Authorization': 'Basic login_and_password_removed'} {"color": "0000ff", "name": "LabelEditedByPyGithub"} +https PATCH api.github.com None /repos/jacquev6/PyGithub/labels/Bug {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"color": "0000ff", "name": "LabelEditedByPyGithub"} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4965'), ('content-length', '133'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"57435796bd4f14b84ad92105669cfab1"'), ('date', 'Sat, 19 May 2012 10:17:44 GMT'), ('content-type', 'application/json; charset=utf-8')] {"url":"https://api.github.com/repos/jacquev6/PyGithub/labels/LabelEditedByPyGithub","name":"LabelEditedByPyGithub","color":"0000ff"} diff --git a/github/tests/ReplayData/Logging.testLoggingWithBaseUrl.txt b/github/tests/ReplayData/Logging.testLoggingWithBaseUrl.txt new file mode 100644 index 00000000..863d0aad --- /dev/null +++ b/github/tests/ReplayData/Logging.testLoggingWithBaseUrl.txt @@ -0,0 +1,5 @@ +http GET my.enterprise.com None /my/prefix/users/jacquev6 {} null +200 +[('status', '200 OK'), ('content-length', '628'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-limit', '5000'), ('vary', 'Accept'), ('x-ratelimit-remaining', '4989'), ('server', 'nginx'), ('last-modified', 'Tue, 25 Sep 2012 07:42:42 GMT'), ('connection', 'keep-alive'), ('etag', '"9bd085221a16b6d2ea95e72634c3c1ac"'), ('cache-control', 'public, max-age=60, s-maxage=60'), ('date', 'Tue, 25 Sep 2012 20:38:56 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"type":"User","html_url":"https://github.com/jacquev6","login":"jacquev6","followers":14,"company":"Criteo","created_at":"2010-07-09T06:10:06Z","email":"vincent@vincent-jacques.net","hireable":false,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","public_gists":3,"bio":"","following":29,"name":"Vincent Jacques","blog":"http://vincent-jacques.net","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146,"public_repos":13,"location":"Paris, France","url":"https://api.github.com/users/jacquev6"} + diff --git a/github/tests/ReplayData/Logging.testLoggingWithBasicAuthentication.txt b/github/tests/ReplayData/Logging.testLoggingWithBasicAuthentication.txt new file mode 100644 index 00000000..df230319 --- /dev/null +++ b/github/tests/ReplayData/Logging.testLoggingWithBasicAuthentication.txt @@ -0,0 +1,5 @@ +https GET api.github.com None /user {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('content-length', '806'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-limit', '5000'), ('vary', 'Accept, Authorization, Cookie'), ('x-ratelimit-remaining', '4993'), ('server', 'nginx'), ('last-modified', 'Fri, 14 Sep 2012 18:47:46 GMT'), ('connection', 'keep-alive'), ('etag', '"434dfe5d3f50558fe3cea087cb95c401"'), ('cache-control', 'private, s-maxage=60, max-age=60'), ('date', 'Mon, 17 Sep 2012 17:12:32 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"owned_private_repos":3,"disk_usage":18612,"following":28,"type":"User","public_repos":13,"location":"Paris, France","company":"Criteo","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","plan":{"space":614400,"private_repos":5,"name":"micro","collaborators":1},"blog":"http://vincent-jacques.net","login":"jacquev6","public_gists":3,"html_url":"https://github.com/jacquev6","hireable":false,"created_at":"2010-07-09T06:10:06Z","private_gists":5,"followers":13,"name":"Vincent Jacques","email":"vincent@vincent-jacques.net","bio":"","total_private_repos":3,"collaborators":0,"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146,"url":"https://api.github.com/users/jacquev6"} + diff --git a/github/tests/ReplayData/Logging.testLoggingWithOAuthAuthentication.txt b/github/tests/ReplayData/Logging.testLoggingWithOAuthAuthentication.txt new file mode 100644 index 00000000..4a205729 --- /dev/null +++ b/github/tests/ReplayData/Logging.testLoggingWithOAuthAuthentication.txt @@ -0,0 +1,5 @@ +https GET api.github.com None /user {'Authorization': 'token private_token_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4993'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('vary', 'Accept, Authorization, Cookie'), ('content-length', '628'), ('server', 'nginx'), ('last-modified', 'Tue, 25 Sep 2012 07:42:42 GMT'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"c23ad6b5815fc3d6ec6341c4a47afe85"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Tue, 25 Sep 2012 20:36:54 GMT'), ('x-oauth-scopes', ''), ('content-type', 'application/json; charset=utf-8'), ('x-accepted-oauth-scopes', 'user')] +{"type":"User","bio":"","html_url":"https://github.com/jacquev6","login":"jacquev6","followers":14,"company":"Criteo","blog":"http://vincent-jacques.net","public_repos":13,"created_at":"2010-07-09T06:10:06Z","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","email":"vincent@vincent-jacques.net","following":29,"name":"Vincent Jacques","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","hireable":false,"id":327146,"public_gists":3,"location":"Paris, France","url":"https://api.github.com/users/jacquev6"} + diff --git a/github/tests/ReplayData/Logging.testLoggingWithoutAuthentication.txt b/github/tests/ReplayData/Logging.testLoggingWithoutAuthentication.txt new file mode 100644 index 00000000..3d991096 --- /dev/null +++ b/github/tests/ReplayData/Logging.testLoggingWithoutAuthentication.txt @@ -0,0 +1,5 @@ +https GET api.github.com None /users/jacquev6 {} null +200 +[('status', '200 OK'), ('content-length', '628'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-limit', '5000'), ('vary', 'Accept'), ('x-ratelimit-remaining', '4989'), ('server', 'nginx'), ('last-modified', 'Tue, 25 Sep 2012 07:42:42 GMT'), ('connection', 'keep-alive'), ('etag', '"9bd085221a16b6d2ea95e72634c3c1ac"'), ('cache-control', 'public, max-age=60, s-maxage=60'), ('date', 'Tue, 25 Sep 2012 20:38:56 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"type":"User","html_url":"https://github.com/jacquev6","login":"jacquev6","followers":14,"company":"Criteo","created_at":"2010-07-09T06:10:06Z","email":"vincent@vincent-jacques.net","hireable":false,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","public_gists":3,"bio":"","following":29,"name":"Vincent Jacques","blog":"http://vincent-jacques.net","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146,"public_repos":13,"location":"Paris, France","url":"https://api.github.com/users/jacquev6"} + diff --git a/test/ReplayData/Markdown.setUp.txt b/github/tests/ReplayData/Markdown.setUp.txt similarity index 100% rename from test/ReplayData/Markdown.setUp.txt rename to github/tests/ReplayData/Markdown.setUp.txt diff --git a/test/ReplayData/Markdown.testRenderGithubFlavoredMarkdown.txt b/github/tests/ReplayData/Markdown.testRenderGithubFlavoredMarkdown.txt similarity index 70% rename from test/ReplayData/Markdown.testRenderGithubFlavoredMarkdown.txt rename to github/tests/ReplayData/Markdown.testRenderGithubFlavoredMarkdown.txt index 2f84c3f0..a8765f09 100644 --- a/test/ReplayData/Markdown.testRenderGithubFlavoredMarkdown.txt +++ b/github/tests/ReplayData/Markdown.testRenderGithubFlavoredMarkdown.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /markdown {'Authorization': 'Basic login_and_password_removed'} {"text": "MyTitle\n=======\n\nIssue #1", "mode": "gfm", "context": "jacquev6/PyGithub"} +https POST api.github.com None /markdown {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"text": "MyTitle\n=======\n\nIssue #1", "mode": "gfm", "context": "jacquev6/PyGithub"} 200 [('status', '200 OK'), ('content-length', '150'), ('x-ratelimit-remaining', '4988'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"63251bf7dbb58f62c59ae39bb72c7a38"'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Fri, 13 Jul 2012 11:59:58 GMT'), ('content-type', 'text/html;charset=utf-8')]

MyTitle

Issue #1

diff --git a/test/ReplayData/Markdown.testRenderMarkdown.txt b/github/tests/ReplayData/Markdown.testRenderMarkdown.txt similarity index 74% rename from test/ReplayData/Markdown.testRenderMarkdown.txt rename to github/tests/ReplayData/Markdown.testRenderMarkdown.txt index 5f53cde7..9c61b865 100644 --- a/test/ReplayData/Markdown.testRenderMarkdown.txt +++ b/github/tests/ReplayData/Markdown.testRenderMarkdown.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /markdown {'Authorization': 'Basic login_and_password_removed'} {"text": "MyTitle\n=======\n\nIssue #1"} +https POST api.github.com None /markdown {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"text": "MyTitle\n=======\n\nIssue #1"} 200 [('status', '200 OK'), ('content-length', '133'), ('x-ratelimit-remaining', '4985'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"4cb17c0ebe3cc45c1a7f27d4d0850c54"'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Fri, 13 Jul 2012 11:59:59 GMT'), ('content-type', 'text/html;charset=utf-8')]

MyTitle

Issue #1

diff --git a/test/ReplayData/Milestone.setUp.txt b/github/tests/ReplayData/Milestone.setUp.txt similarity index 100% rename from test/ReplayData/Milestone.setUp.txt rename to github/tests/ReplayData/Milestone.setUp.txt diff --git a/test/ReplayData/Milestone.testDelete.txt b/github/tests/ReplayData/Milestone.testDelete.txt similarity index 100% rename from test/ReplayData/Milestone.testDelete.txt rename to github/tests/ReplayData/Milestone.testDelete.txt diff --git a/test/ReplayData/Milestone.testEditWithAllParameters.txt b/github/tests/ReplayData/Milestone.testEditWithAllParameters.txt similarity index 81% rename from test/ReplayData/Milestone.testEditWithAllParameters.txt rename to github/tests/ReplayData/Milestone.testEditWithAllParameters.txt index 31fd1499..f0c5fdfd 100644 --- a/test/ReplayData/Milestone.testEditWithAllParameters.txt +++ b/github/tests/ReplayData/Milestone.testEditWithAllParameters.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /repos/jacquev6/PyGithub/milestones/1 {'Authorization': 'Basic login_and_password_removed'} {"due_on": "2012-06-16", "state": "closed", "description": "Description edited by PyGithub", "title": "Title edited twice by PyGithub"} +https PATCH api.github.com None /repos/jacquev6/PyGithub/milestones/1 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"due_on": "2012-06-16", "state": "closed", "description": "Description edited by PyGithub", "title": "Title edited twice by PyGithub"} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4946'), ('content-length', '606'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"ac9f76c61e1fe0e76cd26e77e59d5797"'), ('date', 'Sat, 19 May 2012 10:30:15 GMT'), ('content-type', 'application/json; charset=utf-8')] {"url":"https://api.github.com/repos/jacquev6/PyGithub/milestones/5","due_on":"2012-06-16T07:00:00Z","creator":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","id":327146},"number":5,"open_issues":0,"title":"Title edited twice by PyGithub","closed_issues":0,"created_at":"2012-05-19T10:24:13Z","state":"closed","description":"Description edited by PyGithub","id":121463} diff --git a/test/ReplayData/Milestone.testEditWithMinimalParameters.txt b/github/tests/ReplayData/Milestone.testEditWithMinimalParameters.txt similarity index 88% rename from test/ReplayData/Milestone.testEditWithMinimalParameters.txt rename to github/tests/ReplayData/Milestone.testEditWithMinimalParameters.txt index 856e5176..410b0574 100644 --- a/test/ReplayData/Milestone.testEditWithMinimalParameters.txt +++ b/github/tests/ReplayData/Milestone.testEditWithMinimalParameters.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /repos/jacquev6/PyGithub/milestones/1 {'Authorization': 'Basic login_and_password_removed'} {"title": "Title edited by PyGithub"} +https PATCH api.github.com None /repos/jacquev6/PyGithub/milestones/1 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"title": "Title edited by PyGithub"} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4954'), ('content-length', '599'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"df00dd4d1183f48c313b9cf04330623b"'), ('date', 'Sat, 19 May 2012 10:29:02 GMT'), ('content-type', 'application/json; charset=utf-8')] {"closed_issues":0,"url":"https://api.github.com/repos/jacquev6/PyGithub/milestones/5","due_on":"2012-06-15T07:00:00Z","creator":{"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","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"number":5,"open_issues":0,"title":"Title edited by PyGithub","created_at":"2012-05-19T10:24:13Z","state":"open","description":"Description created by PyGithub","id":121463} diff --git a/test/ReplayData/Milestone.testGetLabels.txt b/github/tests/ReplayData/Milestone.testGetLabels.txt similarity index 100% rename from test/ReplayData/Milestone.testGetLabels.txt rename to github/tests/ReplayData/Milestone.testGetLabels.txt diff --git a/test/ReplayData/NamedUser.setUp.txt b/github/tests/ReplayData/NamedUser.setUp.txt similarity index 100% rename from test/ReplayData/NamedUser.setUp.txt rename to github/tests/ReplayData/NamedUser.setUp.txt diff --git a/test/ReplayData/NamedUser.testAttributesOfOtherUser.txt b/github/tests/ReplayData/NamedUser.testAttributesOfOtherUser.txt similarity index 100% rename from test/ReplayData/NamedUser.testAttributesOfOtherUser.txt rename to github/tests/ReplayData/NamedUser.testAttributesOfOtherUser.txt diff --git a/test/ReplayData/NamedUser.testCreateGist.txt b/github/tests/ReplayData/NamedUser.testCreateGist.txt similarity index 86% rename from test/ReplayData/NamedUser.testCreateGist.txt rename to github/tests/ReplayData/NamedUser.testCreateGist.txt index e7ea70b7..f8ef3149 100644 --- a/test/ReplayData/NamedUser.testCreateGist.txt +++ b/github/tests/ReplayData/NamedUser.testCreateGist.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /users/jacquev6/gists {'Authorization': 'Basic login_and_password_removed'} {"files": {"foobar.txt": {"content": "File created by PyGithub"}}, "public": true, "description": "Gist created by PyGithub on a NamedUser"} +https POST api.github.com None /users/jacquev6/gists {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"files": {"foobar.txt": {"content": "File created by PyGithub"}}, "public": true, "description": "Gist created by PyGithub on a NamedUser"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4961'), ('content-length', '1461'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"a0bf182f5ec61a0c78e9078da61ef220"'), ('date', 'Sun, 20 May 2012 12:14:08 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/gists/2757859')] {"updated_at":"2012-05-20T12:14:08Z","forks":[],"url":"https://api.github.com/gists/2757859","comments":0,"public":true,"git_pull_url":"git://gist.github.com/2757859.git","git_push_url":"git@gist.github.com:2757859.git","files":{"foobar.txt":{"type":"text/plain","size":24,"filename":"foobar.txt","raw_url":"https://gist.github.com/raw/2757859/73a1c7f17aa0ad5d7cbb5a8ca033ce47d3d23197/foobar.txt","content":"File created by PyGithub","language":"Text"}},"html_url":"https://gist.github.com/2757859","user":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","id":327146},"description":"Gist created by PyGithub on a NamedUser","created_at":"2012-05-20T12:14:08Z","id":"2757859","history":[{"change_status":{"deletions":0,"additions":1,"total":1},"url":"https://api.github.com/gists/2757859/a371de5450f93699fe3cb0386897abe69cdc967e","committed_at":"2012-05-20T12:14:08Z","version":"a371de5450f93699fe3cb0386897abe69cdc967e","user":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","id":327146}}]} diff --git a/test/ReplayData/NamedUser.testCreateGistWithoutDescription.txt b/github/tests/ReplayData/NamedUser.testCreateGistWithoutDescription.txt similarity index 88% rename from test/ReplayData/NamedUser.testCreateGistWithoutDescription.txt rename to github/tests/ReplayData/NamedUser.testCreateGistWithoutDescription.txt index 477b89be..c11e8757 100644 --- a/test/ReplayData/NamedUser.testCreateGistWithoutDescription.txt +++ b/github/tests/ReplayData/NamedUser.testCreateGistWithoutDescription.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /users/jacquev6/gists {'Authorization': 'Basic login_and_password_removed'} {"files": {"foobar.txt": {"content": "File created by PyGithub"}}, "public": true} +https POST api.github.com None /users/jacquev6/gists {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"files": {"foobar.txt": {"content": "File created by PyGithub"}}, "public": true} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4959'), ('content-length', '1424'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"70ddb8edc443c90302048551cc26e7b9"'), ('date', 'Sat, 26 May 2012 11:08:22 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/gists/2793505')] {"git_push_url":"git@gist.github.com:2793505.git","updated_at":"2012-05-26T11:08:22Z","url":"https://api.github.com/gists/2793505","comments":0,"public":true,"forks":[],"files":{"foobar.txt":{"type":"text/plain","raw_url":"https://gist.github.com/raw/2793505/73a1c7f17aa0ad5d7cbb5a8ca033ce47d3d23197/foobar.txt","size":24,"filename":"foobar.txt","content":"File created by PyGithub","language":"Text"}},"user":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"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"},"description":null,"created_at":"2012-05-26T11:08:22Z","git_pull_url":"git://gist.github.com/2793505.git","id":"2793505","history":[{"url":"https://api.github.com/gists/2793505/a456dbfb5e6fd94cb96beba0a2c5684b251d3384","version":"a456dbfb5e6fd94cb96beba0a2c5684b251d3384","change_status":{"deletions":0,"additions":1,"total":1},"committed_at":"2012-05-26T11:08:22Z","user":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"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"}}],"html_url":"https://gist.github.com/2793505"} diff --git a/test/ReplayData/NamedUser.testGetEvents.txt b/github/tests/ReplayData/NamedUser.testGetEvents.txt similarity index 100% rename from test/ReplayData/NamedUser.testGetEvents.txt rename to github/tests/ReplayData/NamedUser.testGetEvents.txt diff --git a/test/ReplayData/NamedUser.testGetFollowers.txt b/github/tests/ReplayData/NamedUser.testGetFollowers.txt similarity index 100% rename from test/ReplayData/NamedUser.testGetFollowers.txt rename to github/tests/ReplayData/NamedUser.testGetFollowers.txt diff --git a/test/ReplayData/NamedUser.testGetFollowing.txt b/github/tests/ReplayData/NamedUser.testGetFollowing.txt similarity index 100% rename from test/ReplayData/NamedUser.testGetFollowing.txt rename to github/tests/ReplayData/NamedUser.testGetFollowing.txt diff --git a/test/ReplayData/NamedUser.testGetGists.txt b/github/tests/ReplayData/NamedUser.testGetGists.txt similarity index 100% rename from test/ReplayData/NamedUser.testGetGists.txt rename to github/tests/ReplayData/NamedUser.testGetGists.txt diff --git a/test/ReplayData/NamedUser.testGetOrgs.txt b/github/tests/ReplayData/NamedUser.testGetOrgs.txt similarity index 100% rename from test/ReplayData/NamedUser.testGetOrgs.txt rename to github/tests/ReplayData/NamedUser.testGetOrgs.txt diff --git a/test/ReplayData/NamedUser.testGetPublicEvents.txt b/github/tests/ReplayData/NamedUser.testGetPublicEvents.txt similarity index 100% rename from test/ReplayData/NamedUser.testGetPublicEvents.txt rename to github/tests/ReplayData/NamedUser.testGetPublicEvents.txt diff --git a/test/ReplayData/NamedUser.testGetPublicReceivedEvents.txt b/github/tests/ReplayData/NamedUser.testGetPublicReceivedEvents.txt similarity index 100% rename from test/ReplayData/NamedUser.testGetPublicReceivedEvents.txt rename to github/tests/ReplayData/NamedUser.testGetPublicReceivedEvents.txt diff --git a/test/ReplayData/NamedUser.testGetReceivedEvents.txt b/github/tests/ReplayData/NamedUser.testGetReceivedEvents.txt similarity index 100% rename from test/ReplayData/NamedUser.testGetReceivedEvents.txt rename to github/tests/ReplayData/NamedUser.testGetReceivedEvents.txt diff --git a/test/ReplayData/NamedUser.testGetRepo.txt b/github/tests/ReplayData/NamedUser.testGetRepo.txt similarity index 100% rename from test/ReplayData/NamedUser.testGetRepo.txt rename to github/tests/ReplayData/NamedUser.testGetRepo.txt diff --git a/test/ReplayData/NamedUser.testGetRepos.txt b/github/tests/ReplayData/NamedUser.testGetRepos.txt similarity index 100% rename from test/ReplayData/NamedUser.testGetRepos.txt rename to github/tests/ReplayData/NamedUser.testGetRepos.txt diff --git a/test/ReplayData/NamedUser.testGetReposWithType.txt b/github/tests/ReplayData/NamedUser.testGetReposWithType.txt similarity index 100% rename from test/ReplayData/NamedUser.testGetReposWithType.txt rename to github/tests/ReplayData/NamedUser.testGetReposWithType.txt diff --git a/test/ReplayData/NamedUser.testGetStarred.txt b/github/tests/ReplayData/NamedUser.testGetStarred.txt similarity index 100% rename from test/ReplayData/NamedUser.testGetStarred.txt rename to github/tests/ReplayData/NamedUser.testGetStarred.txt diff --git a/test/ReplayData/NamedUser.testGetSubscriptions.txt b/github/tests/ReplayData/NamedUser.testGetSubscriptions.txt similarity index 100% rename from test/ReplayData/NamedUser.testGetSubscriptions.txt rename to github/tests/ReplayData/NamedUser.testGetSubscriptions.txt diff --git a/test/ReplayData/NamedUser.testGetWatched.txt b/github/tests/ReplayData/NamedUser.testGetWatched.txt similarity index 100% rename from test/ReplayData/NamedUser.testGetWatched.txt rename to github/tests/ReplayData/NamedUser.testGetWatched.txt diff --git a/test/ReplayData/Organization.setUp.txt b/github/tests/ReplayData/Organization.setUp.txt similarity index 100% rename from test/ReplayData/Organization.setUp.txt rename to github/tests/ReplayData/Organization.setUp.txt diff --git a/test/ReplayData/Organization.testCreateFork.txt b/github/tests/ReplayData/Organization.testCreateFork.txt similarity index 100% rename from test/ReplayData/Organization.testCreateFork.txt rename to github/tests/ReplayData/Organization.testCreateFork.txt diff --git a/test/ReplayData/Organization.testCreateRepoWithAllArguments.txt b/github/tests/ReplayData/Organization.testCreateRepoWithAllArguments.txt similarity index 87% rename from test/ReplayData/Organization.testCreateRepoWithAllArguments.txt rename to github/tests/ReplayData/Organization.testCreateRepoWithAllArguments.txt index 442d3c83..ea8dd982 100644 --- a/test/ReplayData/Organization.testCreateRepoWithAllArguments.txt +++ b/github/tests/ReplayData/Organization.testCreateRepoWithAllArguments.txt @@ -3,7 +3,7 @@ https GET api.github.com None /teams/141496 {'Authorization': 'Basic login_and_p [('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} -https POST api.github.com None /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"} +https POST api.github.com None /orgs/BeaverSoftware/repos {'Content-Type': 'application/json', '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')] {"organization":{"url":"https://api.github.com/users/BeaverSoftware","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","login":"BeaverSoftware","id":1424031},"clone_url":"https://github.com/BeaverSoftware/TestPyGithub2.git","has_downloads":false,"watchers":1,"updated_at":"2012-05-27T05:20:42Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":"http://foobar.com","url":"https://api.github.com/repos/BeaverSoftware/TestPyGithub2","mirror_url":null,"has_wiki":false,"has_issues":false,"fork":false,"forks":1,"size":0,"private":false,"open_issues":0,"svn_url":"https://github.com/BeaverSoftware/TestPyGithub2","owner":{"url":"https://api.github.com/users/BeaverSoftware","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","login":"BeaverSoftware","id":1424031},"name":"TestPyGithub2","language":null,"description":"Repo created by PyGithub","ssh_url":"git@github.com:BeaverSoftware/TestPyGithub2.git","pushed_at":"2012-05-27T05:20:42Z","created_at":"2012-05-27T05:20:42Z","id":4460019,"git_url":"git://github.com/BeaverSoftware/TestPyGithub2.git","html_url":"https://github.com/BeaverSoftware/TestPyGithub2","full_name":"BeaverSoftware/TestPyGithub2"} diff --git a/test/ReplayData/Organization.testCreateRepoWithMinimalArguments.txt b/github/tests/ReplayData/Organization.testCreateRepoWithMinimalArguments.txt similarity index 91% rename from test/ReplayData/Organization.testCreateRepoWithMinimalArguments.txt rename to github/tests/ReplayData/Organization.testCreateRepoWithMinimalArguments.txt index d94abad3..04287bf6 100644 --- a/test/ReplayData/Organization.testCreateRepoWithMinimalArguments.txt +++ b/github/tests/ReplayData/Organization.testCreateRepoWithMinimalArguments.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /orgs/BeaverSoftware/repos {'Authorization': 'Basic login_and_password_removed'} {"name": "TestPyGithub"} +https POST api.github.com None /orgs/BeaverSoftware/repos {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"name": "TestPyGithub"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4971'), ('content-length', '1453'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"074f73773c425ba61e6a7738dc89b6ed"'), ('date', 'Sun, 27 May 2012 05:20:24 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/BeaverSoftware/TestPyGithub')] {"organization":{"url":"https://api.github.com/users/BeaverSoftware","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","login":"BeaverSoftware","id":1424031},"clone_url":"https://github.com/BeaverSoftware/TestPyGithub.git","has_downloads":true,"watchers":1,"updated_at":"2012-05-27T05:20:24Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":null,"url":"https://api.github.com/repos/BeaverSoftware/TestPyGithub","mirror_url":null,"has_wiki":true,"has_issues":true,"fork":false,"forks":1,"size":0,"private":false,"open_issues":0,"svn_url":"https://github.com/BeaverSoftware/TestPyGithub","owner":{"url":"https://api.github.com/users/BeaverSoftware","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","login":"BeaverSoftware","id":1424031},"name":"TestPyGithub","language":null,"description":null,"ssh_url":"git@github.com:BeaverSoftware/TestPyGithub.git","pushed_at":"2012-05-27T05:20:24Z","created_at":"2012-05-27T05:20:24Z","id":4460018,"git_url":"git://github.com/BeaverSoftware/TestPyGithub.git","html_url":"https://github.com/BeaverSoftware/TestPyGithub","full_name":"BeaverSoftware/TestPyGithub"} diff --git a/github/tests/ReplayData/Organization.testCreateRepositoryWithAutoInit.txt b/github/tests/ReplayData/Organization.testCreateRepositoryWithAutoInit.txt new file mode 100644 index 00000000..cb71243b --- /dev/null +++ b/github/tests/ReplayData/Organization.testCreateRepositoryWithAutoInit.txt @@ -0,0 +1,5 @@ +https POST api.github.com None /orgs/BeaverSoftware/repos {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"gitignore_template": "Python", "name": "TestPyGithub", "auto_init": true} +201 +[('status', '201 Created'), ('content-length', '1559'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-limit', '5000'), ('x-ratelimit-remaining', '4996'), ('server', 'nginx'), ('connection', 'keep-alive'), ('etag', '"2f35ceac1b69bbfc8c38907877514e9d"'), ('location', 'https://api.github.com/repos/BeaverSoftware/TestPyGithub'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Sat, 03 Nov 2012 09:03:49 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"watchers":0,"pushed_at":"2012-11-03T09:03:49Z","forks":0,"has_issues":true,"has_downloads":true,"open_issues_count":0,"description":null,"html_url":"https://github.com/BeaverSoftware/TestPyGithub","owner":{"avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-org-420.png","url":"https://api.github.com/users/BeaverSoftware","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","login":"BeaverSoftware","id":1424031},"url":"https://api.github.com/repos/BeaverSoftware/TestPyGithub","updated_at":"2012-11-03T09:03:49Z","organization":{"avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-org-420.png","url":"https://api.github.com/users/BeaverSoftware","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","login":"BeaverSoftware","id":1424031},"permissions":{"push":true,"pull":true,"admin":true},"mirror_url":null,"clone_url":"https://github.com/BeaverSoftware/TestPyGithub.git","language":null,"has_wiki":true,"ssh_url":"git@github.com:BeaverSoftware/TestPyGithub.git","svn_url":"https://github.com/BeaverSoftware/TestPyGithub","size":0,"fork":false,"full_name":"BeaverSoftware/TestPyGithub","open_issues":0,"git_url":"git://github.com/BeaverSoftware/TestPyGithub.git","forks_count":0,"name":"TestPyGithub","created_at":"2012-11-03T09:03:49Z","homepage":null,"private":false,"id":6517856,"master_branch":"master","network_count":0,"watchers_count":0} + diff --git a/test/ReplayData/Organization.testCreateTeam.txt b/github/tests/ReplayData/Organization.testCreateTeam.txt similarity index 74% rename from test/ReplayData/Organization.testCreateTeam.txt rename to github/tests/ReplayData/Organization.testCreateTeam.txt index dafa032b..a37b7198 100644 --- a/test/ReplayData/Organization.testCreateTeam.txt +++ b/github/tests/ReplayData/Organization.testCreateTeam.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /orgs/BeaverSoftware/teams {'Authorization': 'Basic login_and_password_removed'} {"name": "Team created by PyGithub"} +https POST api.github.com None /orgs/BeaverSoftware/teams {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"name": "Team created by PyGithub"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4988'), ('content-length', '145'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"189a318993cde3e040f2efb4f634f8a8"'), ('date', 'Sat, 26 May 2012 20:58:53 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/teams/189850')] {"url":"https://api.github.com/teams/189850","members_count":0,"repos_count":0,"name":"Team created by PyGithub","permission":"pull","id":189850} diff --git a/test/ReplayData/Organization.testCreateTeamWithAllArguments.txt b/github/tests/ReplayData/Organization.testCreateTeamWithAllArguments.txt similarity index 90% rename from test/ReplayData/Organization.testCreateTeamWithAllArguments.txt rename to github/tests/ReplayData/Organization.testCreateTeamWithAllArguments.txt index 2a0cd9ae..8c9f6c56 100644 --- a/test/ReplayData/Organization.testCreateTeamWithAllArguments.txt +++ b/github/tests/ReplayData/Organization.testCreateTeamWithAllArguments.txt @@ -3,7 +3,7 @@ https GET api.github.com None /repos/BeaverSoftware/FatherBeaver {'Authorization [('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} -https POST api.github.com None /orgs/BeaverSoftware/teams {'Authorization': 'Basic login_and_password_removed'} {"repo_names": ["BeaverSoftware/FatherBeaver"], "name": "Team also created by PyGithub", "permission": "push"} +https POST api.github.com None /orgs/BeaverSoftware/teams {'Content-Type': 'application/json', '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')] {"repos_count":1,"url":"https://api.github.com/teams/189852","members_count":0,"name":"Team also created by PyGithub","permission":"push","id":189852} diff --git a/test/ReplayData/Organization.testEditWithAllArguments.txt b/github/tests/ReplayData/Organization.testEditWithAllArguments.txt similarity index 74% rename from test/ReplayData/Organization.testEditWithAllArguments.txt rename to github/tests/ReplayData/Organization.testEditWithAllArguments.txt index b5879a8a..4269c75a 100644 --- a/test/ReplayData/Organization.testEditWithAllArguments.txt +++ b/github/tests/ReplayData/Organization.testEditWithAllArguments.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /orgs/BeaverSoftware {'Authorization': 'Basic login_and_password_removed'} {"name": "Name edited by PyGithub", "billing_email": "BeaverSoftware2@vincent-jacques.net", "company": "Company edited by PyGithub", "blog": "http://vincent-jacques.net", "location": "Location edited by PyGithub", "email": "BeaverSoftware2@vincent-jacques.net"} +https PATCH api.github.com None /orgs/BeaverSoftware {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"name": "Name edited by PyGithub", "billing_email": "BeaverSoftware2@vincent-jacques.net", "company": "Company edited by PyGithub", "blog": "http://vincent-jacques.net", "location": "Location edited by PyGithub", "email": "BeaverSoftware2@vincent-jacques.net"} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4992'), ('content-length', '833'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"fe61098c87e054abfa5626e6a76bbcbd"'), ('date', 'Sat, 26 May 2012 20:50:35 GMT'), ('content-type', 'application/json; charset=utf-8')] {"public_gists":0,"type":"Organization","disk_usage":112,"private_gists":0,"public_repos":2,"url":"https://api.github.com/orgs/BeaverSoftware","total_private_repos":0,"plan":{"private_repos":0,"name":"free","space":307200},"blog":"http://vincent-jacques.net","avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","owned_private_repos":0,"collaborators":0,"company":"Company edited by PyGithub","login":"BeaverSoftware","email":"BeaverSoftware2@vincent-jacques.net","followers":0,"name":"Name edited by PyGithub","created_at":"2012-02-09T19:20:12Z","location":"Location edited by PyGithub","id":1424031,"billing_email":"BeaverSoftware2@vincent-jacques.net","following":0,"html_url":"https://github.com/BeaverSoftware"} diff --git a/test/ReplayData/Organization.testEditWithoutArguments.txt b/github/tests/ReplayData/Organization.testEditWithoutArguments.txt similarity index 87% rename from test/ReplayData/Organization.testEditWithoutArguments.txt rename to github/tests/ReplayData/Organization.testEditWithoutArguments.txt index 151a8aaf..9b3b41ae 100644 --- a/test/ReplayData/Organization.testEditWithoutArguments.txt +++ b/github/tests/ReplayData/Organization.testEditWithoutArguments.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /orgs/BeaverSoftware {'Authorization': 'Basic login_and_password_removed'} {} +https PATCH api.github.com None /orgs/BeaverSoftware {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4996'), ('content-length', '716'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"a9ca2dd89f69da85bebd949477894af0"'), ('date', 'Fri, 11 May 2012 09:07:56 GMT'), ('content-type', 'application/json; charset=utf-8')] {"owned_private_repos":0,"private_gists":0,"type":"Organization","following":0,"company":null,"html_url":"https://github.com/BeaverSoftware","blog":null,"avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","followers":0,"url":"https://api.github.com/orgs/BeaverSoftware","public_repos":2,"login":"BeaverSoftware","collaborators":0,"email":null,"disk_usage":112,"plan":{"private_repos":0,"space":307200,"name":"free"},"created_at":"2012-02-09T19:20:12Z","name":null,"total_private_repos":0,"billing_email":"BeaverSoftware@vincent-jacques.net","public_gists":0,"id":1424031,"location":"Paris, France"} diff --git a/test/ReplayData/Organization.testGetEvents.txt b/github/tests/ReplayData/Organization.testGetEvents.txt similarity index 100% rename from test/ReplayData/Organization.testGetEvents.txt rename to github/tests/ReplayData/Organization.testGetEvents.txt diff --git a/test/ReplayData/Organization.testGetMembers.txt b/github/tests/ReplayData/Organization.testGetMembers.txt similarity index 100% rename from test/ReplayData/Organization.testGetMembers.txt rename to github/tests/ReplayData/Organization.testGetMembers.txt diff --git a/test/ReplayData/Organization.testGetPublicMembers.txt b/github/tests/ReplayData/Organization.testGetPublicMembers.txt similarity index 100% rename from test/ReplayData/Organization.testGetPublicMembers.txt rename to github/tests/ReplayData/Organization.testGetPublicMembers.txt diff --git a/test/ReplayData/Organization.testGetRepos.txt b/github/tests/ReplayData/Organization.testGetRepos.txt similarity index 100% rename from test/ReplayData/Organization.testGetRepos.txt rename to github/tests/ReplayData/Organization.testGetRepos.txt diff --git a/test/ReplayData/Organization.testGetReposWithType.txt b/github/tests/ReplayData/Organization.testGetReposWithType.txt similarity index 100% rename from test/ReplayData/Organization.testGetReposWithType.txt rename to github/tests/ReplayData/Organization.testGetReposWithType.txt diff --git a/test/ReplayData/Organization.testGetTeams.txt b/github/tests/ReplayData/Organization.testGetTeams.txt similarity index 100% rename from test/ReplayData/Organization.testGetTeams.txt rename to github/tests/ReplayData/Organization.testGetTeams.txt diff --git a/test/ReplayData/Organization.testMembers.txt b/github/tests/ReplayData/Organization.testMembers.txt similarity index 100% rename from test/ReplayData/Organization.testMembers.txt rename to github/tests/ReplayData/Organization.testMembers.txt diff --git a/test/ReplayData/Organization.testPublicMembers.txt b/github/tests/ReplayData/Organization.testPublicMembers.txt similarity index 100% rename from test/ReplayData/Organization.testPublicMembers.txt rename to github/tests/ReplayData/Organization.testPublicMembers.txt diff --git a/test/ReplayData/PaginatedList.setUp.txt b/github/tests/ReplayData/PaginatedList.setUp.txt similarity index 100% rename from test/ReplayData/PaginatedList.setUp.txt rename to github/tests/ReplayData/PaginatedList.setUp.txt diff --git a/test/ReplayData/PaginatedList.testGetFirstPage.txt b/github/tests/ReplayData/PaginatedList.testGetFirstPage.txt similarity index 100% rename from test/ReplayData/PaginatedList.testGetFirstPage.txt rename to github/tests/ReplayData/PaginatedList.testGetFirstPage.txt diff --git a/test/ReplayData/PaginatedList.testGetThirdPage.txt b/github/tests/ReplayData/PaginatedList.testGetThirdPage.txt similarity index 100% rename from test/ReplayData/PaginatedList.testGetThirdPage.txt rename to github/tests/ReplayData/PaginatedList.testGetThirdPage.txt diff --git a/test/ReplayData/PaginatedList.testIntIndexingAfterIteration.txt b/github/tests/ReplayData/PaginatedList.testIntIndexingAfterIteration.txt similarity index 100% rename from test/ReplayData/PaginatedList.testIntIndexingAfterIteration.txt rename to github/tests/ReplayData/PaginatedList.testIntIndexingAfterIteration.txt diff --git a/test/ReplayData/PaginatedList.testIntIndexingInFirstPage.txt b/github/tests/ReplayData/PaginatedList.testIntIndexingInFirstPage.txt similarity index 100% rename from test/ReplayData/PaginatedList.testIntIndexingInFirstPage.txt rename to github/tests/ReplayData/PaginatedList.testIntIndexingInFirstPage.txt diff --git a/test/ReplayData/PaginatedList.testIntIndexingInThirdPage.txt b/github/tests/ReplayData/PaginatedList.testIntIndexingInThirdPage.txt similarity index 100% rename from test/ReplayData/PaginatedList.testIntIndexingInThirdPage.txt rename to github/tests/ReplayData/PaginatedList.testIntIndexingInThirdPage.txt diff --git a/test/ReplayData/PaginatedList.testInterruptedIteration.txt b/github/tests/ReplayData/PaginatedList.testInterruptedIteration.txt similarity index 100% rename from test/ReplayData/PaginatedList.testInterruptedIteration.txt rename to github/tests/ReplayData/PaginatedList.testInterruptedIteration.txt diff --git a/test/ReplayData/PaginatedList.testInterruptedIterationInSlice.txt b/github/tests/ReplayData/PaginatedList.testInterruptedIterationInSlice.txt similarity index 100% rename from test/ReplayData/PaginatedList.testInterruptedIterationInSlice.txt rename to github/tests/ReplayData/PaginatedList.testInterruptedIterationInSlice.txt diff --git a/test/ReplayData/PaginatedList.testIteration.txt b/github/tests/ReplayData/PaginatedList.testIteration.txt similarity index 100% rename from test/ReplayData/PaginatedList.testIteration.txt rename to github/tests/ReplayData/PaginatedList.testIteration.txt diff --git a/test/ReplayData/PaginatedList.testSeveralIterations.txt b/github/tests/ReplayData/PaginatedList.testSeveralIterations.txt similarity index 100% rename from test/ReplayData/PaginatedList.testSeveralIterations.txt rename to github/tests/ReplayData/PaginatedList.testSeveralIterations.txt diff --git a/test/ReplayData/PaginatedList.testSliceIndexingInFirstPage.txt b/github/tests/ReplayData/PaginatedList.testSliceIndexingInFirstPage.txt similarity index 100% rename from test/ReplayData/PaginatedList.testSliceIndexingInFirstPage.txt rename to github/tests/ReplayData/PaginatedList.testSliceIndexingInFirstPage.txt diff --git a/test/ReplayData/PaginatedList.testSliceIndexingUntilEnd.txt b/github/tests/ReplayData/PaginatedList.testSliceIndexingUntilEnd.txt similarity index 100% rename from test/ReplayData/PaginatedList.testSliceIndexingUntilEnd.txt rename to github/tests/ReplayData/PaginatedList.testSliceIndexingUntilEnd.txt diff --git a/test/ReplayData/PaginatedList.testSliceIndexingUntilFourthPage.txt b/github/tests/ReplayData/PaginatedList.testSliceIndexingUntilFourthPage.txt similarity index 100% rename from test/ReplayData/PaginatedList.testSliceIndexingUntilFourthPage.txt rename to github/tests/ReplayData/PaginatedList.testSliceIndexingUntilFourthPage.txt diff --git a/github/tests/ReplayData/PullRequest.setUp.txt b/github/tests/ReplayData/PullRequest.setUp.txt new file mode 100644 index 00000000..ac0543aa --- /dev/null +++ b/github/tests/ReplayData/PullRequest.setUp.txt @@ -0,0 +1,15 @@ +https GET api.github.com None /user {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4950'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"e3511a4776ec399b168eb5f96423f3c8"'), ('date', 'Sun, 27 May 2012 10:32:04 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"collaborators":0,"type":"User","disk_usage":16856,"bio":"","public_gists":3,"url":"https://api.github.com/users/jacquev6","private_gists":5,"plan":{"private_repos":5,"collaborators":1,"name":"micro","space":614400},"company":"Criteo","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","blog":"http://vincent-jacques.net","email":"vincent@vincent-jacques.net","total_private_repos":5,"followers":13,"name":"Vincent Jacques","public_repos":11,"created_at":"2010-07-09T06:10:06Z","location":"Paris, France","id":327146,"owned_private_repos":5,"following":24,"html_url":"https://github.com/jacquev6","hireable":false,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"} + +https GET api.github.com None /repos/jacquev6/PyGithub {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4949'), ('content-length', '1129'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"65cfc4c324b5a85af62a0091f4d86503"'), ('date', 'Sun, 27 May 2012 10:32:05 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"clone_url":"https://github.com/jacquev6/PyGithub.git","has_downloads":true,"watchers":15,"git_url":"git://github.com/jacquev6/PyGithub.git","updated_at":"2012-05-27T10:29:10Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","mirror_url":null,"has_wiki":false,"has_issues":true,"fork":false,"forks":3,"size":188,"private":false,"open_issues":16,"svn_url":"https://github.com/jacquev6/PyGithub","owner":{"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},"name":"PyGithub","language":"Python","description":"Python library implementing the full Github API v3","ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-27T10:29:09Z","created_at":"2012-02-25T12:53:47Z","id":3544490,"html_url":"https://github.com/jacquev6/PyGithub","full_name":"jacquev6/PyGithub"} + +https GET api.github.com None /repos/jacquev6/PyGithub/pulls/31 {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4985'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-limit', '5000'), ('vary', 'Accept, Authorization, Cookie'), ('content-length', '4182'), ('server', 'nginx'), ('last-modified', 'Sat, 03 Nov 2012 08:19:40 GMT'), ('connection', 'keep-alive'), ('etag', '"1ec7d9f2ebb27db7dc002f1382d23975"'), ('cache-control', 'private, s-maxage=60, max-age=60'), ('date', 'Sat, 03 Nov 2012 08:19:46 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"additions":511,"deletions":384,"merged_at":"2012-05-27T10:29:07Z","base":{"label":"jacquev6:topic/RewriteWithGeneratedCode","repo":{"watchers":97,"pushed_at":"2012-11-03T08:07:38Z","watchers_count":97,"forks":27,"open_issues":12,"mirror_url":null,"description":"Python library implementing the full Github API v3","owner":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","login":"jacquev6","id":327146},"open_issues_count":12,"url":"https://api.github.com/repos/jacquev6/PyGithub","updated_at":"2012-11-03T08:07:40Z","html_url":"https://github.com/jacquev6/PyGithub","clone_url":"https://github.com/jacquev6/PyGithub.git","language":"Python","has_downloads":true,"ssh_url":"git@github.com:jacquev6/PyGithub.git","size":256,"forks_count":27,"fork":false,"full_name":"jacquev6/PyGithub","name":"PyGithub","created_at":"2012-02-25T12:53:47Z","git_url":"git://github.com/jacquev6/PyGithub.git","svn_url":"https://github.com/jacquev6/PyGithub","homepage":"http://vincent-jacques.net/PyGithub","has_wiki":true,"private":false,"id":3544490,"has_issues":true},"sha":"ed866fc43833802ab553e5ff8581c81bb00dd433","ref":"topic/RewriteWithGeneratedCode","user":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","login":"jacquev6","id":327146}},"review_comments":1,"changed_files":45,"merge_commit_sha":"28ae6dd10ebccd5eaf8db8dacb5b699ee7f4a663","closed_at":"2012-05-27T10:29:07Z","number":31,"issue_url":"https://github.com/jacquev6/PyGithub/issues/31","url":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31","milestone":null,"updated_at":"2012-11-03T08:19:40Z","patch_url":"https://github.com/jacquev6/PyGithub/pull/31.patch","html_url":"https://github.com/jacquev6/PyGithub/pull/31","merged_by":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","login":"jacquev6","id":327146},"commits":3,"state":"closed","mergeable":false,"_links":{"review_comments":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31/comments"},"html":{"href":"https://github.com/jacquev6/PyGithub/pull/31"},"self":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31"},"issue":{"href":"https://api.github.com/repos/jacquev6/PyGithub/issues/31"},"comments":{"href":"https://api.github.com/repos/jacquev6/PyGithub/issues/31/comments"}},"head":{"label":"BeaverSoftware:master","repo":null,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","ref":"master","user":{"url":"https://api.github.com/users/BeaverSoftware","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-org-420.png","login":"BeaverSoftware","id":1424031}},"assignee":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","login":"jacquev6","id":327146},"diff_url":"https://github.com/jacquev6/PyGithub/pull/31.diff","comments":1,"created_at":"2012-05-27T09:25:36Z","id":1436215,"merged":true,"mergeable_state":"dirty","body":"Body edited by PyGithub","user":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","login":"jacquev6","id":327146},"title":"Title edited by PyGithub"} + diff --git a/test/ReplayData/PullRequest.testCreateComment.txt b/github/tests/ReplayData/PullRequest.testCreateComment.txt similarity index 86% rename from test/ReplayData/PullRequest.testCreateComment.txt rename to github/tests/ReplayData/PullRequest.testCreateComment.txt index 6c4d7ef7..39a16e55 100644 --- a/test/ReplayData/PullRequest.testCreateComment.txt +++ b/github/tests/ReplayData/PullRequest.testCreateComment.txt @@ -1,9 +1,9 @@ https GET api.github.com None /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+ # @toto 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}} +{"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+ # @toto 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 {'Content-Type': 'application/json', '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}} -https POST api.github.com None /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"} +https POST api.github.com None /repos/jacquev6/PyGithub/pulls/31/comments {'Content-Type': 'application/json', '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')] {"updated_at":"2012-05-27T09:40:12Z","position":5,"original_position":5,"body":"Comment created by PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub/pulls/comments/886298","commit_id":"8a4f306d4b223682dd19410d4a9150636ebe4206","created_at":"2012-05-27T09:40:12Z","user":{"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},"original_commit_id":"8a4f306d4b223682dd19410d4a9150636ebe4206","path":"src/github/Issue.py","id":886298,"_links":{"self":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/comments/886298"},"html":{"href":"https://github.com/jacquev6/PyGithub/pull/31#r886298"},"pull_request":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31"}}} diff --git a/test/ReplayData/PullRequest.testCreateIssueComment.txt b/github/tests/ReplayData/PullRequest.testCreateIssueComment.txt similarity index 88% rename from test/ReplayData/PullRequest.testCreateIssueComment.txt rename to github/tests/ReplayData/PullRequest.testCreateIssueComment.txt index 839d2ff7..cc06f0f8 100644 --- a/test/ReplayData/PullRequest.testCreateIssueComment.txt +++ b/github/tests/ReplayData/PullRequest.testCreateIssueComment.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/issues/31/comments {'Authorization': 'Basic login_and_password_removed'} {"body": "Issue comment created by PyGithub"} +https POST api.github.com None /repos/jacquev6/PyGithub/issues/31/comments {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"body": "Issue comment created by PyGithub"} 201 [('status', '201 Created'), ('content-length', '517'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-remaining', '4976'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/issues/comments/8387331'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Sat, 08 Sep 2012 12:57:51 GMT'), ('etag', '"6d189ee4b6415276097b091d11a77ce0"'), ('content-type', 'application/json; charset=utf-8')] {"body":"Issue comment created by PyGithub","user":{"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","url":"https://api.github.com/users/jacquev6","id":327146},"created_at":"2012-09-08T12:57:51Z","updated_at":"2012-09-08T12:57:51Z","url":"https://api.github.com/repos/jacquev6/PyGithub/issues/comments/8387331","id":8387331} diff --git a/test/ReplayData/PullRequest.testEditWithAllArguments.txt b/github/tests/ReplayData/PullRequest.testEditWithAllArguments.txt similarity index 96% rename from test/ReplayData/PullRequest.testEditWithAllArguments.txt rename to github/tests/ReplayData/PullRequest.testEditWithAllArguments.txt index 358970d5..af911e43 100644 --- a/test/ReplayData/PullRequest.testEditWithAllArguments.txt +++ b/github/tests/ReplayData/PullRequest.testEditWithAllArguments.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /repos/jacquev6/PyGithub/pulls/31 {'Authorization': 'Basic login_and_password_removed'} {"body": "Body edited by PyGithub", "state": "open", "title": "Title edited by PyGithub"} +https PATCH api.github.com None /repos/jacquev6/PyGithub/pulls/31 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"body": "Body edited by PyGithub", "state": "open", "title": "Title edited by PyGithub"} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4979'), ('content-length', '4477'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"892e1599c76b5b026bc67423b4a69c26"'), ('date', 'Sun, 27 May 2012 10:18:08 GMT'), ('content-type', 'application/json; charset=utf-8')] {"merged_by":null,"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},"title":"Title edited by PyGithub","state":"open","comments":0,"merged_at":null,"updated_at":"2012-05-27T10:18:08Z","deletions":384,"head":{"user":{"gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","url":"https://api.github.com/users/BeaverSoftware","login":"BeaverSoftware","id":1424031},"repo":{"description":"Python library implementing the full Github API v3","full_name":"BeaverSoftware/PyGithub","has_wiki":false,"has_issues":false,"updated_at":"2012-05-27T09:09:17Z","forks":0,"mirror_url":null,"homepage":"http://vincent-jacques.net/PyGithub","ssh_url":"git@github.com:BeaverSoftware/PyGithub.git","open_issues":0,"fork":true,"svn_url":"https://github.com/BeaverSoftware/PyGithub","pushed_at":"2012-05-27T09:09:17Z","size":176,"html_url":"https://github.com/BeaverSoftware/PyGithub","private":false,"url":"https://api.github.com/repos/BeaverSoftware/PyGithub","clone_url":"https://github.com/BeaverSoftware/PyGithub.git","owner":{"gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","url":"https://api.github.com/users/BeaverSoftware","login":"BeaverSoftware","id":1424031},"name":"PyGithub","has_downloads":true,"language":"Python","watchers":1,"git_url":"git://github.com/BeaverSoftware/PyGithub.git","id":4460787,"created_at":"2012-05-27T08:50:04Z"},"label":"BeaverSoftware:master","sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","ref":"master"},"body":"Body edited by PyGithub","merged":false,"additions":511,"number":31,"_links":{"comments":{"href":"https://api.github.com/repos/jacquev6/PyGithub/issues/31/comments"},"issue":{"href":"https://api.github.com/repos/jacquev6/PyGithub/issues/31"},"self":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31"},"review_comments":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31/comments"},"html":{"href":"https://github.com/jacquev6/PyGithub/pull/31"}},"closed_at":null,"diff_url":"https://github.com/jacquev6/PyGithub/pull/31.diff","mergeable":true,"commits":3,"changed_files":45,"html_url":"https://github.com/jacquev6/PyGithub/pull/31","url":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31","review_comments":1,"issue_url":"https://github.com/jacquev6/PyGithub/issues/31","id":1436215,"base":{"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},"repo":{"description":"Python library implementing the full Github API v3","full_name":"jacquev6/PyGithub","has_wiki":false,"has_issues":true,"updated_at":"2012-05-27T08:50:04Z","forks":3,"mirror_url":null,"homepage":"http://vincent-jacques.net/PyGithub","ssh_url":"git@github.com:jacquev6/PyGithub.git","open_issues":17,"fork":false,"svn_url":"https://github.com/jacquev6/PyGithub","pushed_at":"2012-05-27T07:29:24Z","size":308,"html_url":"https://github.com/jacquev6/PyGithub","private":false,"url":"https://api.github.com/repos/jacquev6/PyGithub","clone_url":"https://github.com/jacquev6/PyGithub.git","owner":{"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},"name":"PyGithub","has_downloads":true,"language":"Python","watchers":15,"git_url":"git://github.com/jacquev6/PyGithub.git","id":3544490,"created_at":"2012-02-25T12:53:47Z"},"label":"jacquev6:topic/RewriteWithGeneratedCode","sha":"ed866fc43833802ab553e5ff8581c81bb00dd433","ref":"topic/RewriteWithGeneratedCode"},"created_at":"2012-05-27T09:25:36Z","patch_url":"https://github.com/jacquev6/PyGithub/pull/31.patch"} diff --git a/test/ReplayData/PullRequest.testEditWithoutArguments.txt b/github/tests/ReplayData/PullRequest.testEditWithoutArguments.txt similarity index 98% rename from test/ReplayData/PullRequest.testEditWithoutArguments.txt rename to github/tests/ReplayData/PullRequest.testEditWithoutArguments.txt index 7e57f5d2..9ae82813 100644 --- a/test/ReplayData/PullRequest.testEditWithoutArguments.txt +++ b/github/tests/ReplayData/PullRequest.testEditWithoutArguments.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /repos/jacquev6/PyGithub/pulls/31 {'Authorization': 'Basic login_and_password_removed'} {} +https PATCH api.github.com None /repos/jacquev6/PyGithub/pulls/31 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4983'), ('content-length', '4486'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"f64654209621a4117940acf5b8ac7918"'), ('date', 'Sun, 27 May 2012 10:16:02 GMT'), ('content-type', 'application/json; charset=utf-8')] {"merged":false,"mergeable":true,"head":{"ref":"master","label":"BeaverSoftware:master","repo":{"clone_url":"https://github.com/BeaverSoftware/PyGithub.git","has_downloads":true,"watchers":1,"git_url":"git://github.com/BeaverSoftware/PyGithub.git","updated_at":"2012-05-27T09:09:17Z","homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/BeaverSoftware/PyGithub","mirror_url":null,"has_wiki":false,"has_issues":false,"fork":true,"forks":0,"size":176,"private":false,"open_issues":0,"svn_url":"https://github.com/BeaverSoftware/PyGithub","owner":{"url":"https://api.github.com/users/BeaverSoftware","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","id":1424031},"name":"PyGithub","language":"Python","description":"Python library implementing the full Github API v3","ssh_url":"git@github.com:BeaverSoftware/PyGithub.git","pushed_at":"2012-05-27T09:09:17Z","created_at":"2012-05-27T08:50:04Z","id":4460787,"html_url":"https://github.com/BeaverSoftware/PyGithub","full_name":"BeaverSoftware/PyGithub"},"user":{"url":"https://api.github.com/users/BeaverSoftware","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","id":1424031},"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},"updated_at":"2012-05-27T10:16:02Z","issue_url":"https://github.com/jacquev6/PyGithub/issues/31","body":"Body of the pull request","patch_url":"https://github.com/jacquev6/PyGithub/pull/31.patch","diff_url":"https://github.com/jacquev6/PyGithub/pull/31.diff","url":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31","comments":0,"base":{"ref":"topic/RewriteWithGeneratedCode","label":"jacquev6:topic/RewriteWithGeneratedCode","repo":{"clone_url":"https://github.com/jacquev6/PyGithub.git","has_downloads":true,"watchers":15,"git_url":"git://github.com/jacquev6/PyGithub.git","updated_at":"2012-05-27T08:50:04Z","homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","mirror_url":null,"has_wiki":false,"has_issues":true,"fork":false,"forks":3,"size":308,"private":false,"open_issues":17,"svn_url":"https://github.com/jacquev6/PyGithub","owner":{"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},"name":"PyGithub","language":"Python","description":"Python library implementing the full Github API v3","ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-27T07:29:24Z","created_at":"2012-02-25T12:53:47Z","id":3544490,"html_url":"https://github.com/jacquev6/PyGithub","full_name":"jacquev6/PyGithub"},"user":{"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},"sha":"ed866fc43833802ab553e5ff8581c81bb00dd433"},"number":31,"merged_by":null,"closed_at":null,"title":"Pull request created by PyGithub","deletions":384,"merged_at":null,"_links":{"self":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31"},"comments":{"href":"https://api.github.com/repos/jacquev6/PyGithub/issues/31/comments"},"issue":{"href":"https://api.github.com/repos/jacquev6/PyGithub/issues/31"},"html":{"href":"https://github.com/jacquev6/PyGithub/pull/31"},"review_comments":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31/comments"}},"changed_files":45,"additions":511,"created_at":"2012-05-27T09:25:36Z","user":{"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},"state":"open","id":1436215,"review_comments":1,"commits":3,"html_url":"https://github.com/jacquev6/PyGithub/pull/31"} diff --git a/test/ReplayData/PullRequest.testGetComments.txt b/github/tests/ReplayData/PullRequest.testGetComments.txt similarity index 100% rename from test/ReplayData/PullRequest.testGetComments.txt rename to github/tests/ReplayData/PullRequest.testGetComments.txt diff --git a/test/ReplayData/PullRequest.testGetCommits.txt b/github/tests/ReplayData/PullRequest.testGetCommits.txt similarity index 100% rename from test/ReplayData/PullRequest.testGetCommits.txt rename to github/tests/ReplayData/PullRequest.testGetCommits.txt diff --git a/test/ReplayData/PullRequest.testGetFiles.txt b/github/tests/ReplayData/PullRequest.testGetFiles.txt similarity index 96% rename from test/ReplayData/PullRequest.testGetFiles.txt rename to github/tests/ReplayData/PullRequest.testGetFiles.txt index 161cce04..79092db2 100644 --- a/test/ReplayData/PullRequest.testGetFiles.txt +++ b/github/tests/ReplayData/PullRequest.testGetFiles.txt @@ -1,5 +1,5 @@ https GET api.github.com None /repos/jacquev6/PyGithub/pulls/31/files {'Authorization': 'Basic login_and_password_removed'} null 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4971'), ('content-length', '169480'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"a6f83dd38ea0a62d423fefb7b8353561"'), ('date', 'Sun, 27 May 2012 10:21:15 GMT'), ('content-type', 'application/json; charset=utf-8')] -[{"patch":"@@ -70,7 +70,7 @@ def __useAttributes( self, attributes ):\n \n # @toto No need to check if attribute is in attributes when attribute is mandatory\n {% for attribute in class.attributes|dictsort:\"name\" %}\n- if \"{{ attribute.name }}\" in attributes and attributes[ \"{{ attribute.name }}\" ] is not None:\n+ if \"{{ attribute.name }}\" in attributes and attributes[ \"{{ attribute.name }}\" ] is not None: # pragma no branch\n \n {% if attribute.type.cardinality == \"scalar\" %}\n {% if attribute.type.simple %}","status":"modified","deletions":1,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/codegen/templates/GithubObject.py","changes":2,"additions":1,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/codegen/templates/GithubObject.py","filename":"codegen/templates/GithubObject.py"},{"patch":"@@ -568,78 +568,78 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"avatar_url\", \"bio\", \"blog\", \"collaborators\", \"company\", \"created_at\", \"disk_usage\", \"email\", \"followers\", \"following\", \"gravatar_id\", \"hireable\", \"html_url\", \"id\", \"location\", \"login\", \"name\", \"owned_private_repos\", \"plan\", \"private_gists\", \"public_gists\", \"public_repos\", \"total_private_repos\", \"type\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"avatar_url\" in attributes and attributes[ \"avatar_url\" ] is not None:\n+ if \"avatar_url\" in attributes and attributes[ \"avatar_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"avatar_url\" ], ( str, unicode ) )\n self.__avatar_url = attributes[ \"avatar_url\" ]\n- if \"bio\" in attributes and attributes[ \"bio\" ] is not None:\n+ if \"bio\" in attributes and attributes[ \"bio\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"bio\" ], ( str, unicode ) )\n self.__bio = attributes[ \"bio\" ]\n- if \"blog\" in attributes and attributes[ \"blog\" ] is not None:\n+ if \"blog\" in attributes and attributes[ \"blog\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"blog\" ], ( str, unicode ) )\n self.__blog = attributes[ \"blog\" ]\n- if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None:\n+ if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"collaborators\" ], int )\n self.__collaborators = attributes[ \"collaborators\" ]\n- if \"company\" in attributes and attributes[ \"company\" ] is not None:\n+ if \"company\" in attributes and attributes[ \"company\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"company\" ], ( str, unicode ) )\n self.__company = attributes[ \"company\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"disk_usage\" in attributes and attributes[ \"disk_usage\" ] is not None:\n+ if \"disk_usage\" in attributes and attributes[ \"disk_usage\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"disk_usage\" ], int )\n self.__disk_usage = attributes[ \"disk_usage\" ]\n- if \"email\" in attributes and attributes[ \"email\" ] is not None:\n+ if \"email\" in attributes and attributes[ \"email\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"email\" ], ( str, unicode ) )\n self.__email = attributes[ \"email\" ]\n- if \"followers\" in attributes and attributes[ \"followers\" ] is not None:\n+ if \"followers\" in attributes and attributes[ \"followers\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"followers\" ], int )\n self.__followers = attributes[ \"followers\" ]\n- if \"following\" in attributes and attributes[ \"following\" ] is not None:\n+ if \"following\" in attributes and attributes[ \"following\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"following\" ], int )\n self.__following = attributes[ \"following\" ]\n- if \"gravatar_id\" in attributes and attributes[ \"gravatar_id\" ] is not None:\n+ if \"gravatar_id\" in attributes and attributes[ \"gravatar_id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"gravatar_id\" ], ( str, unicode ) )\n self.__gravatar_id = attributes[ \"gravatar_id\" ]\n- if \"hireable\" in attributes and attributes[ \"hireable\" ] is not None:\n+ if \"hireable\" in attributes and attributes[ \"hireable\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"hireable\" ], bool )\n self.__hireable = attributes[ \"hireable\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"location\" in attributes and attributes[ \"location\" ] is not None:\n+ if \"location\" in attributes and attributes[ \"location\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"location\" ], ( str, unicode ) )\n self.__location = attributes[ \"location\" ]\n- if \"login\" in attributes and attributes[ \"login\" ] is not None:\n+ if \"login\" in attributes and attributes[ \"login\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"login\" ], ( str, unicode ) )\n self.__login = attributes[ \"login\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]\n- if \"owned_private_repos\" in attributes and attributes[ \"owned_private_repos\" ] is not None:\n+ if \"owned_private_repos\" in attributes and attributes[ \"owned_private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"owned_private_repos\" ], int )\n self.__owned_private_repos = attributes[ \"owned_private_repos\" ]\n- if \"plan\" in attributes and attributes[ \"plan\" ] is not None:\n+ if \"plan\" in attributes and attributes[ \"plan\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"plan\" ], dict )\n self.__plan = Plan.Plan( self.__requester, attributes[ \"plan\" ], completion = LazyCompletion )\n- if \"private_gists\" in attributes and attributes[ \"private_gists\" ] is not None:\n+ if \"private_gists\" in attributes and attributes[ \"private_gists\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"private_gists\" ], int )\n self.__private_gists = attributes[ \"private_gists\" ]\n- if \"public_gists\" in attributes and attributes[ \"public_gists\" ] is not None:\n+ if \"public_gists\" in attributes and attributes[ \"public_gists\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public_gists\" ], int )\n self.__public_gists = attributes[ \"public_gists\" ]\n- if \"public_repos\" in attributes and attributes[ \"public_repos\" ] is not None:\n+ if \"public_repos\" in attributes and attributes[ \"public_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public_repos\" ], int )\n self.__public_repos = attributes[ \"public_repos\" ]\n- if \"total_private_repos\" in attributes and attributes[ \"total_private_repos\" ] is not None:\n+ if \"total_private_repos\" in attributes and attributes[ \"total_private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"total_private_repos\" ], int )\n self.__total_private_repos = attributes[ \"total_private_repos\" ]\n- if \"type\" in attributes and attributes[ \"type\" ] is not None:\n+ if \"type\" in attributes and attributes[ \"type\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"type\" ], ( str, unicode ) )\n self.__type = attributes[ \"type\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":25,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/AuthenticatedUser.py","changes":50,"additions":25,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/AuthenticatedUser.py","filename":"src/github/AuthenticatedUser.py"},{"patch":"@@ -117,21 +117,21 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"app\", \"created_at\", \"id\", \"note\", \"note_url\", \"scopes\", \"token\", \"updated_at\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"app\" in attributes and attributes[ \"app\" ] is not None:\n+ if \"app\" in attributes and attributes[ \"app\" ] is not None: # pragma no branch\n self.__app = attributes[ \"app\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"note\" in attributes and attributes[ \"note\" ] is not None:\n+ if \"note\" in attributes and attributes[ \"note\" ] is not None: # pragma no branch\n self.__note = attributes[ \"note\" ]\n- if \"note_url\" in attributes and attributes[ \"note_url\" ] is not None:\n+ if \"note_url\" in attributes and attributes[ \"note_url\" ] is not None: # pragma no branch\n self.__note_url = attributes[ \"note_url\" ]\n- if \"scopes\" in attributes and attributes[ \"scopes\" ] is not None:\n+ if \"scopes\" in attributes and attributes[ \"scopes\" ] is not None: # pragma no branch\n self.__scopes = attributes[ \"scopes\" ]\n- if \"token\" in attributes and attributes[ \"token\" ] is not None:\n+ if \"token\" in attributes and attributes[ \"token\" ] is not None: # pragma no branch\n self.__token = attributes[ \"token\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":9,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Authorization.py","changes":18,"additions":9,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Authorization.py","filename":"src/github/Authorization.py"},{"patch":"@@ -28,9 +28,9 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"commit\", \"name\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"commit\" in attributes and attributes[ \"commit\" ] is not None:\n+ if \"commit\" in attributes and attributes[ \"commit\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"commit\" ], dict )\n self.__commit = Commit.Commit( self.__requester, attributes[ \"commit\" ], completion = LazyCompletion )\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]","status":"modified","deletions":2,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Branch.py","changes":4,"additions":2,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Branch.py","filename":"src/github/Branch.py"},{"patch":"@@ -120,33 +120,33 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"author\", \"commit\", \"committer\", \"files\", \"parents\", \"sha\", \"stats\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"author\" in attributes and attributes[ \"author\" ] is not None:\n+ if \"author\" in attributes and attributes[ \"author\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"author\" ], dict )\n self.__author = NamedUser.NamedUser( self.__requester, attributes[ \"author\" ], completion = LazyCompletion )\n- if \"commit\" in attributes and attributes[ \"commit\" ] is not None:\n+ if \"commit\" in attributes and attributes[ \"commit\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"commit\" ], dict )\n self.__commit = GitCommit.GitCommit( self.__requester, attributes[ \"commit\" ], completion = LazyCompletion )\n- if \"committer\" in attributes and attributes[ \"committer\" ] is not None:\n+ if \"committer\" in attributes and attributes[ \"committer\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"committer\" ], dict )\n self.__committer = NamedUser.NamedUser( self.__requester, attributes[ \"committer\" ], completion = LazyCompletion )\n- if \"files\" in attributes and attributes[ \"files\" ] is not None:\n+ if \"files\" in attributes and attributes[ \"files\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"files\" ], list ) and ( len( attributes[ \"files\" ] ) == 0 or isinstance( attributes[ \"files\" ][ 0 ], dict ) )\n self.__files = [\n CommitFile.CommitFile( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"files\" ]\n ]\n- if \"parents\" in attributes and attributes[ \"parents\" ] is not None:\n+ if \"parents\" in attributes and attributes[ \"parents\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"parents\" ], list ) and ( len( attributes[ \"parents\" ] ) == 0 or isinstance( attributes[ \"parents\" ][ 0 ], dict ) )\n self.__parents = [\n Commit( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"parents\" ]\n ]\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"stats\" in attributes and attributes[ \"stats\" ] is not None:\n+ if \"stats\" in attributes and attributes[ \"stats\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"stats\" ], dict )\n self.__stats = CommitStats.CommitStats( self.__requester, attributes[ \"stats\" ], completion = LazyCompletion )\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":8,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Commit.py","changes":16,"additions":8,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Commit.py","filename":"src/github/Commit.py"},{"patch":"@@ -121,36 +121,36 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"body\", \"commit_id\", \"created_at\", \"html_url\", \"id\", \"line\", \"path\", \"position\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"body\" in attributes and attributes[ \"body\" ] is not None:\n+ if \"body\" in attributes and attributes[ \"body\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"body\" ], ( str, unicode ) )\n self.__body = attributes[ \"body\" ]\n- if \"commit_id\" in attributes and attributes[ \"commit_id\" ] is not None:\n+ if \"commit_id\" in attributes and attributes[ \"commit_id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"commit_id\" ], ( str, unicode ) )\n self.__commit_id = attributes[ \"commit_id\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"line\" in attributes and attributes[ \"line\" ] is not None:\n+ if \"line\" in attributes and attributes[ \"line\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"line\" ], int )\n self.__line = attributes[ \"line\" ]\n- if \"path\" in attributes and attributes[ \"path\" ] is not None:\n+ if \"path\" in attributes and attributes[ \"path\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"path\" ], ( str, unicode ) )\n self.__path = attributes[ \"path\" ]\n- if \"position\" in attributes and attributes[ \"position\" ] is not None:\n+ if \"position\" in attributes and attributes[ \"position\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"position\" ], int )\n self.__position = attributes[ \"position\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"updated_at\" ], ( str, unicode ) )\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","status":"modified","deletions":11,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/CommitComment.py","changes":22,"additions":11,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/CommitComment.py","filename":"src/github/CommitComment.py"},{"patch":"@@ -62,21 +62,21 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"additions\", \"blob_url\", \"changes\", \"deletions\", \"filename\", \"patch\", \"raw_url\", \"sha\", \"status\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"additions\" in attributes and attributes[ \"additions\" ] is not None:\n+ if \"additions\" in attributes and attributes[ \"additions\" ] is not None: # pragma no branch\n self.__additions = attributes[ \"additions\" ]\n- if \"blob_url\" in attributes and attributes[ \"blob_url\" ] is not None:\n+ if \"blob_url\" in attributes and attributes[ \"blob_url\" ] is not None: # pragma no branch\n self.__blob_url = attributes[ \"blob_url\" ]\n- if \"changes\" in attributes and attributes[ \"changes\" ] is not None:\n+ if \"changes\" in attributes and attributes[ \"changes\" ] is not None: # pragma no branch\n self.__changes = attributes[ \"changes\" ]\n- if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None:\n+ if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None: # pragma no branch\n self.__deletions = attributes[ \"deletions\" ]\n- if \"filename\" in attributes and attributes[ \"filename\" ] is not None:\n+ if \"filename\" in attributes and attributes[ \"filename\" ] is not None: # pragma no branch\n self.__filename = attributes[ \"filename\" ]\n- if \"patch\" in attributes and attributes[ \"patch\" ] is not None:\n+ if \"patch\" in attributes and attributes[ \"patch\" ] is not None: # pragma no branch\n self.__patch = attributes[ \"patch\" ]\n- if \"raw_url\" in attributes and attributes[ \"raw_url\" ] is not None:\n+ if \"raw_url\" in attributes and attributes[ \"raw_url\" ] is not None: # pragma no branch\n self.__raw_url = attributes[ \"raw_url\" ]\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n self.__sha = attributes[ \"sha\" ]\n- if \"status\" in attributes and attributes[ \"status\" ] is not None:\n+ if \"status\" in attributes and attributes[ \"status\" ] is not None: # pragma no branch\n self.__status = attributes[ \"status\" ]","status":"modified","deletions":9,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/CommitFile.py","changes":18,"additions":9,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/CommitFile.py","filename":"src/github/CommitFile.py"},{"patch":"@@ -32,12 +32,12 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"additions\", \"deletions\", \"total\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"additions\" in attributes and attributes[ \"additions\" ] is not None:\n+ if \"additions\" in attributes and attributes[ \"additions\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"additions\" ], int )\n self.__additions = attributes[ \"additions\" ]\n- if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None:\n+ if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"deletions\" ], int )\n self.__deletions = attributes[ \"deletions\" ]\n- if \"total\" in attributes and attributes[ \"total\" ] is not None:\n+ if \"total\" in attributes and attributes[ \"total\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"total\" ], int )\n self.__total = attributes[ \"total\" ]","status":"modified","deletions":3,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/CommitStats.py","changes":6,"additions":3,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/CommitStats.py","filename":"src/github/CommitStats.py"},{"patch":"@@ -162,43 +162,43 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"accesskeyid\", \"acl\", \"bucket\", \"content_type\", \"created_at\", \"description\", \"download_count\", \"expirationdate\", \"html_url\", \"id\", \"mime_type\", \"name\", \"path\", \"policy\", \"prefix\", \"redirect\", \"s3_url\", \"signature\", \"size\", \"url\", \"x-amz-meta-content-disposition\" ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"accesskeyid\" in attributes and attributes[ \"accesskeyid\" ] is not None:\n+ if \"accesskeyid\" in attributes and attributes[ \"accesskeyid\" ] is not None: # pragma no branch\n self.__accesskeyid = attributes[ \"accesskeyid\" ]\n- if \"acl\" in attributes and attributes[ \"acl\" ] is not None:\n+ if \"acl\" in attributes and attributes[ \"acl\" ] is not None: # pragma no branch\n self.__acl = attributes[ \"acl\" ]\n- if \"bucket\" in attributes and attributes[ \"bucket\" ] is not None:\n+ if \"bucket\" in attributes and attributes[ \"bucket\" ] is not None: # pragma no branch\n self.__bucket = attributes[ \"bucket\" ]\n- if \"content_type\" in attributes and attributes[ \"content_type\" ] is not None:\n+ if \"content_type\" in attributes and attributes[ \"content_type\" ] is not None: # pragma no branch\n self.__content_type = attributes[ \"content_type\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"description\" in attributes and attributes[ \"description\" ] is not None:\n+ if \"description\" in attributes and attributes[ \"description\" ] is not None: # pragma no branch\n self.__description = attributes[ \"description\" ]\n- if \"download_count\" in attributes and attributes[ \"download_count\" ] is not None:\n+ if \"download_count\" in attributes and attributes[ \"download_count\" ] is not None: # pragma no branch\n self.__download_count = attributes[ \"download_count\" ]\n- if \"expirationdate\" in attributes and attributes[ \"expirationdate\" ] is not None:\n+ if \"expirationdate\" in attributes and attributes[ \"expirationdate\" ] is not None: # pragma no branch\n self.__expirationdate = attributes[ \"expirationdate\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"mime_type\" in attributes and attributes[ \"mime_type\" ] is not None:\n+ if \"mime_type\" in attributes and attributes[ \"mime_type\" ] is not None: # pragma no branch\n self.__mime_type = attributes[ \"mime_type\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n self.__name = attributes[ \"name\" ]\n- if \"path\" in attributes and attributes[ \"path\" ] is not None:\n+ if \"path\" in attributes and attributes[ \"path\" ] is not None: # pragma no branch\n self.__path = attributes[ \"path\" ]\n- if \"policy\" in attributes and attributes[ \"policy\" ] is not None:\n+ if \"policy\" in attributes and attributes[ \"policy\" ] is not None: # pragma no branch\n self.__policy = attributes[ \"policy\" ]\n- if \"prefix\" in attributes and attributes[ \"prefix\" ] is not None:\n+ if \"prefix\" in attributes and attributes[ \"prefix\" ] is not None: # pragma no branch\n self.__prefix = attributes[ \"prefix\" ]\n- if \"redirect\" in attributes and attributes[ \"redirect\" ] is not None:\n+ if \"redirect\" in attributes and attributes[ \"redirect\" ] is not None: # pragma no branch\n self.__redirect = attributes[ \"redirect\" ]\n- if \"s3_url\" in attributes and attributes[ \"s3_url\" ] is not None:\n+ if \"s3_url\" in attributes and attributes[ \"s3_url\" ] is not None: # pragma no branch\n self.__s3_url = attributes[ \"s3_url\" ]\n- if \"signature\" in attributes and attributes[ \"signature\" ] is not None:\n+ if \"signature\" in attributes and attributes[ \"signature\" ] is not None: # pragma no branch\n self.__signature = attributes[ \"signature\" ]\n- if \"size\" in attributes and attributes[ \"size\" ] is not None:\n+ if \"size\" in attributes and attributes[ \"size\" ] is not None: # pragma no branch\n self.__size = attributes[ \"size\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":20,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Download.py","changes":40,"additions":20,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Download.py","filename":"src/github/Download.py"},{"patch":"@@ -60,22 +60,22 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"actor\", \"created_at\", \"id\", \"org\", \"payload\", \"public\", \"repo\", \"type\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"actor\" in attributes and attributes[ \"actor\" ] is not None:\n+ if \"actor\" in attributes and attributes[ \"actor\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"actor\" ], dict )\n self.__actor = NamedUser.NamedUser( self.__requester, attributes[ \"actor\" ], completion = LazyCompletion )\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"org\" in attributes and attributes[ \"org\" ] is not None:\n+ if \"org\" in attributes and attributes[ \"org\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"org\" ], dict )\n self.__org = Organization.Organization( self.__requester, attributes[ \"org\" ], completion = LazyCompletion )\n- if \"payload\" in attributes and attributes[ \"payload\" ] is not None:\n+ if \"payload\" in attributes and attributes[ \"payload\" ] is not None: # pragma no branch\n self.__payload = attributes[ \"payload\" ]\n- if \"public\" in attributes and attributes[ \"public\" ] is not None:\n+ if \"public\" in attributes and attributes[ \"public\" ] is not None: # pragma no branch\n self.__public = attributes[ \"public\" ]\n- if \"repo\" in attributes and attributes[ \"repo\" ] is not None:\n+ if \"repo\" in attributes and attributes[ \"repo\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"repo\" ], dict )\n self.__repo = Repository.Repository( self.__requester, attributes[ \"repo\" ], completion = LazyCompletion )\n- if \"type\" in attributes and attributes[ \"type\" ] is not None:\n+ if \"type\" in attributes and attributes[ \"type\" ] is not None: # pragma no branch\n self.__type = attributes[ \"type\" ]","status":"modified","deletions":8,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Event.py","changes":16,"additions":8,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Event.py","filename":"src/github/Event.py"},{"patch":"@@ -220,53 +220,53 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"comments\", \"created_at\", \"description\", \"files\", \"fork_of\", \"forks\", \"git_pull_url\", \"git_push_url\", \"history\", \"html_url\", \"id\", \"public\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"comments\" in attributes and attributes[ \"comments\" ] is not None:\n+ if \"comments\" in attributes and attributes[ \"comments\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"comments\" ], int )\n self.__comments = attributes[ \"comments\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"description\" in attributes and attributes[ \"description\" ] is not None:\n+ if \"description\" in attributes and attributes[ \"description\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"description\" ], ( str, unicode ) )\n self.__description = attributes[ \"description\" ]\n- if \"files\" in attributes and attributes[ \"files\" ] is not None:\n+ if \"files\" in attributes and attributes[ \"files\" ] is not None: # pragma no branch\n self.__files = attributes[ \"files\" ]\n- if \"fork_of\" in attributes and attributes[ \"fork_of\" ] is not None:\n+ if \"fork_of\" in attributes and attributes[ \"fork_of\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"fork_of\" ], dict )\n self.__fork_of = Gist( self.__requester, attributes[ \"fork_of\" ], completion = LazyCompletion )\n- if \"forks\" in attributes and attributes[ \"forks\" ] is not None:\n+ if \"forks\" in attributes and attributes[ \"forks\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"forks\" ], list ) and ( len( attributes[ \"forks\" ] ) == 0 or isinstance( attributes[ \"forks\" ][ 0 ], dict ) )\n self.__forks = [\n Gist( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"forks\" ]\n ]\n- if \"git_pull_url\" in attributes and attributes[ \"git_pull_url\" ] is not None:\n+ if \"git_pull_url\" in attributes and attributes[ \"git_pull_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"git_pull_url\" ], ( str, unicode ) )\n self.__git_pull_url = attributes[ \"git_pull_url\" ]\n- if \"git_push_url\" in attributes and attributes[ \"git_push_url\" ] is not None:\n+ if \"git_push_url\" in attributes and attributes[ \"git_push_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"git_push_url\" ], ( str, unicode ) )\n self.__git_push_url = attributes[ \"git_push_url\" ]\n- if \"history\" in attributes and attributes[ \"history\" ] is not None:\n+ if \"history\" in attributes and attributes[ \"history\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"history\" ], list ) and ( len( attributes[ \"history\" ] ) == 0 or isinstance( attributes[ \"history\" ][ 0 ], dict ) )\n self.__history = [\n GistHistoryState.GistHistoryState( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"history\" ]\n ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], ( str, unicode ) )\n self.__id = attributes[ \"id\" ]\n- if \"public\" in attributes and attributes[ \"public\" ] is not None:\n+ if \"public\" in attributes and attributes[ \"public\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public\" ], bool )\n self.__public = attributes[ \"public\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"updated_at\" ], ( str, unicode ) )\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","status":"modified","deletions":15,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Gist.py","changes":30,"additions":15,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Gist.py","filename":"src/github/Gist.py"},{"patch":"@@ -68,16 +68,16 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"body\", \"created_at\", \"id\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"body\" in attributes and attributes[ \"body\" ] is not None:\n+ if \"body\" in attributes and attributes[ \"body\" ] is not None: # pragma no branch\n self.__body = attributes[ \"body\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","status":"modified","deletions":6,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GistComment.py","changes":12,"additions":6,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GistComment.py","filename":"src/github/GistComment.py"},{"patch":"@@ -44,18 +44,18 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"change_status\", \"committed_at\", \"url\", \"user\", \"version\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"change_status\" in attributes and attributes[ \"change_status\" ] is not None:\n+ if \"change_status\" in attributes and attributes[ \"change_status\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"change_status\" ], dict )\n self.__change_status = CommitStats.CommitStats( self.__requester, attributes[ \"change_status\" ], completion = LazyCompletion )\n- if \"committed_at\" in attributes and attributes[ \"committed_at\" ] is not None:\n+ if \"committed_at\" in attributes and attributes[ \"committed_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"committed_at\" ], ( str, unicode ) )\n self.__committed_at = attributes[ \"committed_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )\n- if \"version\" in attributes and attributes[ \"version\" ] is not None:\n+ if \"version\" in attributes and attributes[ \"version\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"version\" ], ( str, unicode ) )\n self.__version = attributes[ \"version\" ]","status":"modified","deletions":5,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GistHistoryState.py","changes":10,"additions":5,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GistHistoryState.py","filename":"src/github/GistHistoryState.py"},{"patch":"@@ -32,12 +32,12 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"date\", \"email\", \"name\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"date\" in attributes and attributes[ \"date\" ] is not None:\n+ if \"date\" in attributes and attributes[ \"date\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"date\" ], ( str, unicode ) )\n self.__date = attributes[ \"date\" ]\n- if \"email\" in attributes and attributes[ \"email\" ] is not None:\n+ if \"email\" in attributes and attributes[ \"email\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"email\" ], ( str, unicode ) )\n self.__email = attributes[ \"email\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]","status":"modified","deletions":3,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitAuthor.py","changes":6,"additions":3,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitAuthor.py","filename":"src/github/GitAuthor.py"},{"patch":"@@ -42,18 +42,18 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"content\", \"encoding\", \"sha\", \"size\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"content\" in attributes and attributes[ \"content\" ] is not None:\n+ if \"content\" in attributes and attributes[ \"content\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"content\" ], ( str, unicode ) )\n self.__content = attributes[ \"content\" ]\n- if \"encoding\" in attributes and attributes[ \"encoding\" ] is not None:\n+ if \"encoding\" in attributes and attributes[ \"encoding\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"encoding\" ], ( str, unicode ) )\n self.__encoding = attributes[ \"encoding\" ]\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"size\" in attributes and attributes[ \"size\" ] is not None:\n+ if \"size\" in attributes and attributes[ \"size\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"size\" ], int )\n self.__size = attributes[ \"size\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":5,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitBlob.py","changes":10,"additions":5,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitBlob.py","filename":"src/github/GitBlob.py"},{"patch":"@@ -55,27 +55,27 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"author\", \"committer\", \"message\", \"parents\", \"sha\", \"tree\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"author\" in attributes and attributes[ \"author\" ] is not None:\n+ if \"author\" in attributes and attributes[ \"author\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"author\" ], dict )\n self.__author = GitAuthor.GitAuthor( self.__requester, attributes[ \"author\" ], completion = LazyCompletion )\n- if \"committer\" in attributes and attributes[ \"committer\" ] is not None:\n+ if \"committer\" in attributes and attributes[ \"committer\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"committer\" ], dict )\n self.__committer = GitAuthor.GitAuthor( self.__requester, attributes[ \"committer\" ], completion = LazyCompletion )\n- if \"message\" in attributes and attributes[ \"message\" ] is not None:\n+ if \"message\" in attributes and attributes[ \"message\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"message\" ], ( str, unicode ) )\n self.__message = attributes[ \"message\" ]\n- if \"parents\" in attributes and attributes[ \"parents\" ] is not None:\n+ if \"parents\" in attributes and attributes[ \"parents\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"parents\" ], list ) and ( len( attributes[ \"parents\" ] ) == 0 or isinstance( attributes[ \"parents\" ][ 0 ], dict ) )\n self.__parents = [\n GitCommit( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"parents\" ]\n ]\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"tree\" in attributes and attributes[ \"tree\" ] is not None:\n+ if \"tree\" in attributes and attributes[ \"tree\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"tree\" ], dict )\n self.__tree = GitTree.GitTree( self.__requester, attributes[ \"tree\" ], completion = LazyCompletion )\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":7,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitCommit.py","changes":14,"additions":7,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitCommit.py","filename":"src/github/GitCommit.py"},{"patch":"@@ -32,12 +32,12 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"sha\", \"type\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"type\" in attributes and attributes[ \"type\" ] is not None:\n+ if \"type\" in attributes and attributes[ \"type\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"type\" ], ( str, unicode ) )\n self.__type = attributes[ \"type\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":3,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitObject.py","changes":6,"additions":3,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitObject.py","filename":"src/github/GitObject.py"},{"patch":"@@ -55,12 +55,12 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"object\", \"ref\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"object\" in attributes and attributes[ \"object\" ] is not None:\n+ if \"object\" in attributes and attributes[ \"object\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"object\" ], dict )\n self.__object = GitObject.GitObject( self.__requester, attributes[ \"object\" ], completion = LazyCompletion )\n- if \"ref\" in attributes and attributes[ \"ref\" ] is not None:\n+ if \"ref\" in attributes and attributes[ \"ref\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"ref\" ], ( str, unicode ) )\n self.__ref = attributes[ \"ref\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":3,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitRef.py","changes":6,"additions":3,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitRef.py","filename":"src/github/GitRef.py"},{"patch":"@@ -49,21 +49,21 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"message\", \"object\", \"sha\", \"tag\", \"tagger\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"message\" in attributes and attributes[ \"message\" ] is not None:\n+ if \"message\" in attributes and attributes[ \"message\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"message\" ], ( str, unicode ) )\n self.__message = attributes[ \"message\" ]\n- if \"object\" in attributes and attributes[ \"object\" ] is not None:\n+ if \"object\" in attributes and attributes[ \"object\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"object\" ], dict )\n self.__object = GitObject.GitObject( self.__requester, attributes[ \"object\" ], completion = LazyCompletion )\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"tag\" in attributes and attributes[ \"tag\" ] is not None:\n+ if \"tag\" in attributes and attributes[ \"tag\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"tag\" ], ( str, unicode ) )\n self.__tag = attributes[ \"tag\" ]\n- if \"tagger\" in attributes and attributes[ \"tagger\" ] is not None:\n+ if \"tagger\" in attributes and attributes[ \"tagger\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"tagger\" ], dict )\n self.__tagger = GitAuthor.GitAuthor( self.__requester, attributes[ \"tagger\" ], completion = LazyCompletion )\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":6,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitTag.py","changes":12,"additions":6,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitTag.py","filename":"src/github/GitTag.py"},{"patch":"@@ -33,15 +33,15 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"sha\", \"tree\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"tree\" in attributes and attributes[ \"tree\" ] is not None:\n+ if \"tree\" in attributes and attributes[ \"tree\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"tree\" ], list ) and ( len( attributes[ \"tree\" ] ) == 0 or isinstance( attributes[ \"tree\" ][ 0 ], dict ) )\n self.__tree = [\n GitTreeElement.GitTreeElement( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"tree\" ]\n ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":3,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitTree.py","changes":6,"additions":3,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitTree.py","filename":"src/github/GitTree.py"},{"patch":"@@ -47,21 +47,21 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"mode\", \"path\", \"sha\", \"size\", \"type\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"mode\" in attributes and attributes[ \"mode\" ] is not None:\n+ if \"mode\" in attributes and attributes[ \"mode\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"mode\" ], ( str, unicode ) )\n self.__mode = attributes[ \"mode\" ]\n- if \"path\" in attributes and attributes[ \"path\" ] is not None:\n+ if \"path\" in attributes and attributes[ \"path\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"path\" ], ( str, unicode ) )\n self.__path = attributes[ \"path\" ]\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"size\" in attributes and attributes[ \"size\" ] is not None:\n+ if \"size\" in attributes and attributes[ \"size\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"size\" ], int )\n self.__size = attributes[ \"size\" ]\n- if \"type\" in attributes and attributes[ \"type\" ] is not None:\n+ if \"type\" in attributes and attributes[ \"type\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"type\" ], ( str, unicode ) )\n self.__type = attributes[ \"type\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":6,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitTreeElement.py","changes":12,"additions":6,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitTreeElement.py","filename":"src/github/GitTreeElement.py"},{"patch":"@@ -99,21 +99,21 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"active\", \"config\", \"created_at\", \"events\", \"id\", \"last_response\", \"name\", \"updated_at\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"active\" in attributes and attributes[ \"active\" ] is not None:\n+ if \"active\" in attributes and attributes[ \"active\" ] is not None: # pragma no branch\n self.__active = attributes[ \"active\" ]\n- if \"config\" in attributes and attributes[ \"config\" ] is not None:\n+ if \"config\" in attributes and attributes[ \"config\" ] is not None: # pragma no branch\n self.__config = attributes[ \"config\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"events\" in attributes and attributes[ \"events\" ] is not None:\n+ if \"events\" in attributes and attributes[ \"events\" ] is not None: # pragma no branch\n self.__events = attributes[ \"events\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"last_response\" in attributes and attributes[ \"last_response\" ] is not None:\n+ if \"last_response\" in attributes and attributes[ \"last_response\" ] is not None: # pragma no branch\n self.__last_response = attributes[ \"last_response\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n self.__name = attributes[ \"name\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":9,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Hook.py","changes":18,"additions":9,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Hook.py","filename":"src/github/Hook.py"},{"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\n@@ -257,59 +268,59 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"assignee\", \"body\", \"closed_at\", \"closed_by\", \"comments\", \"created_at\", \"html_url\", \"id\", \"labels\", \"milestone\", \"number\", \"pull_request\", \"repository\", \"state\", \"title\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"assignee\" in attributes and attributes[ \"assignee\" ] is not None:\n+ if \"assignee\" in attributes and attributes[ \"assignee\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"assignee\" ], dict )\n self.__assignee = NamedUser.NamedUser( self.__requester, attributes[ \"assignee\" ], completion = LazyCompletion )\n- if \"body\" in attributes and attributes[ \"body\" ] is not None:\n+ if \"body\" in attributes and attributes[ \"body\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"body\" ], ( str, unicode ) )\n self.__body = attributes[ \"body\" ]\n- if \"closed_at\" in attributes and attributes[ \"closed_at\" ] is not None:\n+ if \"closed_at\" in attributes and attributes[ \"closed_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"closed_at\" ], ( str, unicode ) )\n self.__closed_at = attributes[ \"closed_at\" ]\n- if \"closed_by\" in attributes and attributes[ \"closed_by\" ] is not None:\n+ if \"closed_by\" in attributes and attributes[ \"closed_by\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"closed_by\" ], dict )\n self.__closed_by = NamedUser.NamedUser( self.__requester, attributes[ \"closed_by\" ], completion = LazyCompletion )\n- if \"comments\" in attributes and attributes[ \"comments\" ] is not None:\n+ if \"comments\" in attributes and attributes[ \"comments\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"comments\" ], int )\n self.__comments = attributes[ \"comments\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"labels\" in attributes and attributes[ \"labels\" ] is not None:\n+ if \"labels\" in attributes and attributes[ \"labels\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"labels\" ], list ) and ( len( attributes[ \"labels\" ] ) == 0 or isinstance( attributes[ \"labels\" ][ 0 ], dict ) )\n self.__labels = [\n Label.Label( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"labels\" ]\n ]\n- if \"milestone\" in attributes and attributes[ \"milestone\" ] is not None:\n+ if \"milestone\" in attributes and attributes[ \"milestone\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"milestone\" ], dict )\n self.__milestone = Milestone.Milestone( self.__requester, attributes[ \"milestone\" ], completion = LazyCompletion )\n- if \"number\" in attributes and attributes[ \"number\" ] is not None:\n+ if \"number\" in attributes and attributes[ \"number\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"number\" ], int )\n self.__number = attributes[ \"number\" ]\n- if \"pull_request\" in attributes and attributes[ \"pull_request\" ] is not None:\n+ if \"pull_request\" in attributes and attributes[ \"pull_request\" ] is not None: # pragma no branch\n self.__pull_request = attributes[ \"pull_request\" ]\n- if \"repository\" in attributes and attributes[ \"repository\" ] is not None:\n+ if \"repository\" in attributes and attributes[ \"repository\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"repository\" ], dict )\n self.__repository = Repository.Repository( self.__requester, attributes[ \"repository\" ], completion = LazyCompletion )\n- if \"state\" in attributes and attributes[ \"state\" ] is not None:\n+ if \"state\" in attributes and attributes[ \"state\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"state\" ], ( str, unicode ) )\n self.__state = attributes[ \"state\" ]\n- if \"title\" in attributes and attributes[ \"title\" ] is not None:\n+ if \"title\" in attributes and attributes[ \"title\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"title\" ], ( str, unicode ) )\n self.__title = attributes[ \"title\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"updated_at\" ], ( str, unicode ) )\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","status":"modified","deletions":21,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Issue.py","changes":53,"additions":32,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Issue.py","filename":"src/github/Issue.py"},{"patch":"@@ -68,16 +68,16 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"body\", \"created_at\", \"id\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"body\" in attributes and attributes[ \"body\" ] is not None:\n+ if \"body\" in attributes and attributes[ \"body\" ] is not None: # pragma no branch\n self.__body = attributes[ \"body\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","status":"modified","deletions":6,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/IssueComment.py","changes":12,"additions":6,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/IssueComment.py","filename":"src/github/IssueComment.py"},{"patch":"@@ -78,24 +78,24 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"actor\", \"commit_id\", \"created_at\", \"event\", \"id\", \"issue\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"actor\" in attributes and attributes[ \"actor\" ] is not None:\n+ if \"actor\" in attributes and attributes[ \"actor\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"actor\" ], dict )\n self.__actor = NamedUser.NamedUser( self.__requester, attributes[ \"actor\" ], completion = LazyCompletion )\n- if \"commit_id\" in attributes and attributes[ \"commit_id\" ] is not None:\n+ if \"commit_id\" in attributes and attributes[ \"commit_id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"commit_id\" ], ( str, unicode ) )\n self.__commit_id = attributes[ \"commit_id\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"event\" in attributes and attributes[ \"event\" ] is not None:\n+ if \"event\" in attributes and attributes[ \"event\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"event\" ], ( str, unicode ) )\n self.__event = attributes[ \"event\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"issue\" in attributes and attributes[ \"issue\" ] is not None:\n+ if \"issue\" in attributes and attributes[ \"issue\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"issue\" ], dict )\n self.__issue = Issue.Issue( self.__requester, attributes[ \"issue\" ], completion = LazyCompletion )\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":7,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/IssueEvent.py","changes":14,"additions":7,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/IssueEvent.py","filename":"src/github/IssueEvent.py"},{"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+ # @toto 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\n@@ -53,9 +60,9 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"color\", \"name\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"color\" in attributes and attributes[ \"color\" ] is not None:\n+ if \"color\" in attributes and attributes[ \"color\" ] is not None: # pragma no branch\n self.__color = attributes[ \"color\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n self.__name = attributes[ \"name\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":3,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Label.py","changes":13,"additions":10,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Label.py","filename":"src/github/Label.py"},{"patch":"@@ -114,36 +114,36 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"closed_issues\", \"created_at\", \"creator\", \"description\", \"due_on\", \"id\", \"number\", \"open_issues\", \"state\", \"title\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"closed_issues\" in attributes and attributes[ \"closed_issues\" ] is not None:\n+ if \"closed_issues\" in attributes and attributes[ \"closed_issues\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"closed_issues\" ], int )\n self.__closed_issues = attributes[ \"closed_issues\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"creator\" in attributes and attributes[ \"creator\" ] is not None:\n+ if \"creator\" in attributes and attributes[ \"creator\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"creator\" ], dict )\n self.__creator = NamedUser.NamedUser( self.__requester, attributes[ \"creator\" ], completion = LazyCompletion )\n- if \"description\" in attributes and attributes[ \"description\" ] is not None:\n+ if \"description\" in attributes and attributes[ \"description\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"description\" ], ( str, unicode ) )\n self.__description = attributes[ \"description\" ]\n- if \"due_on\" in attributes and attributes[ \"due_on\" ] is not None:\n+ if \"due_on\" in attributes and attributes[ \"due_on\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"due_on\" ], ( str, unicode ) )\n self.__due_on = attributes[ \"due_on\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"number\" in attributes and attributes[ \"number\" ] is not None:\n+ if \"number\" in attributes and attributes[ \"number\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"number\" ], int )\n self.__number = attributes[ \"number\" ]\n- if \"open_issues\" in attributes and attributes[ \"open_issues\" ] is not None:\n+ if \"open_issues\" in attributes and attributes[ \"open_issues\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"open_issues\" ], int )\n self.__open_issues = attributes[ \"open_issues\" ]\n- if \"state\" in attributes and attributes[ \"state\" ] is not None:\n+ if \"state\" in attributes and attributes[ \"state\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"state\" ], ( str, unicode ) )\n self.__state = attributes[ \"state\" ]\n- if \"title\" in attributes and attributes[ \"title\" ] is not None:\n+ if \"title\" in attributes and attributes[ \"title\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"title\" ], ( str, unicode ) )\n self.__title = attributes[ \"title\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":11,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Milestone.py","changes":22,"additions":11,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Milestone.py","filename":"src/github/Milestone.py"},{"patch":"@@ -365,81 +365,81 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"avatar_url\", \"bio\", \"blog\", \"collaborators\", \"company\", \"contributions\", \"created_at\", \"disk_usage\", \"email\", \"followers\", \"following\", \"gravatar_id\", \"hireable\", \"html_url\", \"id\", \"location\", \"login\", \"name\", \"owned_private_repos\", \"plan\", \"private_gists\", \"public_gists\", \"public_repos\", \"total_private_repos\", \"type\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"avatar_url\" in attributes and attributes[ \"avatar_url\" ] is not None:\n+ if \"avatar_url\" in attributes and attributes[ \"avatar_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"avatar_url\" ], ( str, unicode ) )\n self.__avatar_url = attributes[ \"avatar_url\" ]\n- if \"bio\" in attributes and attributes[ \"bio\" ] is not None:\n+ if \"bio\" in attributes and attributes[ \"bio\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"bio\" ], ( str, unicode ) )\n self.__bio = attributes[ \"bio\" ]\n- if \"blog\" in attributes and attributes[ \"blog\" ] is not None:\n+ if \"blog\" in attributes and attributes[ \"blog\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"blog\" ], ( str, unicode ) )\n self.__blog = attributes[ \"blog\" ]\n- if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None:\n+ if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"collaborators\" ], int )\n self.__collaborators = attributes[ \"collaborators\" ]\n- if \"company\" in attributes and attributes[ \"company\" ] is not None:\n+ if \"company\" in attributes and attributes[ \"company\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"company\" ], ( str, unicode ) )\n self.__company = attributes[ \"company\" ]\n- if \"contributions\" in attributes and attributes[ \"contributions\" ] is not None:\n+ if \"contributions\" in attributes and attributes[ \"contributions\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"contributions\" ], int )\n self.__contributions = attributes[ \"contributions\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"disk_usage\" in attributes and attributes[ \"disk_usage\" ] is not None:\n+ if \"disk_usage\" in attributes and attributes[ \"disk_usage\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"disk_usage\" ], int )\n self.__disk_usage = attributes[ \"disk_usage\" ]\n- if \"email\" in attributes and attributes[ \"email\" ] is not None:\n+ if \"email\" in attributes and attributes[ \"email\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"email\" ], ( str, unicode ) )\n self.__email = attributes[ \"email\" ]\n- if \"followers\" in attributes and attributes[ \"followers\" ] is not None:\n+ if \"followers\" in attributes and attributes[ \"followers\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"followers\" ], int )\n self.__followers = attributes[ \"followers\" ]\n- if \"following\" in attributes and attributes[ \"following\" ] is not None:\n+ if \"following\" in attributes and attributes[ \"following\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"following\" ], int )\n self.__following = attributes[ \"following\" ]\n- if \"gravatar_id\" in attributes and attributes[ \"gravatar_id\" ] is not None:\n+ if \"gravatar_id\" in attributes and attributes[ \"gravatar_id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"gravatar_id\" ], ( str, unicode ) )\n self.__gravatar_id = attributes[ \"gravatar_id\" ]\n- if \"hireable\" in attributes and attributes[ \"hireable\" ] is not None:\n+ if \"hireable\" in attributes and attributes[ \"hireable\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"hireable\" ], bool )\n self.__hireable = attributes[ \"hireable\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"location\" in attributes and attributes[ \"location\" ] is not None:\n+ if \"location\" in attributes and attributes[ \"location\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"location\" ], ( str, unicode ) )\n self.__location = attributes[ \"location\" ]\n- if \"login\" in attributes and attributes[ \"login\" ] is not None:\n+ if \"login\" in attributes and attributes[ \"login\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"login\" ], ( str, unicode ) )\n self.__login = attributes[ \"login\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]\n- if \"owned_private_repos\" in attributes and attributes[ \"owned_private_repos\" ] is not None:\n+ if \"owned_private_repos\" in attributes and attributes[ \"owned_private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"owned_private_repos\" ], int )\n self.__owned_private_repos = attributes[ \"owned_private_repos\" ]\n- if \"plan\" in attributes and attributes[ \"plan\" ] is not None:\n+ if \"plan\" in attributes and attributes[ \"plan\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"plan\" ], dict )\n self.__plan = Plan.Plan( self.__requester, attributes[ \"plan\" ], completion = LazyCompletion )\n- if \"private_gists\" in attributes and attributes[ \"private_gists\" ] is not None:\n+ if \"private_gists\" in attributes and attributes[ \"private_gists\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"private_gists\" ], int )\n self.__private_gists = attributes[ \"private_gists\" ]\n- if \"public_gists\" in attributes and attributes[ \"public_gists\" ] is not None:\n+ if \"public_gists\" in attributes and attributes[ \"public_gists\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public_gists\" ], int )\n self.__public_gists = attributes[ \"public_gists\" ]\n- if \"public_repos\" in attributes and attributes[ \"public_repos\" ] is not None:\n+ if \"public_repos\" in attributes and attributes[ \"public_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public_repos\" ], int )\n self.__public_repos = attributes[ \"public_repos\" ]\n- if \"total_private_repos\" in attributes and attributes[ \"total_private_repos\" ] is not None:\n+ if \"total_private_repos\" in attributes and attributes[ \"total_private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"total_private_repos\" ], int )\n self.__total_private_repos = attributes[ \"total_private_repos\" ]\n- if \"type\" in attributes and attributes[ \"type\" ] is not None:\n+ if \"type\" in attributes and attributes[ \"type\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"type\" ], ( str, unicode ) )\n self.__type = attributes[ \"type\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":26,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/NamedUser.py","changes":52,"additions":26,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/NamedUser.py","filename":"src/github/NamedUser.py"},{"patch":"@@ -390,75 +390,75 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"avatar_url\", \"billing_email\", \"blog\", \"collaborators\", \"company\", \"created_at\", \"disk_usage\", \"email\", \"followers\", \"following\", \"gravatar_id\", \"html_url\", \"id\", \"location\", \"login\", \"name\", \"owned_private_repos\", \"plan\", \"private_gists\", \"public_gists\", \"public_repos\", \"total_private_repos\", \"type\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"avatar_url\" in attributes and attributes[ \"avatar_url\" ] is not None:\n+ if \"avatar_url\" in attributes and attributes[ \"avatar_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"avatar_url\" ], ( str, unicode ) )\n self.__avatar_url = attributes[ \"avatar_url\" ]\n- if \"billing_email\" in attributes and attributes[ \"billing_email\" ] is not None:\n+ if \"billing_email\" in attributes and attributes[ \"billing_email\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"billing_email\" ], ( str, unicode ) )\n self.__billing_email = attributes[ \"billing_email\" ]\n- if \"blog\" in attributes and attributes[ \"blog\" ] is not None:\n+ if \"blog\" in attributes and attributes[ \"blog\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"blog\" ], ( str, unicode ) )\n self.__blog = attributes[ \"blog\" ]\n- if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None:\n+ if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"collaborators\" ], int )\n self.__collaborators = attributes[ \"collaborators\" ]\n- if \"company\" in attributes and attributes[ \"company\" ] is not None:\n+ if \"company\" in attributes and attributes[ \"company\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"company\" ], ( str, unicode ) )\n self.__company = attributes[ \"company\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"disk_usage\" in attributes and attributes[ \"disk_usage\" ] is not None:\n+ if \"disk_usage\" in attributes and attributes[ \"disk_usage\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"disk_usage\" ], int )\n self.__disk_usage = attributes[ \"disk_usage\" ]\n- if \"email\" in attributes and attributes[ \"email\" ] is not None:\n+ if \"email\" in attributes and attributes[ \"email\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"email\" ], ( str, unicode ) )\n self.__email = attributes[ \"email\" ]\n- if \"followers\" in attributes and attributes[ \"followers\" ] is not None:\n+ if \"followers\" in attributes and attributes[ \"followers\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"followers\" ], int )\n self.__followers = attributes[ \"followers\" ]\n- if \"following\" in attributes and attributes[ \"following\" ] is not None:\n+ if \"following\" in attributes and attributes[ \"following\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"following\" ], int )\n self.__following = attributes[ \"following\" ]\n- if \"gravatar_id\" in attributes and attributes[ \"gravatar_id\" ] is not None:\n+ if \"gravatar_id\" in attributes and attributes[ \"gravatar_id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"gravatar_id\" ], ( str, unicode ) )\n self.__gravatar_id = attributes[ \"gravatar_id\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"location\" in attributes and attributes[ \"location\" ] is not None:\n+ if \"location\" in attributes and attributes[ \"location\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"location\" ], ( str, unicode ) )\n self.__location = attributes[ \"location\" ]\n- if \"login\" in attributes and attributes[ \"login\" ] is not None:\n+ if \"login\" in attributes and attributes[ \"login\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"login\" ], ( str, unicode ) )\n self.__login = attributes[ \"login\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]\n- if \"owned_private_repos\" in attributes and attributes[ \"owned_private_repos\" ] is not None:\n+ if \"owned_private_repos\" in attributes and attributes[ \"owned_private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"owned_private_repos\" ], int )\n self.__owned_private_repos = attributes[ \"owned_private_repos\" ]\n- if \"plan\" in attributes and attributes[ \"plan\" ] is not None:\n+ if \"plan\" in attributes and attributes[ \"plan\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"plan\" ], dict )\n self.__plan = Plan.Plan( self.__requester, attributes[ \"plan\" ], completion = LazyCompletion )\n- if \"private_gists\" in attributes and attributes[ \"private_gists\" ] is not None:\n+ if \"private_gists\" in attributes and attributes[ \"private_gists\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"private_gists\" ], int )\n self.__private_gists = attributes[ \"private_gists\" ]\n- if \"public_gists\" in attributes and attributes[ \"public_gists\" ] is not None:\n+ if \"public_gists\" in attributes and attributes[ \"public_gists\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public_gists\" ], int )\n self.__public_gists = attributes[ \"public_gists\" ]\n- if \"public_repos\" in attributes and attributes[ \"public_repos\" ] is not None:\n+ if \"public_repos\" in attributes and attributes[ \"public_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public_repos\" ], int )\n self.__public_repos = attributes[ \"public_repos\" ]\n- if \"total_private_repos\" in attributes and attributes[ \"total_private_repos\" ] is not None:\n+ if \"total_private_repos\" in attributes and attributes[ \"total_private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"total_private_repos\" ], int )\n self.__total_private_repos = attributes[ \"total_private_repos\" ]\n- if \"type\" in attributes and attributes[ \"type\" ] is not None:\n+ if \"type\" in attributes and attributes[ \"type\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"type\" ], ( str, unicode ) )\n self.__type = attributes[ \"type\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":24,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Organization.py","changes":48,"additions":24,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Organization.py","filename":"src/github/Organization.py"},{"patch":"@@ -32,12 +32,12 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"admin\", \"pull\", \"push\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"admin\" in attributes and attributes[ \"admin\" ] is not None:\n+ if \"admin\" in attributes and attributes[ \"admin\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"admin\" ], bool )\n self.__admin = attributes[ \"admin\" ]\n- if \"pull\" in attributes and attributes[ \"pull\" ] is not None:\n+ if \"pull\" in attributes and attributes[ \"pull\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"pull\" ], bool )\n self.__pull = attributes[ \"pull\" ]\n- if \"push\" in attributes and attributes[ \"push\" ] is not None:\n+ if \"push\" in attributes and attributes[ \"push\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"push\" ], bool )\n self.__push = attributes[ \"push\" ]","status":"modified","deletions":3,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Permissions.py","changes":6,"additions":3,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Permissions.py","filename":"src/github/Permissions.py"},{"patch":"@@ -37,15 +37,15 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"collaborators\", \"name\", \"private_repos\", \"space\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None:\n+ if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"collaborators\" ], int )\n self.__collaborators = attributes[ \"collaborators\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]\n- if \"private_repos\" in attributes and attributes[ \"private_repos\" ] is not None:\n+ if \"private_repos\" in attributes and attributes[ \"private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"private_repos\" ], int )\n self.__private_repos = attributes[ \"private_repos\" ]\n- if \"space\" in attributes and attributes[ \"space\" ] is not None:\n+ if \"space\" in attributes and attributes[ \"space\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"space\" ], int )\n self.__space = attributes[ \"space\" ]","status":"modified","deletions":4,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Plan.py","changes":8,"additions":4,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Plan.py","filename":"src/github/Plan.py"},{"patch":"@@ -279,56 +279,56 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"additions\", \"base\", \"body\", \"changed_files\", \"closed_at\", \"comments\", \"commits\", \"created_at\", \"deletions\", \"diff_url\", \"head\", \"html_url\", \"id\", \"issue_url\", \"mergeable\", \"merged\", \"merged_at\", \"merged_by\", \"number\", \"patch_url\", \"review_comments\", \"state\", \"title\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"additions\" in attributes and attributes[ \"additions\" ] is not None:\n+ if \"additions\" in attributes and attributes[ \"additions\" ] is not None: # pragma no branch\n self.__additions = attributes[ \"additions\" ]\n- if \"base\" in attributes and attributes[ \"base\" ] is not None:\n+ if \"base\" in attributes and attributes[ \"base\" ] is not None: # pragma no branch\n self.__base = attributes[ \"base\" ]\n- if \"body\" in attributes and attributes[ \"body\" ] is not None:\n+ if \"body\" in attributes and attributes[ \"body\" ] is not None: # pragma no branch\n self.__body = attributes[ \"body\" ]\n- if \"changed_files\" in attributes and attributes[ \"changed_files\" ] is not None:\n+ if \"changed_files\" in attributes and attributes[ \"changed_files\" ] is not None: # pragma no branch\n self.__changed_files = attributes[ \"changed_files\" ]\n- if \"closed_at\" in attributes and attributes[ \"closed_at\" ] is not None:\n+ if \"closed_at\" in attributes and attributes[ \"closed_at\" ] is not None: # pragma no branch\n self.__closed_at = attributes[ \"closed_at\" ]\n- if \"comments\" in attributes and attributes[ \"comments\" ] is not None:\n+ if \"comments\" in attributes and attributes[ \"comments\" ] is not None: # pragma no branch\n self.__comments = attributes[ \"comments\" ]\n- if \"commits\" in attributes and attributes[ \"commits\" ] is not None:\n+ if \"commits\" in attributes and attributes[ \"commits\" ] is not None: # pragma no branch\n self.__commits = attributes[ \"commits\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None:\n+ if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None: # pragma no branch\n self.__deletions = attributes[ \"deletions\" ]\n- if \"diff_url\" in attributes and attributes[ \"diff_url\" ] is not None:\n+ if \"diff_url\" in attributes and attributes[ \"diff_url\" ] is not None: # pragma no branch\n self.__diff_url = attributes[ \"diff_url\" ]\n- if \"head\" in attributes and attributes[ \"head\" ] is not None:\n+ if \"head\" in attributes and attributes[ \"head\" ] is not None: # pragma no branch\n self.__head = attributes[ \"head\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"issue_url\" in attributes and attributes[ \"issue_url\" ] is not None:\n+ if \"issue_url\" in attributes and attributes[ \"issue_url\" ] is not None: # pragma no branch\n self.__issue_url = attributes[ \"issue_url\" ]\n- if \"mergeable\" in attributes and attributes[ \"mergeable\" ] is not None:\n+ if \"mergeable\" in attributes and attributes[ \"mergeable\" ] is not None: # pragma no branch\n self.__mergeable = attributes[ \"mergeable\" ]\n- if \"merged\" in attributes and attributes[ \"merged\" ] is not None:\n+ if \"merged\" in attributes and attributes[ \"merged\" ] is not None: # pragma no branch\n self.__merged = attributes[ \"merged\" ]\n- if \"merged_at\" in attributes and attributes[ \"merged_at\" ] is not None:\n+ if \"merged_at\" in attributes and attributes[ \"merged_at\" ] is not None: # pragma no branch\n self.__merged_at = attributes[ \"merged_at\" ]\n- if \"merged_by\" in attributes and attributes[ \"merged_by\" ] is not None:\n+ if \"merged_by\" in attributes and attributes[ \"merged_by\" ] is not None: # pragma no branch\n self.__merged_by = attributes[ \"merged_by\" ]\n- if \"number\" in attributes and attributes[ \"number\" ] is not None:\n+ if \"number\" in attributes and attributes[ \"number\" ] is not None: # pragma no branch\n self.__number = attributes[ \"number\" ]\n- if \"patch_url\" in attributes and attributes[ \"patch_url\" ] is not None:\n+ if \"patch_url\" in attributes and attributes[ \"patch_url\" ] is not None: # pragma no branch\n self.__patch_url = attributes[ \"patch_url\" ]\n- if \"review_comments\" in attributes and attributes[ \"review_comments\" ] is not None:\n+ if \"review_comments\" in attributes and attributes[ \"review_comments\" ] is not None: # pragma no branch\n self.__review_comments = attributes[ \"review_comments\" ]\n- if \"state\" in attributes and attributes[ \"state\" ] is not None:\n+ if \"state\" in attributes and attributes[ \"state\" ] is not None: # pragma no branch\n self.__state = attributes[ \"state\" ]\n- if \"title\" in attributes and attributes[ \"title\" ] is not None:\n+ if \"title\" in attributes and attributes[ \"title\" ] is not None: # pragma no branch\n self.__title = attributes[ \"title\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","status":"modified","deletions":26,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/PullRequest.py","changes":52,"additions":26,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/PullRequest.py","filename":"src/github/PullRequest.py"},{"patch":"@@ -121,26 +121,26 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"body\", \"commit_id\", \"created_at\", \"html_url\", \"id\", \"line\", \"path\", \"position\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"body\" in attributes and attributes[ \"body\" ] is not None:\n+ if \"body\" in attributes and attributes[ \"body\" ] is not None: # pragma no branch\n self.__body = attributes[ \"body\" ]\n- if \"commit_id\" in attributes and attributes[ \"commit_id\" ] is not None:\n+ if \"commit_id\" in attributes and attributes[ \"commit_id\" ] is not None: # pragma no branch\n self.__commit_id = attributes[ \"commit_id\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"line\" in attributes and attributes[ \"line\" ] is not None:\n+ if \"line\" in attributes and attributes[ \"line\" ] is not None: # pragma no branch\n self.__line = attributes[ \"line\" ]\n- if \"path\" in attributes and attributes[ \"path\" ] is not None:\n+ if \"path\" in attributes and attributes[ \"path\" ] is not None: # pragma no branch\n self.__path = attributes[ \"path\" ]\n- if \"position\" in attributes and attributes[ \"position\" ] is not None:\n+ if \"position\" in attributes and attributes[ \"position\" ] is not None: # pragma no branch\n self.__position = attributes[ \"position\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","status":"modified","deletions":11,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/PullRequestComment.py","changes":22,"additions":11,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/PullRequestComment.py","filename":"src/github/PullRequestComment.py"},{"patch":"@@ -62,21 +62,21 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"additions\", \"blob_url\", \"changes\", \"deletions\", \"filename\", \"patch\", \"raw_url\", \"sha\", \"status\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"additions\" in attributes and attributes[ \"additions\" ] is not None:\n+ if \"additions\" in attributes and attributes[ \"additions\" ] is not None: # pragma no branch\n self.__additions = attributes[ \"additions\" ]\n- if \"blob_url\" in attributes and attributes[ \"blob_url\" ] is not None:\n+ if \"blob_url\" in attributes and attributes[ \"blob_url\" ] is not None: # pragma no branch\n self.__blob_url = attributes[ \"blob_url\" ]\n- if \"changes\" in attributes and attributes[ \"changes\" ] is not None:\n+ if \"changes\" in attributes and attributes[ \"changes\" ] is not None: # pragma no branch\n self.__changes = attributes[ \"changes\" ]\n- if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None:\n+ if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None: # pragma no branch\n self.__deletions = attributes[ \"deletions\" ]\n- if \"filename\" in attributes and attributes[ \"filename\" ] is not None:\n+ if \"filename\" in attributes and attributes[ \"filename\" ] is not None: # pragma no branch\n self.__filename = attributes[ \"filename\" ]\n- if \"patch\" in attributes and attributes[ \"patch\" ] is not None:\n+ if \"patch\" in attributes and attributes[ \"patch\" ] is not None: # pragma no branch\n self.__patch = attributes[ \"patch\" ]\n- if \"raw_url\" in attributes and attributes[ \"raw_url\" ] is not None:\n+ if \"raw_url\" in attributes and attributes[ \"raw_url\" ] is not None: # pragma no branch\n self.__raw_url = attributes[ \"raw_url\" ]\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n self.__sha = attributes[ \"sha\" ]\n- if \"status\" in attributes and attributes[ \"status\" ] is not None:\n+ if \"status\" in attributes and attributes[ \"status\" ] is not None: # pragma no branch\n self.__status = attributes[ \"status\" ]","status":"modified","deletions":9,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/PullRequestFile.py","changes":18,"additions":9,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/PullRequestFile.py","filename":"src/github/PullRequestFile.py"},{"patch":"@@ -905,96 +905,96 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n 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\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"clone_url\" in attributes and attributes[ \"clone_url\" ] is not None:\n+ if \"clone_url\" in attributes and attributes[ \"clone_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"clone_url\" ], ( str, unicode ) )\n self.__clone_url = attributes[ \"clone_url\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"description\" in attributes and attributes[ \"description\" ] is not None:\n+ if \"description\" in attributes and attributes[ \"description\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"description\" ], ( str, unicode ) )\n self.__description = attributes[ \"description\" ]\n- if \"fork\" in attributes and attributes[ \"fork\" ] is not None:\n+ if \"fork\" in attributes and attributes[ \"fork\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"fork\" ], bool )\n self.__fork = attributes[ \"fork\" ]\n- if \"forks\" in attributes and attributes[ \"forks\" ] is not None:\n+ if \"forks\" in attributes and attributes[ \"forks\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"forks\" ], int )\n self.__forks = attributes[ \"forks\" ]\n- if \"full_name\" in attributes and attributes[ \"full_name\" ] is not None:\n+ if \"full_name\" in attributes and attributes[ \"full_name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"full_name\" ], ( str, unicode ) )\n self.__full_name = attributes[ \"full_name\" ]\n- if \"git_url\" in attributes and attributes[ \"git_url\" ] is not None:\n+ if \"git_url\" in attributes and attributes[ \"git_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"git_url\" ], ( str, unicode ) )\n self.__git_url = attributes[ \"git_url\" ]\n- if \"has_downloads\" in attributes and attributes[ \"has_downloads\" ] is not None:\n+ if \"has_downloads\" in attributes and attributes[ \"has_downloads\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"has_downloads\" ], bool )\n self.__has_downloads = attributes[ \"has_downloads\" ]\n- if \"has_issues\" in attributes and attributes[ \"has_issues\" ] is not None:\n+ if \"has_issues\" in attributes and attributes[ \"has_issues\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"has_issues\" ], bool )\n self.__has_issues = attributes[ \"has_issues\" ]\n- if \"has_wiki\" in attributes and attributes[ \"has_wiki\" ] is not None:\n+ if \"has_wiki\" in attributes and attributes[ \"has_wiki\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"has_wiki\" ], bool )\n self.__has_wiki = attributes[ \"has_wiki\" ]\n- if \"homepage\" in attributes and attributes[ \"homepage\" ] is not None:\n+ if \"homepage\" in attributes and attributes[ \"homepage\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"homepage\" ], ( str, unicode ) )\n self.__homepage = attributes[ \"homepage\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"language\" in attributes and attributes[ \"language\" ] is not None:\n+ if \"language\" in attributes and attributes[ \"language\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"language\" ], ( str, unicode ) )\n self.__language = attributes[ \"language\" ]\n- if \"master_branch\" in attributes and attributes[ \"master_branch\" ] is not None:\n+ if \"master_branch\" in attributes and attributes[ \"master_branch\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"master_branch\" ], ( str, unicode ) )\n self.__master_branch = attributes[ \"master_branch\" ]\n- if \"mirror_url\" in attributes and attributes[ \"mirror_url\" ] is not None:\n+ if \"mirror_url\" in attributes and attributes[ \"mirror_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"mirror_url\" ], ( str, unicode ) )\n self.__mirror_url = attributes[ \"mirror_url\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]\n- if \"open_issues\" in attributes and attributes[ \"open_issues\" ] is not None:\n+ if \"open_issues\" in attributes and attributes[ \"open_issues\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"open_issues\" ], int )\n self.__open_issues = attributes[ \"open_issues\" ]\n- if \"organization\" in attributes and attributes[ \"organization\" ] is not None:\n+ if \"organization\" in attributes and attributes[ \"organization\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"organization\" ], dict )\n self.__organization = Organization.Organization( self.__requester, attributes[ \"organization\" ], completion = LazyCompletion )\n- if \"owner\" in attributes and attributes[ \"owner\" ] is not None:\n+ if \"owner\" in attributes and attributes[ \"owner\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"owner\" ], dict )\n self.__owner = NamedUser.NamedUser( self.__requester, attributes[ \"owner\" ], completion = LazyCompletion )\n- if \"parent\" in attributes and attributes[ \"parent\" ] is not None:\n+ if \"parent\" in attributes and attributes[ \"parent\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"parent\" ], dict )\n self.__parent = Repository( self.__requester, attributes[ \"parent\" ], completion = LazyCompletion )\n- if \"permissions\" in attributes and attributes[ \"permissions\" ] is not None:\n+ if \"permissions\" in attributes and attributes[ \"permissions\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"permissions\" ], dict )\n self.__permissions = Permissions.Permissions( self.__requester, attributes[ \"permissions\" ], completion = LazyCompletion )\n- if \"private\" in attributes and attributes[ \"private\" ] is not None:\n+ if \"private\" in attributes and attributes[ \"private\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"private\" ], bool )\n self.__private = attributes[ \"private\" ]\n- if \"pushed_at\" in attributes and attributes[ \"pushed_at\" ] is not None:\n+ if \"pushed_at\" in attributes and attributes[ \"pushed_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"pushed_at\" ], ( str, unicode ) )\n self.__pushed_at = attributes[ \"pushed_at\" ]\n- if \"size\" in attributes and attributes[ \"size\" ] is not None:\n+ if \"size\" in attributes and attributes[ \"size\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"size\" ], int )\n self.__size = attributes[ \"size\" ]\n- if \"source\" in attributes and attributes[ \"source\" ] is not None:\n+ if \"source\" in attributes and attributes[ \"source\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"source\" ], dict )\n self.__source = Repository( self.__requester, attributes[ \"source\" ], completion = LazyCompletion )\n- if \"ssh_url\" in attributes and attributes[ \"ssh_url\" ] is not None:\n+ if \"ssh_url\" in attributes and attributes[ \"ssh_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"ssh_url\" ], ( str, unicode ) )\n self.__ssh_url = attributes[ \"ssh_url\" ]\n- if \"svn_url\" in attributes and attributes[ \"svn_url\" ] is not None:\n+ if \"svn_url\" in attributes and attributes[ \"svn_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"svn_url\" ], ( str, unicode ) )\n self.__svn_url = attributes[ \"svn_url\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"updated_at\" ], ( str, unicode ) )\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]\n- if \"watchers\" in attributes and attributes[ \"watchers\" ] is not None:\n+ if \"watchers\" in attributes and attributes[ \"watchers\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"watchers\" ], int )\n self.__watchers = attributes[ \"watchers\" ]","status":"modified","deletions":31,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Repository.py","changes":62,"additions":31,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Repository.py","filename":"src/github/Repository.py"},{"patch":"@@ -87,14 +87,14 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"id\", \"key\", \"title\", \"url\", \"verified\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"key\" in attributes and attributes[ \"key\" ] is not None:\n+ if \"key\" in attributes and attributes[ \"key\" ] is not None: # pragma no branch\n self.__key = attributes[ \"key\" ]\n- if \"title\" in attributes and attributes[ \"title\" ] is not None:\n+ if \"title\" in attributes and attributes[ \"title\" ] is not None: # pragma no branch\n self.__title = attributes[ \"title\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]\n- if \"verified\" in attributes and attributes[ \"verified\" ] is not None:\n+ if \"verified\" in attributes and attributes[ \"verified\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"verified\" ], bool )\n self.__verified = attributes[ \"verified\" ]","status":"modified","deletions":5,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/RepositoryKey.py","changes":10,"additions":5,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/RepositoryKey.py","filename":"src/github/RepositoryKey.py"},{"patch":"@@ -38,15 +38,15 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"commit\", \"name\", \"tarball_url\", \"zipball_url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"commit\" in attributes and attributes[ \"commit\" ] is not None:\n+ if \"commit\" in attributes and attributes[ \"commit\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"commit\" ], dict )\n self.__commit = Commit.Commit( self.__requester, attributes[ \"commit\" ], completion = LazyCompletion )\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]\n- if \"tarball_url\" in attributes and attributes[ \"tarball_url\" ] is not None:\n+ if \"tarball_url\" in attributes and attributes[ \"tarball_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"tarball_url\" ], ( str, unicode ) )\n self.__tarball_url = attributes[ \"tarball_url\" ]\n- if \"zipball_url\" in attributes and attributes[ \"zipball_url\" ] is not None:\n+ if \"zipball_url\" in attributes and attributes[ \"zipball_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"zipball_url\" ], ( str, unicode ) )\n self.__zipball_url = attributes[ \"zipball_url\" ]","status":"modified","deletions":4,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Tag.py","changes":8,"additions":4,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Tag.py","filename":"src/github/Tag.py"},{"patch":"@@ -172,15 +172,15 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"id\", \"members_count\", \"name\", \"permission\", \"repos_count\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"members_count\" in attributes and attributes[ \"members_count\" ] is not None:\n+ if \"members_count\" in attributes and attributes[ \"members_count\" ] is not None: # pragma no branch\n self.__members_count = attributes[ \"members_count\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n self.__name = attributes[ \"name\" ]\n- if \"permission\" in attributes and attributes[ \"permission\" ] is not None:\n+ if \"permission\" in attributes and attributes[ \"permission\" ] is not None: # pragma no branch\n self.__permission = attributes[ \"permission\" ]\n- if \"repos_count\" in attributes and attributes[ \"repos_count\" ] is not None:\n+ if \"repos_count\" in attributes and attributes[ \"repos_count\" ] is not None: # pragma no branch\n self.__repos_count = attributes[ \"repos_count\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":6,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Team.py","changes":12,"additions":6,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Team.py","filename":"src/github/Team.py"},{"patch":"@@ -87,14 +87,14 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"id\", \"key\", \"title\", \"url\", \"verified\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"key\" in attributes and attributes[ \"key\" ] is not None:\n+ if \"key\" in attributes and attributes[ \"key\" ] is not None: # pragma no branch\n self.__key = attributes[ \"key\" ]\n- if \"title\" in attributes and attributes[ \"title\" ] is not None:\n+ if \"title\" in attributes and attributes[ \"title\" ] is not None: # pragma no branch\n self.__title = attributes[ \"title\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]\n- if \"verified\" in attributes and attributes[ \"verified\" ] is not None:\n+ if \"verified\" in attributes and attributes[ \"verified\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"verified\" ], bool )\n self.__verified = attributes[ \"verified\" ]","status":"modified","deletions":5,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/UserKey.py","changes":10,"additions":5,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/UserKey.py","filename":"src/github/UserKey.py"},{"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","status":"modified","deletions":1,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/Issue.py","changes":26,"additions":25,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/Issue.py","filename":"test/Issue.py"},{"patch":"@@ -3,13 +3,13 @@\n class IssueEvent( Framework.TestCase ):\r\n def setUp( self ):\r\n Framework.TestCase.setUp( self )\r\n- self.event = self.g.get_user().get_repo( \"PyGithub\" ).get_issues_event( 15819975 )\r\n+ self.event = self.g.get_user().get_repo( \"PyGithub\" ).get_issues_event( 16348656 )\r\n \r\n def testAttributes( self ):\r\n self.assertEqual( self.event.actor.login, \"jacquev6\" )\r\n- self.assertEqual( self.event.commit_id, None )\r\n- self.assertEqual( self.event.created_at, \"2012-05-19T10:38:23Z\" )\r\n- self.assertEqual( self.event.event, \"subscribed\" )\r\n- self.assertEqual( self.event.id, 15819975 )\r\n- self.assertEqual( self.event.issue.number, 28 )\r\n- self.assertEqual( self.event.url, \"https://api.github.com/repos/jacquev6/PyGithub/issues/events/15819975\" )\r\n+ self.assertEqual( self.event.commit_id, \"ed866fc43833802ab553e5ff8581c81bb00dd433\" )\r\n+ self.assertEqual( self.event.created_at, \"2012-05-27T07:29:25Z\" )\r\n+ self.assertEqual( self.event.event, \"referenced\" )\r\n+ self.assertEqual( self.event.id, 16348656 )\r\n+ self.assertEqual( self.event.issue.number, 30 )\r\n+ self.assertEqual( self.event.url, \"https://api.github.com/repos/jacquev6/PyGithub/issues/events/16348656\" )\r","status":"modified","deletions":7,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/IssueEvent.py","changes":14,"additions":7,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/IssueEvent.py","filename":"test/IssueEvent.py"},{"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+","status":"added","deletions":0,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testAddAndRemoveLabels.txt","changes":45,"additions":45,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testAddAndRemoveLabels.txt","filename":"test/ReplayData/Issue.testAddAndRemoveLabels.txt"},{"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+","status":"added","deletions":0,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testDeleteAndSetLabels.txt","changes":35,"additions":35,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testDeleteAndSetLabels.txt","filename":"test/ReplayData/Issue.testDeleteAndSetLabels.txt"},{"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+","status":"added","deletions":0,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testGetLabels.txt","changes":5,"additions":5,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testGetLabels.txt","filename":"test/ReplayData/Issue.testGetLabels.txt"},{"patch":"@@ -1,15 +1,15 @@\n GET /user {'Authorization': 'Basic login_and_password_removed'} null\n 200\n-[('status', '200 OK'), ('x-ratelimit-remaining', '4907'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"99c9bfb75395b749e9913a4729126fb5\"'), ('date', 'Sun, 27 May 2012 07:19:30 GMT'), ('content-type', 'application/json; charset=utf-8')]\n-{\"private_gists\":5,\"type\":\"User\",\"company\":\"Criteo\",\"location\":\"Paris, France\",\"hireable\":false,\"gravatar_id\":\"b68de5ae38616c296fa345d2b9df2225\",\"bio\":\"\",\"following\":24,\"blog\":\"http://vincent-jacques.net\",\"avatar_url\":\"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png\",\"total_private_repos\":5,\"followers\":13,\"owned_private_repos\":5,\"disk_usage\":16976,\"collaborators\":0,\"html_url\":\"https://github.com/jacquev6\",\"url\":\"https://api.github.com/users/jacquev6\",\"name\":\"Vincent Jacques\",\"login\":\"jacquev6\",\"public_repos\":11,\"public_gists\":3,\"email\":\"vincent@vincent-jacques.net\",\"id\":327146,\"plan\":{\"private_repos\":5,\"collaborators\":1,\"name\":\"micro\",\"space\":614400},\"created_at\":\"2010-07-09T06:10:06Z\"}\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4996'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"8974bb1628a3e3a6d3eb3b08c1b5a46b\"'), ('date', 'Sun, 27 May 2012 07:32:54 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+{\"type\":\"User\",\"bio\":\"\",\"disk_usage\":16976,\"total_private_repos\":5,\"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\",\"owned_private_repos\":5,\"collaborators\":0,\"plan\":{\"collaborators\":1,\"private_repos\":5,\"name\":\"micro\",\"space\":614400},\"company\":\"Criteo\",\"gravatar_id\":\"b68de5ae38616c296fa345d2b9df2225\",\"login\":\"jacquev6\",\"email\":\"vincent@vincent-jacques.net\",\"public_gists\":3,\"followers\":13,\"name\":\"Vincent Jacques\",\"created_at\":\"2010-07-09T06:10:06Z\",\"blog\":\"http://vincent-jacques.net\",\"location\":\"Paris, France\",\"hireable\":false,\"id\":327146,\"private_gists\":5,\"public_repos\":11,\"following\":24,\"html_url\":\"https://github.com/jacquev6\"}\n \n GET /repos/jacquev6/PyGithub {'Authorization': 'Basic login_and_password_removed'} null\n 200\n-[('status', '200 OK'), ('x-ratelimit-remaining', '4906'), ('content-length', '1129'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"4c20acf0b23f75bbf25106b1a04f65a5\"'), ('date', 'Sun, 27 May 2012 07:19:31 GMT'), ('content-type', 'application/json; charset=utf-8')]\n-{\"description\":\"Python library implementing the full Github API v3\",\"full_name\":\"jacquev6/PyGithub\",\"has_wiki\":false,\"has_issues\":true,\"updated_at\":\"2012-05-27T06:55:28Z\",\"forks\":3,\"mirror_url\":null,\"homepage\":\"http://vincent-jacques.net/PyGithub\",\"ssh_url\":\"git@github.com:jacquev6/PyGithub.git\",\"open_issues\":16,\"fork\":false,\"svn_url\":\"https://github.com/jacquev6/PyGithub\",\"pushed_at\":\"2012-05-27T06:00:28Z\",\"size\":308,\"html_url\":\"https://github.com/jacquev6/PyGithub\",\"private\":false,\"url\":\"https://api.github.com/repos/jacquev6/PyGithub\",\"clone_url\":\"https://github.com/jacquev6/PyGithub.git\",\"owner\":{\"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},\"name\":\"PyGithub\",\"has_downloads\":true,\"language\":\"Python\",\"watchers\":15,\"git_url\":\"git://github.com/jacquev6/PyGithub.git\",\"id\":3544490,\"permissions\":{\"admin\":true,\"pull\":true,\"push\":true},\"created_at\":\"2012-02-25T12:53:47Z\"}\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4995'), ('content-length', '1129'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"f1e4eb3993a364b66b68ec9db42405bd\"'), ('date', 'Sun, 27 May 2012 07:32:55 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+{\"clone_url\":\"https://github.com/jacquev6/PyGithub.git\",\"has_downloads\":true,\"watchers\":15,\"updated_at\":\"2012-05-27T07:29:24Z\",\"permissions\":{\"pull\":true,\"admin\":true,\"push\":true},\"homepage\":\"http://vincent-jacques.net/PyGithub\",\"url\":\"https://api.github.com/repos/jacquev6/PyGithub\",\"mirror_url\":null,\"has_wiki\":false,\"has_issues\":true,\"fork\":false,\"forks\":3,\"git_url\":\"git://github.com/jacquev6/PyGithub.git\",\"size\":308,\"private\":false,\"open_issues\":16,\"svn_url\":\"https://github.com/jacquev6/PyGithub\",\"owner\":{\"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},\"name\":\"PyGithub\",\"language\":\"Python\",\"description\":\"Python library implementing the full Github API v3\",\"ssh_url\":\"git@github.com:jacquev6/PyGithub.git\",\"pushed_at\":\"2012-05-27T07:29:24Z\",\"created_at\":\"2012-02-25T12:53:47Z\",\"id\":3544490,\"html_url\":\"https://github.com/jacquev6/PyGithub\",\"full_name\":\"jacquev6/PyGithub\"}\n \n-GET /repos/jacquev6/PyGithub/issues/events/15819975 {'Authorization': 'Basic login_and_password_removed'} null\n+GET /repos/jacquev6/PyGithub/issues/events/16348656 {'Authorization': 'Basic login_and_password_removed'} null\n 200\n-[('status', '200 OK'), ('x-ratelimit-remaining', '4905'), ('content-length', '2430'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"a3d244842d23f92f69a23e21626fad11\"'), ('date', 'Sun, 27 May 2012 07:19:31 GMT'), ('content-type', 'application/json; charset=utf-8')]\n-{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/issues/events/15819975\",\"issue\":{\"updated_at\":\"2012-05-26T14:59:33Z\",\"body\":\"Body edited by PyGithub\",\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/issues/28\",\"comments\":0,\"milestone\":{\"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/1\",\"number\":1,\"title\":\"Version 0.4\",\"due_on\":\"2012-03-13T07:00:00Z\",\"closed_issues\":3,\"open_issues\":0,\"created_at\":\"2012-03-08T12:22:10Z\",\"state\":\"closed\",\"description\":\"\",\"id\":93546},\"number\":28,\"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\":\"2012-05-26T14:59:33Z\",\"title\":\"Issue created by PyGithub\",\"labels\":[{\"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\"}],\"created_at\":\"2012-05-19T10:38:23Z\",\"state\":\"closed\",\"user\":{\"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},\"id\":4653757,\"pull_request\":{\"diff_url\":null,\"patch_url\":null,\"html_url\":null},\"html_url\":\"https://github.com/jacquev6/PyGithub/issues/28\"},\"commit_id\":null,\"created_at\":\"2012-05-19T10:38:23Z\",\"event\":\"subscribed\",\"id\":15819975,\"actor\":{\"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}}\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '1384'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"fefecab09e7355d4ef9875677c2631da\"'), ('date', 'Sun, 27 May 2012 07:32:56 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/issues/events/16348656\",\"issue\":{\"updated_at\":\"2012-05-27T07:27:51Z\",\"body\":\"Body created by PyGithub\",\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/issues/30\",\"comments\":0,\"milestone\":null,\"number\":30,\"assignee\":null,\"closed_at\":null,\"title\":\"Issue also created by PyGithub\",\"labels\":[{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Question\",\"name\":\"Question\",\"color\":\"02e10c\"}],\"created_at\":\"2012-05-27T05:40:15Z\",\"state\":\"open\",\"user\":{\"url\":\"https://api.github.com/users/jacquev6\",\"gravatar_id\":\"b68de5ae38616c296fa345d2b9df2225\",\"login\":\"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\"},\"id\":4769659,\"pull_request\":{\"patch_url\":null,\"diff_url\":null,\"html_url\":null},\"html_url\":\"https://github.com/jacquev6/PyGithub/issues/30\"},\"commit_id\":\"ed866fc43833802ab553e5ff8581c81bb00dd433\",\"created_at\":\"2012-05-27T07:29:25Z\",\"event\":\"referenced\",\"id\":16348656,\"actor\":{\"url\":\"https://api.github.com/users/jacquev6\",\"gravatar_id\":\"b68de5ae38616c296fa345d2b9df2225\",\"login\":\"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\"}}\n ","status":"modified","deletions":7,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/IssueEvent.setUp.txt","changes":14,"additions":7,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/IssueEvent.setUp.txt","filename":"test/ReplayData/IssueEvent.setUp.txt"}] +[{"patch":"@@ -70,7 +70,7 @@ def __useAttributes( self, attributes ):\n \n # @toto No need to check if attribute is in attributes when attribute is mandatory\n {% for attribute in class.attributes|dictsort:\"name\" %}\n- if \"{{ attribute.name }}\" in attributes and attributes[ \"{{ attribute.name }}\" ] is not None:\n+ if \"{{ attribute.name }}\" in attributes and attributes[ \"{{ attribute.name }}\" ] is not None: # pragma no branch\n \n {% if attribute.type.cardinality == \"scalar\" %}\n {% if attribute.type.simple %}","status":"modified","deletions":1,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/codegen/templates/GithubObject.py","changes":2,"additions":1,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/codegen/templates/GithubObject.py","filename":"codegen/templates/GithubObject.py"},{"patch":"@@ -568,78 +568,78 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"avatar_url\", \"bio\", \"blog\", \"collaborators\", \"company\", \"created_at\", \"disk_usage\", \"email\", \"followers\", \"following\", \"gravatar_id\", \"hireable\", \"html_url\", \"id\", \"location\", \"login\", \"name\", \"owned_private_repos\", \"plan\", \"private_gists\", \"public_gists\", \"public_repos\", \"total_private_repos\", \"type\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"avatar_url\" in attributes and attributes[ \"avatar_url\" ] is not None:\n+ if \"avatar_url\" in attributes and attributes[ \"avatar_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"avatar_url\" ], ( str, unicode ) )\n self.__avatar_url = attributes[ \"avatar_url\" ]\n- if \"bio\" in attributes and attributes[ \"bio\" ] is not None:\n+ if \"bio\" in attributes and attributes[ \"bio\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"bio\" ], ( str, unicode ) )\n self.__bio = attributes[ \"bio\" ]\n- if \"blog\" in attributes and attributes[ \"blog\" ] is not None:\n+ if \"blog\" in attributes and attributes[ \"blog\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"blog\" ], ( str, unicode ) )\n self.__blog = attributes[ \"blog\" ]\n- if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None:\n+ if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"collaborators\" ], int )\n self.__collaborators = attributes[ \"collaborators\" ]\n- if \"company\" in attributes and attributes[ \"company\" ] is not None:\n+ if \"company\" in attributes and attributes[ \"company\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"company\" ], ( str, unicode ) )\n self.__company = attributes[ \"company\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"disk_usage\" in attributes and attributes[ \"disk_usage\" ] is not None:\n+ if \"disk_usage\" in attributes and attributes[ \"disk_usage\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"disk_usage\" ], int )\n self.__disk_usage = attributes[ \"disk_usage\" ]\n- if \"email\" in attributes and attributes[ \"email\" ] is not None:\n+ if \"email\" in attributes and attributes[ \"email\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"email\" ], ( str, unicode ) )\n self.__email = attributes[ \"email\" ]\n- if \"followers\" in attributes and attributes[ \"followers\" ] is not None:\n+ if \"followers\" in attributes and attributes[ \"followers\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"followers\" ], int )\n self.__followers = attributes[ \"followers\" ]\n- if \"following\" in attributes and attributes[ \"following\" ] is not None:\n+ if \"following\" in attributes and attributes[ \"following\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"following\" ], int )\n self.__following = attributes[ \"following\" ]\n- if \"gravatar_id\" in attributes and attributes[ \"gravatar_id\" ] is not None:\n+ if \"gravatar_id\" in attributes and attributes[ \"gravatar_id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"gravatar_id\" ], ( str, unicode ) )\n self.__gravatar_id = attributes[ \"gravatar_id\" ]\n- if \"hireable\" in attributes and attributes[ \"hireable\" ] is not None:\n+ if \"hireable\" in attributes and attributes[ \"hireable\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"hireable\" ], bool )\n self.__hireable = attributes[ \"hireable\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"location\" in attributes and attributes[ \"location\" ] is not None:\n+ if \"location\" in attributes and attributes[ \"location\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"location\" ], ( str, unicode ) )\n self.__location = attributes[ \"location\" ]\n- if \"login\" in attributes and attributes[ \"login\" ] is not None:\n+ if \"login\" in attributes and attributes[ \"login\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"login\" ], ( str, unicode ) )\n self.__login = attributes[ \"login\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]\n- if \"owned_private_repos\" in attributes and attributes[ \"owned_private_repos\" ] is not None:\n+ if \"owned_private_repos\" in attributes and attributes[ \"owned_private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"owned_private_repos\" ], int )\n self.__owned_private_repos = attributes[ \"owned_private_repos\" ]\n- if \"plan\" in attributes and attributes[ \"plan\" ] is not None:\n+ if \"plan\" in attributes and attributes[ \"plan\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"plan\" ], dict )\n self.__plan = Plan.Plan( self.__requester, attributes[ \"plan\" ], completion = LazyCompletion )\n- if \"private_gists\" in attributes and attributes[ \"private_gists\" ] is not None:\n+ if \"private_gists\" in attributes and attributes[ \"private_gists\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"private_gists\" ], int )\n self.__private_gists = attributes[ \"private_gists\" ]\n- if \"public_gists\" in attributes and attributes[ \"public_gists\" ] is not None:\n+ if \"public_gists\" in attributes and attributes[ \"public_gists\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public_gists\" ], int )\n self.__public_gists = attributes[ \"public_gists\" ]\n- if \"public_repos\" in attributes and attributes[ \"public_repos\" ] is not None:\n+ if \"public_repos\" in attributes and attributes[ \"public_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public_repos\" ], int )\n self.__public_repos = attributes[ \"public_repos\" ]\n- if \"total_private_repos\" in attributes and attributes[ \"total_private_repos\" ] is not None:\n+ if \"total_private_repos\" in attributes and attributes[ \"total_private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"total_private_repos\" ], int )\n self.__total_private_repos = attributes[ \"total_private_repos\" ]\n- if \"type\" in attributes and attributes[ \"type\" ] is not None:\n+ if \"type\" in attributes and attributes[ \"type\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"type\" ], ( str, unicode ) )\n self.__type = attributes[ \"type\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":25,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/AuthenticatedUser.py","changes":50,"additions":25,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/AuthenticatedUser.py","filename":"src/github/AuthenticatedUser.py"},{"patch":"@@ -117,21 +117,21 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"app\", \"created_at\", \"id\", \"note\", \"note_url\", \"scopes\", \"token\", \"updated_at\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"app\" in attributes and attributes[ \"app\" ] is not None:\n+ if \"app\" in attributes and attributes[ \"app\" ] is not None: # pragma no branch\n self.__app = attributes[ \"app\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"note\" in attributes and attributes[ \"note\" ] is not None:\n+ if \"note\" in attributes and attributes[ \"note\" ] is not None: # pragma no branch\n self.__note = attributes[ \"note\" ]\n- if \"note_url\" in attributes and attributes[ \"note_url\" ] is not None:\n+ if \"note_url\" in attributes and attributes[ \"note_url\" ] is not None: # pragma no branch\n self.__note_url = attributes[ \"note_url\" ]\n- if \"scopes\" in attributes and attributes[ \"scopes\" ] is not None:\n+ if \"scopes\" in attributes and attributes[ \"scopes\" ] is not None: # pragma no branch\n self.__scopes = attributes[ \"scopes\" ]\n- if \"token\" in attributes and attributes[ \"token\" ] is not None:\n+ if \"token\" in attributes and attributes[ \"token\" ] is not None: # pragma no branch\n self.__token = attributes[ \"token\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":9,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Authorization.py","changes":18,"additions":9,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Authorization.py","filename":"src/github/Authorization.py"},{"patch":"@@ -28,9 +28,9 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"commit\", \"name\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"commit\" in attributes and attributes[ \"commit\" ] is not None:\n+ if \"commit\" in attributes and attributes[ \"commit\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"commit\" ], dict )\n self.__commit = Commit.Commit( self.__requester, attributes[ \"commit\" ], completion = LazyCompletion )\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]","status":"modified","deletions":2,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Branch.py","changes":4,"additions":2,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Branch.py","filename":"src/github/Branch.py"},{"patch":"@@ -120,33 +120,33 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"author\", \"commit\", \"committer\", \"files\", \"parents\", \"sha\", \"stats\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"author\" in attributes and attributes[ \"author\" ] is not None:\n+ if \"author\" in attributes and attributes[ \"author\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"author\" ], dict )\n self.__author = NamedUser.NamedUser( self.__requester, attributes[ \"author\" ], completion = LazyCompletion )\n- if \"commit\" in attributes and attributes[ \"commit\" ] is not None:\n+ if \"commit\" in attributes and attributes[ \"commit\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"commit\" ], dict )\n self.__commit = GitCommit.GitCommit( self.__requester, attributes[ \"commit\" ], completion = LazyCompletion )\n- if \"committer\" in attributes and attributes[ \"committer\" ] is not None:\n+ if \"committer\" in attributes and attributes[ \"committer\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"committer\" ], dict )\n self.__committer = NamedUser.NamedUser( self.__requester, attributes[ \"committer\" ], completion = LazyCompletion )\n- if \"files\" in attributes and attributes[ \"files\" ] is not None:\n+ if \"files\" in attributes and attributes[ \"files\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"files\" ], list ) and ( len( attributes[ \"files\" ] ) == 0 or isinstance( attributes[ \"files\" ][ 0 ], dict ) )\n self.__files = [\n CommitFile.CommitFile( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"files\" ]\n ]\n- if \"parents\" in attributes and attributes[ \"parents\" ] is not None:\n+ if \"parents\" in attributes and attributes[ \"parents\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"parents\" ], list ) and ( len( attributes[ \"parents\" ] ) == 0 or isinstance( attributes[ \"parents\" ][ 0 ], dict ) )\n self.__parents = [\n Commit( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"parents\" ]\n ]\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"stats\" in attributes and attributes[ \"stats\" ] is not None:\n+ if \"stats\" in attributes and attributes[ \"stats\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"stats\" ], dict )\n self.__stats = CommitStats.CommitStats( self.__requester, attributes[ \"stats\" ], completion = LazyCompletion )\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":8,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Commit.py","changes":16,"additions":8,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Commit.py","filename":"src/github/Commit.py"},{"patch":"@@ -121,36 +121,36 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"body\", \"commit_id\", \"created_at\", \"html_url\", \"id\", \"line\", \"path\", \"position\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"body\" in attributes and attributes[ \"body\" ] is not None:\n+ if \"body\" in attributes and attributes[ \"body\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"body\" ], ( str, unicode ) )\n self.__body = attributes[ \"body\" ]\n- if \"commit_id\" in attributes and attributes[ \"commit_id\" ] is not None:\n+ if \"commit_id\" in attributes and attributes[ \"commit_id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"commit_id\" ], ( str, unicode ) )\n self.__commit_id = attributes[ \"commit_id\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"line\" in attributes and attributes[ \"line\" ] is not None:\n+ if \"line\" in attributes and attributes[ \"line\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"line\" ], int )\n self.__line = attributes[ \"line\" ]\n- if \"path\" in attributes and attributes[ \"path\" ] is not None:\n+ if \"path\" in attributes and attributes[ \"path\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"path\" ], ( str, unicode ) )\n self.__path = attributes[ \"path\" ]\n- if \"position\" in attributes and attributes[ \"position\" ] is not None:\n+ if \"position\" in attributes and attributes[ \"position\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"position\" ], int )\n self.__position = attributes[ \"position\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"updated_at\" ], ( str, unicode ) )\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","status":"modified","deletions":11,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/CommitComment.py","changes":22,"additions":11,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/CommitComment.py","filename":"src/github/CommitComment.py"},{"patch":"@@ -62,21 +62,21 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"additions\", \"blob_url\", \"changes\", \"deletions\", \"filename\", \"patch\", \"raw_url\", \"sha\", \"status\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"additions\" in attributes and attributes[ \"additions\" ] is not None:\n+ if \"additions\" in attributes and attributes[ \"additions\" ] is not None: # pragma no branch\n self.__additions = attributes[ \"additions\" ]\n- if \"blob_url\" in attributes and attributes[ \"blob_url\" ] is not None:\n+ if \"blob_url\" in attributes and attributes[ \"blob_url\" ] is not None: # pragma no branch\n self.__blob_url = attributes[ \"blob_url\" ]\n- if \"changes\" in attributes and attributes[ \"changes\" ] is not None:\n+ if \"changes\" in attributes and attributes[ \"changes\" ] is not None: # pragma no branch\n self.__changes = attributes[ \"changes\" ]\n- if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None:\n+ if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None: # pragma no branch\n self.__deletions = attributes[ \"deletions\" ]\n- if \"filename\" in attributes and attributes[ \"filename\" ] is not None:\n+ if \"filename\" in attributes and attributes[ \"filename\" ] is not None: # pragma no branch\n self.__filename = attributes[ \"filename\" ]\n- if \"patch\" in attributes and attributes[ \"patch\" ] is not None:\n+ if \"patch\" in attributes and attributes[ \"patch\" ] is not None: # pragma no branch\n self.__patch = attributes[ \"patch\" ]\n- if \"raw_url\" in attributes and attributes[ \"raw_url\" ] is not None:\n+ if \"raw_url\" in attributes and attributes[ \"raw_url\" ] is not None: # pragma no branch\n self.__raw_url = attributes[ \"raw_url\" ]\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n self.__sha = attributes[ \"sha\" ]\n- if \"status\" in attributes and attributes[ \"status\" ] is not None:\n+ if \"status\" in attributes and attributes[ \"status\" ] is not None: # pragma no branch\n self.__status = attributes[ \"status\" ]","status":"modified","deletions":9,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/CommitFile.py","changes":18,"additions":9,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/CommitFile.py","filename":"src/github/CommitFile.py"},{"patch":"@@ -32,12 +32,12 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"additions\", \"deletions\", \"total\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"additions\" in attributes and attributes[ \"additions\" ] is not None:\n+ if \"additions\" in attributes and attributes[ \"additions\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"additions\" ], int )\n self.__additions = attributes[ \"additions\" ]\n- if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None:\n+ if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"deletions\" ], int )\n self.__deletions = attributes[ \"deletions\" ]\n- if \"total\" in attributes and attributes[ \"total\" ] is not None:\n+ if \"total\" in attributes and attributes[ \"total\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"total\" ], int )\n self.__total = attributes[ \"total\" ]","status":"modified","deletions":3,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/CommitStats.py","changes":6,"additions":3,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/CommitStats.py","filename":"src/github/CommitStats.py"},{"patch":"@@ -162,43 +162,43 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"accesskeyid\", \"acl\", \"bucket\", \"content_type\", \"created_at\", \"description\", \"download_count\", \"expirationdate\", \"html_url\", \"id\", \"mime_type\", \"name\", \"path\", \"policy\", \"prefix\", \"redirect\", \"s3_url\", \"signature\", \"size\", \"url\", \"x-amz-meta-content-disposition\" ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"accesskeyid\" in attributes and attributes[ \"accesskeyid\" ] is not None:\n+ if \"accesskeyid\" in attributes and attributes[ \"accesskeyid\" ] is not None: # pragma no branch\n self.__accesskeyid = attributes[ \"accesskeyid\" ]\n- if \"acl\" in attributes and attributes[ \"acl\" ] is not None:\n+ if \"acl\" in attributes and attributes[ \"acl\" ] is not None: # pragma no branch\n self.__acl = attributes[ \"acl\" ]\n- if \"bucket\" in attributes and attributes[ \"bucket\" ] is not None:\n+ if \"bucket\" in attributes and attributes[ \"bucket\" ] is not None: # pragma no branch\n self.__bucket = attributes[ \"bucket\" ]\n- if \"content_type\" in attributes and attributes[ \"content_type\" ] is not None:\n+ if \"content_type\" in attributes and attributes[ \"content_type\" ] is not None: # pragma no branch\n self.__content_type = attributes[ \"content_type\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"description\" in attributes and attributes[ \"description\" ] is not None:\n+ if \"description\" in attributes and attributes[ \"description\" ] is not None: # pragma no branch\n self.__description = attributes[ \"description\" ]\n- if \"download_count\" in attributes and attributes[ \"download_count\" ] is not None:\n+ if \"download_count\" in attributes and attributes[ \"download_count\" ] is not None: # pragma no branch\n self.__download_count = attributes[ \"download_count\" ]\n- if \"expirationdate\" in attributes and attributes[ \"expirationdate\" ] is not None:\n+ if \"expirationdate\" in attributes and attributes[ \"expirationdate\" ] is not None: # pragma no branch\n self.__expirationdate = attributes[ \"expirationdate\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"mime_type\" in attributes and attributes[ \"mime_type\" ] is not None:\n+ if \"mime_type\" in attributes and attributes[ \"mime_type\" ] is not None: # pragma no branch\n self.__mime_type = attributes[ \"mime_type\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n self.__name = attributes[ \"name\" ]\n- if \"path\" in attributes and attributes[ \"path\" ] is not None:\n+ if \"path\" in attributes and attributes[ \"path\" ] is not None: # pragma no branch\n self.__path = attributes[ \"path\" ]\n- if \"policy\" in attributes and attributes[ \"policy\" ] is not None:\n+ if \"policy\" in attributes and attributes[ \"policy\" ] is not None: # pragma no branch\n self.__policy = attributes[ \"policy\" ]\n- if \"prefix\" in attributes and attributes[ \"prefix\" ] is not None:\n+ if \"prefix\" in attributes and attributes[ \"prefix\" ] is not None: # pragma no branch\n self.__prefix = attributes[ \"prefix\" ]\n- if \"redirect\" in attributes and attributes[ \"redirect\" ] is not None:\n+ if \"redirect\" in attributes and attributes[ \"redirect\" ] is not None: # pragma no branch\n self.__redirect = attributes[ \"redirect\" ]\n- if \"s3_url\" in attributes and attributes[ \"s3_url\" ] is not None:\n+ if \"s3_url\" in attributes and attributes[ \"s3_url\" ] is not None: # pragma no branch\n self.__s3_url = attributes[ \"s3_url\" ]\n- if \"signature\" in attributes and attributes[ \"signature\" ] is not None:\n+ if \"signature\" in attributes and attributes[ \"signature\" ] is not None: # pragma no branch\n self.__signature = attributes[ \"signature\" ]\n- if \"size\" in attributes and attributes[ \"size\" ] is not None:\n+ if \"size\" in attributes and attributes[ \"size\" ] is not None: # pragma no branch\n self.__size = attributes[ \"size\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":20,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Download.py","changes":40,"additions":20,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Download.py","filename":"src/github/Download.py"},{"patch":"@@ -60,22 +60,22 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"actor\", \"created_at\", \"id\", \"org\", \"payload\", \"public\", \"repo\", \"type\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"actor\" in attributes and attributes[ \"actor\" ] is not None:\n+ if \"actor\" in attributes and attributes[ \"actor\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"actor\" ], dict )\n self.__actor = NamedUser.NamedUser( self.__requester, attributes[ \"actor\" ], completion = LazyCompletion )\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"org\" in attributes and attributes[ \"org\" ] is not None:\n+ if \"org\" in attributes and attributes[ \"org\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"org\" ], dict )\n self.__org = Organization.Organization( self.__requester, attributes[ \"org\" ], completion = LazyCompletion )\n- if \"payload\" in attributes and attributes[ \"payload\" ] is not None:\n+ if \"payload\" in attributes and attributes[ \"payload\" ] is not None: # pragma no branch\n self.__payload = attributes[ \"payload\" ]\n- if \"public\" in attributes and attributes[ \"public\" ] is not None:\n+ if \"public\" in attributes and attributes[ \"public\" ] is not None: # pragma no branch\n self.__public = attributes[ \"public\" ]\n- if \"repo\" in attributes and attributes[ \"repo\" ] is not None:\n+ if \"repo\" in attributes and attributes[ \"repo\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"repo\" ], dict )\n self.__repo = Repository.Repository( self.__requester, attributes[ \"repo\" ], completion = LazyCompletion )\n- if \"type\" in attributes and attributes[ \"type\" ] is not None:\n+ if \"type\" in attributes and attributes[ \"type\" ] is not None: # pragma no branch\n self.__type = attributes[ \"type\" ]","status":"modified","deletions":8,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Event.py","changes":16,"additions":8,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Event.py","filename":"src/github/Event.py"},{"patch":"@@ -220,53 +220,53 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"comments\", \"created_at\", \"description\", \"files\", \"fork_of\", \"forks\", \"git_pull_url\", \"git_push_url\", \"history\", \"html_url\", \"id\", \"public\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"comments\" in attributes and attributes[ \"comments\" ] is not None:\n+ if \"comments\" in attributes and attributes[ \"comments\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"comments\" ], int )\n self.__comments = attributes[ \"comments\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"description\" in attributes and attributes[ \"description\" ] is not None:\n+ if \"description\" in attributes and attributes[ \"description\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"description\" ], ( str, unicode ) )\n self.__description = attributes[ \"description\" ]\n- if \"files\" in attributes and attributes[ \"files\" ] is not None:\n+ if \"files\" in attributes and attributes[ \"files\" ] is not None: # pragma no branch\n self.__files = attributes[ \"files\" ]\n- if \"fork_of\" in attributes and attributes[ \"fork_of\" ] is not None:\n+ if \"fork_of\" in attributes and attributes[ \"fork_of\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"fork_of\" ], dict )\n self.__fork_of = Gist( self.__requester, attributes[ \"fork_of\" ], completion = LazyCompletion )\n- if \"forks\" in attributes and attributes[ \"forks\" ] is not None:\n+ if \"forks\" in attributes and attributes[ \"forks\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"forks\" ], list ) and ( len( attributes[ \"forks\" ] ) == 0 or isinstance( attributes[ \"forks\" ][ 0 ], dict ) )\n self.__forks = [\n Gist( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"forks\" ]\n ]\n- if \"git_pull_url\" in attributes and attributes[ \"git_pull_url\" ] is not None:\n+ if \"git_pull_url\" in attributes and attributes[ \"git_pull_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"git_pull_url\" ], ( str, unicode ) )\n self.__git_pull_url = attributes[ \"git_pull_url\" ]\n- if \"git_push_url\" in attributes and attributes[ \"git_push_url\" ] is not None:\n+ if \"git_push_url\" in attributes and attributes[ \"git_push_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"git_push_url\" ], ( str, unicode ) )\n self.__git_push_url = attributes[ \"git_push_url\" ]\n- if \"history\" in attributes and attributes[ \"history\" ] is not None:\n+ if \"history\" in attributes and attributes[ \"history\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"history\" ], list ) and ( len( attributes[ \"history\" ] ) == 0 or isinstance( attributes[ \"history\" ][ 0 ], dict ) )\n self.__history = [\n GistHistoryState.GistHistoryState( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"history\" ]\n ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], ( str, unicode ) )\n self.__id = attributes[ \"id\" ]\n- if \"public\" in attributes and attributes[ \"public\" ] is not None:\n+ if \"public\" in attributes and attributes[ \"public\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public\" ], bool )\n self.__public = attributes[ \"public\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"updated_at\" ], ( str, unicode ) )\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","status":"modified","deletions":15,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Gist.py","changes":30,"additions":15,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Gist.py","filename":"src/github/Gist.py"},{"patch":"@@ -68,16 +68,16 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"body\", \"created_at\", \"id\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"body\" in attributes and attributes[ \"body\" ] is not None:\n+ if \"body\" in attributes and attributes[ \"body\" ] is not None: # pragma no branch\n self.__body = attributes[ \"body\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","status":"modified","deletions":6,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GistComment.py","changes":12,"additions":6,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GistComment.py","filename":"src/github/GistComment.py"},{"patch":"@@ -44,18 +44,18 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"change_status\", \"committed_at\", \"url\", \"user\", \"version\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"change_status\" in attributes and attributes[ \"change_status\" ] is not None:\n+ if \"change_status\" in attributes and attributes[ \"change_status\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"change_status\" ], dict )\n self.__change_status = CommitStats.CommitStats( self.__requester, attributes[ \"change_status\" ], completion = LazyCompletion )\n- if \"committed_at\" in attributes and attributes[ \"committed_at\" ] is not None:\n+ if \"committed_at\" in attributes and attributes[ \"committed_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"committed_at\" ], ( str, unicode ) )\n self.__committed_at = attributes[ \"committed_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )\n- if \"version\" in attributes and attributes[ \"version\" ] is not None:\n+ if \"version\" in attributes and attributes[ \"version\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"version\" ], ( str, unicode ) )\n self.__version = attributes[ \"version\" ]","status":"modified","deletions":5,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GistHistoryState.py","changes":10,"additions":5,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GistHistoryState.py","filename":"src/github/GistHistoryState.py"},{"patch":"@@ -32,12 +32,12 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"date\", \"email\", \"name\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"date\" in attributes and attributes[ \"date\" ] is not None:\n+ if \"date\" in attributes and attributes[ \"date\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"date\" ], ( str, unicode ) )\n self.__date = attributes[ \"date\" ]\n- if \"email\" in attributes and attributes[ \"email\" ] is not None:\n+ if \"email\" in attributes and attributes[ \"email\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"email\" ], ( str, unicode ) )\n self.__email = attributes[ \"email\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]","status":"modified","deletions":3,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitAuthor.py","changes":6,"additions":3,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitAuthor.py","filename":"src/github/GitAuthor.py"},{"patch":"@@ -42,18 +42,18 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"content\", \"encoding\", \"sha\", \"size\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"content\" in attributes and attributes[ \"content\" ] is not None:\n+ if \"content\" in attributes and attributes[ \"content\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"content\" ], ( str, unicode ) )\n self.__content = attributes[ \"content\" ]\n- if \"encoding\" in attributes and attributes[ \"encoding\" ] is not None:\n+ if \"encoding\" in attributes and attributes[ \"encoding\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"encoding\" ], ( str, unicode ) )\n self.__encoding = attributes[ \"encoding\" ]\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"size\" in attributes and attributes[ \"size\" ] is not None:\n+ if \"size\" in attributes and attributes[ \"size\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"size\" ], int )\n self.__size = attributes[ \"size\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":5,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitBlob.py","changes":10,"additions":5,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitBlob.py","filename":"src/github/GitBlob.py"},{"patch":"@@ -55,27 +55,27 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"author\", \"committer\", \"message\", \"parents\", \"sha\", \"tree\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"author\" in attributes and attributes[ \"author\" ] is not None:\n+ if \"author\" in attributes and attributes[ \"author\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"author\" ], dict )\n self.__author = GitAuthor.GitAuthor( self.__requester, attributes[ \"author\" ], completion = LazyCompletion )\n- if \"committer\" in attributes and attributes[ \"committer\" ] is not None:\n+ if \"committer\" in attributes and attributes[ \"committer\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"committer\" ], dict )\n self.__committer = GitAuthor.GitAuthor( self.__requester, attributes[ \"committer\" ], completion = LazyCompletion )\n- if \"message\" in attributes and attributes[ \"message\" ] is not None:\n+ if \"message\" in attributes and attributes[ \"message\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"message\" ], ( str, unicode ) )\n self.__message = attributes[ \"message\" ]\n- if \"parents\" in attributes and attributes[ \"parents\" ] is not None:\n+ if \"parents\" in attributes and attributes[ \"parents\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"parents\" ], list ) and ( len( attributes[ \"parents\" ] ) == 0 or isinstance( attributes[ \"parents\" ][ 0 ], dict ) )\n self.__parents = [\n GitCommit( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"parents\" ]\n ]\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"tree\" in attributes and attributes[ \"tree\" ] is not None:\n+ if \"tree\" in attributes and attributes[ \"tree\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"tree\" ], dict )\n self.__tree = GitTree.GitTree( self.__requester, attributes[ \"tree\" ], completion = LazyCompletion )\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":7,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitCommit.py","changes":14,"additions":7,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitCommit.py","filename":"src/github/GitCommit.py"},{"patch":"@@ -32,12 +32,12 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"sha\", \"type\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"type\" in attributes and attributes[ \"type\" ] is not None:\n+ if \"type\" in attributes and attributes[ \"type\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"type\" ], ( str, unicode ) )\n self.__type = attributes[ \"type\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":3,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitObject.py","changes":6,"additions":3,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitObject.py","filename":"src/github/GitObject.py"},{"patch":"@@ -55,12 +55,12 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"object\", \"ref\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"object\" in attributes and attributes[ \"object\" ] is not None:\n+ if \"object\" in attributes and attributes[ \"object\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"object\" ], dict )\n self.__object = GitObject.GitObject( self.__requester, attributes[ \"object\" ], completion = LazyCompletion )\n- if \"ref\" in attributes and attributes[ \"ref\" ] is not None:\n+ if \"ref\" in attributes and attributes[ \"ref\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"ref\" ], ( str, unicode ) )\n self.__ref = attributes[ \"ref\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":3,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitRef.py","changes":6,"additions":3,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitRef.py","filename":"src/github/GitRef.py"},{"patch":"@@ -49,21 +49,21 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"message\", \"object\", \"sha\", \"tag\", \"tagger\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"message\" in attributes and attributes[ \"message\" ] is not None:\n+ if \"message\" in attributes and attributes[ \"message\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"message\" ], ( str, unicode ) )\n self.__message = attributes[ \"message\" ]\n- if \"object\" in attributes and attributes[ \"object\" ] is not None:\n+ if \"object\" in attributes and attributes[ \"object\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"object\" ], dict )\n self.__object = GitObject.GitObject( self.__requester, attributes[ \"object\" ], completion = LazyCompletion )\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"tag\" in attributes and attributes[ \"tag\" ] is not None:\n+ if \"tag\" in attributes and attributes[ \"tag\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"tag\" ], ( str, unicode ) )\n self.__tag = attributes[ \"tag\" ]\n- if \"tagger\" in attributes and attributes[ \"tagger\" ] is not None:\n+ if \"tagger\" in attributes and attributes[ \"tagger\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"tagger\" ], dict )\n self.__tagger = GitAuthor.GitAuthor( self.__requester, attributes[ \"tagger\" ], completion = LazyCompletion )\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":6,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitTag.py","changes":12,"additions":6,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitTag.py","filename":"src/github/GitTag.py"},{"patch":"@@ -33,15 +33,15 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"sha\", \"tree\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"tree\" in attributes and attributes[ \"tree\" ] is not None:\n+ if \"tree\" in attributes and attributes[ \"tree\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"tree\" ], list ) and ( len( attributes[ \"tree\" ] ) == 0 or isinstance( attributes[ \"tree\" ][ 0 ], dict ) )\n self.__tree = [\n GitTreeElement.GitTreeElement( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"tree\" ]\n ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":3,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitTree.py","changes":6,"additions":3,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitTree.py","filename":"src/github/GitTree.py"},{"patch":"@@ -47,21 +47,21 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"mode\", \"path\", \"sha\", \"size\", \"type\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"mode\" in attributes and attributes[ \"mode\" ] is not None:\n+ if \"mode\" in attributes and attributes[ \"mode\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"mode\" ], ( str, unicode ) )\n self.__mode = attributes[ \"mode\" ]\n- if \"path\" in attributes and attributes[ \"path\" ] is not None:\n+ if \"path\" in attributes and attributes[ \"path\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"path\" ], ( str, unicode ) )\n self.__path = attributes[ \"path\" ]\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"size\" in attributes and attributes[ \"size\" ] is not None:\n+ if \"size\" in attributes and attributes[ \"size\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"size\" ], int )\n self.__size = attributes[ \"size\" ]\n- if \"type\" in attributes and attributes[ \"type\" ] is not None:\n+ if \"type\" in attributes and attributes[ \"type\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"type\" ], ( str, unicode ) )\n self.__type = attributes[ \"type\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":6,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitTreeElement.py","changes":12,"additions":6,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitTreeElement.py","filename":"src/github/GitTreeElement.py"},{"patch":"@@ -99,21 +99,21 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"active\", \"config\", \"created_at\", \"events\", \"id\", \"last_response\", \"name\", \"updated_at\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"active\" in attributes and attributes[ \"active\" ] is not None:\n+ if \"active\" in attributes and attributes[ \"active\" ] is not None: # pragma no branch\n self.__active = attributes[ \"active\" ]\n- if \"config\" in attributes and attributes[ \"config\" ] is not None:\n+ if \"config\" in attributes and attributes[ \"config\" ] is not None: # pragma no branch\n self.__config = attributes[ \"config\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"events\" in attributes and attributes[ \"events\" ] is not None:\n+ if \"events\" in attributes and attributes[ \"events\" ] is not None: # pragma no branch\n self.__events = attributes[ \"events\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"last_response\" in attributes and attributes[ \"last_response\" ] is not None:\n+ if \"last_response\" in attributes and attributes[ \"last_response\" ] is not None: # pragma no branch\n self.__last_response = attributes[ \"last_response\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n self.__name = attributes[ \"name\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":9,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Hook.py","changes":18,"additions":9,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Hook.py","filename":"src/github/Hook.py"},{"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\n@@ -257,59 +268,59 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"assignee\", \"body\", \"closed_at\", \"closed_by\", \"comments\", \"created_at\", \"html_url\", \"id\", \"labels\", \"milestone\", \"number\", \"pull_request\", \"repository\", \"state\", \"title\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"assignee\" in attributes and attributes[ \"assignee\" ] is not None:\n+ if \"assignee\" in attributes and attributes[ \"assignee\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"assignee\" ], dict )\n self.__assignee = NamedUser.NamedUser( self.__requester, attributes[ \"assignee\" ], completion = LazyCompletion )\n- if \"body\" in attributes and attributes[ \"body\" ] is not None:\n+ if \"body\" in attributes and attributes[ \"body\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"body\" ], ( str, unicode ) )\n self.__body = attributes[ \"body\" ]\n- if \"closed_at\" in attributes and attributes[ \"closed_at\" ] is not None:\n+ if \"closed_at\" in attributes and attributes[ \"closed_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"closed_at\" ], ( str, unicode ) )\n self.__closed_at = attributes[ \"closed_at\" ]\n- if \"closed_by\" in attributes and attributes[ \"closed_by\" ] is not None:\n+ if \"closed_by\" in attributes and attributes[ \"closed_by\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"closed_by\" ], dict )\n self.__closed_by = NamedUser.NamedUser( self.__requester, attributes[ \"closed_by\" ], completion = LazyCompletion )\n- if \"comments\" in attributes and attributes[ \"comments\" ] is not None:\n+ if \"comments\" in attributes and attributes[ \"comments\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"comments\" ], int )\n self.__comments = attributes[ \"comments\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"labels\" in attributes and attributes[ \"labels\" ] is not None:\n+ if \"labels\" in attributes and attributes[ \"labels\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"labels\" ], list ) and ( len( attributes[ \"labels\" ] ) == 0 or isinstance( attributes[ \"labels\" ][ 0 ], dict ) )\n self.__labels = [\n Label.Label( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"labels\" ]\n ]\n- if \"milestone\" in attributes and attributes[ \"milestone\" ] is not None:\n+ if \"milestone\" in attributes and attributes[ \"milestone\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"milestone\" ], dict )\n self.__milestone = Milestone.Milestone( self.__requester, attributes[ \"milestone\" ], completion = LazyCompletion )\n- if \"number\" in attributes and attributes[ \"number\" ] is not None:\n+ if \"number\" in attributes and attributes[ \"number\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"number\" ], int )\n self.__number = attributes[ \"number\" ]\n- if \"pull_request\" in attributes and attributes[ \"pull_request\" ] is not None:\n+ if \"pull_request\" in attributes and attributes[ \"pull_request\" ] is not None: # pragma no branch\n self.__pull_request = attributes[ \"pull_request\" ]\n- if \"repository\" in attributes and attributes[ \"repository\" ] is not None:\n+ if \"repository\" in attributes and attributes[ \"repository\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"repository\" ], dict )\n self.__repository = Repository.Repository( self.__requester, attributes[ \"repository\" ], completion = LazyCompletion )\n- if \"state\" in attributes and attributes[ \"state\" ] is not None:\n+ if \"state\" in attributes and attributes[ \"state\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"state\" ], ( str, unicode ) )\n self.__state = attributes[ \"state\" ]\n- if \"title\" in attributes and attributes[ \"title\" ] is not None:\n+ if \"title\" in attributes and attributes[ \"title\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"title\" ], ( str, unicode ) )\n self.__title = attributes[ \"title\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"updated_at\" ], ( str, unicode ) )\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","status":"modified","deletions":21,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Issue.py","changes":53,"additions":32,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Issue.py","filename":"src/github/Issue.py"},{"patch":"@@ -68,16 +68,16 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"body\", \"created_at\", \"id\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"body\" in attributes and attributes[ \"body\" ] is not None:\n+ if \"body\" in attributes and attributes[ \"body\" ] is not None: # pragma no branch\n self.__body = attributes[ \"body\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","status":"modified","deletions":6,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/IssueComment.py","changes":12,"additions":6,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/IssueComment.py","filename":"src/github/IssueComment.py"},{"patch":"@@ -78,24 +78,24 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"actor\", \"commit_id\", \"created_at\", \"event\", \"id\", \"issue\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"actor\" in attributes and attributes[ \"actor\" ] is not None:\n+ if \"actor\" in attributes and attributes[ \"actor\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"actor\" ], dict )\n self.__actor = NamedUser.NamedUser( self.__requester, attributes[ \"actor\" ], completion = LazyCompletion )\n- if \"commit_id\" in attributes and attributes[ \"commit_id\" ] is not None:\n+ if \"commit_id\" in attributes and attributes[ \"commit_id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"commit_id\" ], ( str, unicode ) )\n self.__commit_id = attributes[ \"commit_id\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"event\" in attributes and attributes[ \"event\" ] is not None:\n+ if \"event\" in attributes and attributes[ \"event\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"event\" ], ( str, unicode ) )\n self.__event = attributes[ \"event\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"issue\" in attributes and attributes[ \"issue\" ] is not None:\n+ if \"issue\" in attributes and attributes[ \"issue\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"issue\" ], dict )\n self.__issue = Issue.Issue( self.__requester, attributes[ \"issue\" ], completion = LazyCompletion )\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":7,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/IssueEvent.py","changes":14,"additions":7,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/IssueEvent.py","filename":"src/github/IssueEvent.py"},{"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+ # @toto 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\n@@ -53,9 +60,9 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"color\", \"name\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"color\" in attributes and attributes[ \"color\" ] is not None:\n+ if \"color\" in attributes and attributes[ \"color\" ] is not None: # pragma no branch\n self.__color = attributes[ \"color\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n self.__name = attributes[ \"name\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":3,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Label.py","changes":13,"additions":10,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Label.py","filename":"src/github/Label.py"},{"patch":"@@ -114,36 +114,36 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"closed_issues\", \"created_at\", \"creator\", \"description\", \"due_on\", \"id\", \"number\", \"open_issues\", \"state\", \"title\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"closed_issues\" in attributes and attributes[ \"closed_issues\" ] is not None:\n+ if \"closed_issues\" in attributes and attributes[ \"closed_issues\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"closed_issues\" ], int )\n self.__closed_issues = attributes[ \"closed_issues\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"creator\" in attributes and attributes[ \"creator\" ] is not None:\n+ if \"creator\" in attributes and attributes[ \"creator\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"creator\" ], dict )\n self.__creator = NamedUser.NamedUser( self.__requester, attributes[ \"creator\" ], completion = LazyCompletion )\n- if \"description\" in attributes and attributes[ \"description\" ] is not None:\n+ if \"description\" in attributes and attributes[ \"description\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"description\" ], ( str, unicode ) )\n self.__description = attributes[ \"description\" ]\n- if \"due_on\" in attributes and attributes[ \"due_on\" ] is not None:\n+ if \"due_on\" in attributes and attributes[ \"due_on\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"due_on\" ], ( str, unicode ) )\n self.__due_on = attributes[ \"due_on\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"number\" in attributes and attributes[ \"number\" ] is not None:\n+ if \"number\" in attributes and attributes[ \"number\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"number\" ], int )\n self.__number = attributes[ \"number\" ]\n- if \"open_issues\" in attributes and attributes[ \"open_issues\" ] is not None:\n+ if \"open_issues\" in attributes and attributes[ \"open_issues\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"open_issues\" ], int )\n self.__open_issues = attributes[ \"open_issues\" ]\n- if \"state\" in attributes and attributes[ \"state\" ] is not None:\n+ if \"state\" in attributes and attributes[ \"state\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"state\" ], ( str, unicode ) )\n self.__state = attributes[ \"state\" ]\n- if \"title\" in attributes and attributes[ \"title\" ] is not None:\n+ if \"title\" in attributes and attributes[ \"title\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"title\" ], ( str, unicode ) )\n self.__title = attributes[ \"title\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":11,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Milestone.py","changes":22,"additions":11,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Milestone.py","filename":"src/github/Milestone.py"},{"patch":"@@ -365,81 +365,81 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"avatar_url\", \"bio\", \"blog\", \"collaborators\", \"company\", \"contributions\", \"created_at\", \"disk_usage\", \"email\", \"followers\", \"following\", \"gravatar_id\", \"hireable\", \"html_url\", \"id\", \"location\", \"login\", \"name\", \"owned_private_repos\", \"plan\", \"private_gists\", \"public_gists\", \"public_repos\", \"total_private_repos\", \"type\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"avatar_url\" in attributes and attributes[ \"avatar_url\" ] is not None:\n+ if \"avatar_url\" in attributes and attributes[ \"avatar_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"avatar_url\" ], ( str, unicode ) )\n self.__avatar_url = attributes[ \"avatar_url\" ]\n- if \"bio\" in attributes and attributes[ \"bio\" ] is not None:\n+ if \"bio\" in attributes and attributes[ \"bio\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"bio\" ], ( str, unicode ) )\n self.__bio = attributes[ \"bio\" ]\n- if \"blog\" in attributes and attributes[ \"blog\" ] is not None:\n+ if \"blog\" in attributes and attributes[ \"blog\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"blog\" ], ( str, unicode ) )\n self.__blog = attributes[ \"blog\" ]\n- if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None:\n+ if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"collaborators\" ], int )\n self.__collaborators = attributes[ \"collaborators\" ]\n- if \"company\" in attributes and attributes[ \"company\" ] is not None:\n+ if \"company\" in attributes and attributes[ \"company\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"company\" ], ( str, unicode ) )\n self.__company = attributes[ \"company\" ]\n- if \"contributions\" in attributes and attributes[ \"contributions\" ] is not None:\n+ if \"contributions\" in attributes and attributes[ \"contributions\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"contributions\" ], int )\n self.__contributions = attributes[ \"contributions\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"disk_usage\" in attributes and attributes[ \"disk_usage\" ] is not None:\n+ if \"disk_usage\" in attributes and attributes[ \"disk_usage\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"disk_usage\" ], int )\n self.__disk_usage = attributes[ \"disk_usage\" ]\n- if \"email\" in attributes and attributes[ \"email\" ] is not None:\n+ if \"email\" in attributes and attributes[ \"email\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"email\" ], ( str, unicode ) )\n self.__email = attributes[ \"email\" ]\n- if \"followers\" in attributes and attributes[ \"followers\" ] is not None:\n+ if \"followers\" in attributes and attributes[ \"followers\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"followers\" ], int )\n self.__followers = attributes[ \"followers\" ]\n- if \"following\" in attributes and attributes[ \"following\" ] is not None:\n+ if \"following\" in attributes and attributes[ \"following\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"following\" ], int )\n self.__following = attributes[ \"following\" ]\n- if \"gravatar_id\" in attributes and attributes[ \"gravatar_id\" ] is not None:\n+ if \"gravatar_id\" in attributes and attributes[ \"gravatar_id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"gravatar_id\" ], ( str, unicode ) )\n self.__gravatar_id = attributes[ \"gravatar_id\" ]\n- if \"hireable\" in attributes and attributes[ \"hireable\" ] is not None:\n+ if \"hireable\" in attributes and attributes[ \"hireable\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"hireable\" ], bool )\n self.__hireable = attributes[ \"hireable\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"location\" in attributes and attributes[ \"location\" ] is not None:\n+ if \"location\" in attributes and attributes[ \"location\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"location\" ], ( str, unicode ) )\n self.__location = attributes[ \"location\" ]\n- if \"login\" in attributes and attributes[ \"login\" ] is not None:\n+ if \"login\" in attributes and attributes[ \"login\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"login\" ], ( str, unicode ) )\n self.__login = attributes[ \"login\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]\n- if \"owned_private_repos\" in attributes and attributes[ \"owned_private_repos\" ] is not None:\n+ if \"owned_private_repos\" in attributes and attributes[ \"owned_private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"owned_private_repos\" ], int )\n self.__owned_private_repos = attributes[ \"owned_private_repos\" ]\n- if \"plan\" in attributes and attributes[ \"plan\" ] is not None:\n+ if \"plan\" in attributes and attributes[ \"plan\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"plan\" ], dict )\n self.__plan = Plan.Plan( self.__requester, attributes[ \"plan\" ], completion = LazyCompletion )\n- if \"private_gists\" in attributes and attributes[ \"private_gists\" ] is not None:\n+ if \"private_gists\" in attributes and attributes[ \"private_gists\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"private_gists\" ], int )\n self.__private_gists = attributes[ \"private_gists\" ]\n- if \"public_gists\" in attributes and attributes[ \"public_gists\" ] is not None:\n+ if \"public_gists\" in attributes and attributes[ \"public_gists\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public_gists\" ], int )\n self.__public_gists = attributes[ \"public_gists\" ]\n- if \"public_repos\" in attributes and attributes[ \"public_repos\" ] is not None:\n+ if \"public_repos\" in attributes and attributes[ \"public_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public_repos\" ], int )\n self.__public_repos = attributes[ \"public_repos\" ]\n- if \"total_private_repos\" in attributes and attributes[ \"total_private_repos\" ] is not None:\n+ if \"total_private_repos\" in attributes and attributes[ \"total_private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"total_private_repos\" ], int )\n self.__total_private_repos = attributes[ \"total_private_repos\" ]\n- if \"type\" in attributes and attributes[ \"type\" ] is not None:\n+ if \"type\" in attributes and attributes[ \"type\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"type\" ], ( str, unicode ) )\n self.__type = attributes[ \"type\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":26,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/NamedUser.py","changes":52,"additions":26,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/NamedUser.py","filename":"src/github/NamedUser.py"},{"patch":"@@ -390,75 +390,75 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"avatar_url\", \"billing_email\", \"blog\", \"collaborators\", \"company\", \"created_at\", \"disk_usage\", \"email\", \"followers\", \"following\", \"gravatar_id\", \"html_url\", \"id\", \"location\", \"login\", \"name\", \"owned_private_repos\", \"plan\", \"private_gists\", \"public_gists\", \"public_repos\", \"total_private_repos\", \"type\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"avatar_url\" in attributes and attributes[ \"avatar_url\" ] is not None:\n+ if \"avatar_url\" in attributes and attributes[ \"avatar_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"avatar_url\" ], ( str, unicode ) )\n self.__avatar_url = attributes[ \"avatar_url\" ]\n- if \"billing_email\" in attributes and attributes[ \"billing_email\" ] is not None:\n+ if \"billing_email\" in attributes and attributes[ \"billing_email\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"billing_email\" ], ( str, unicode ) )\n self.__billing_email = attributes[ \"billing_email\" ]\n- if \"blog\" in attributes and attributes[ \"blog\" ] is not None:\n+ if \"blog\" in attributes and attributes[ \"blog\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"blog\" ], ( str, unicode ) )\n self.__blog = attributes[ \"blog\" ]\n- if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None:\n+ if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"collaborators\" ], int )\n self.__collaborators = attributes[ \"collaborators\" ]\n- if \"company\" in attributes and attributes[ \"company\" ] is not None:\n+ if \"company\" in attributes and attributes[ \"company\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"company\" ], ( str, unicode ) )\n self.__company = attributes[ \"company\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"disk_usage\" in attributes and attributes[ \"disk_usage\" ] is not None:\n+ if \"disk_usage\" in attributes and attributes[ \"disk_usage\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"disk_usage\" ], int )\n self.__disk_usage = attributes[ \"disk_usage\" ]\n- if \"email\" in attributes and attributes[ \"email\" ] is not None:\n+ if \"email\" in attributes and attributes[ \"email\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"email\" ], ( str, unicode ) )\n self.__email = attributes[ \"email\" ]\n- if \"followers\" in attributes and attributes[ \"followers\" ] is not None:\n+ if \"followers\" in attributes and attributes[ \"followers\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"followers\" ], int )\n self.__followers = attributes[ \"followers\" ]\n- if \"following\" in attributes and attributes[ \"following\" ] is not None:\n+ if \"following\" in attributes and attributes[ \"following\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"following\" ], int )\n self.__following = attributes[ \"following\" ]\n- if \"gravatar_id\" in attributes and attributes[ \"gravatar_id\" ] is not None:\n+ if \"gravatar_id\" in attributes and attributes[ \"gravatar_id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"gravatar_id\" ], ( str, unicode ) )\n self.__gravatar_id = attributes[ \"gravatar_id\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"location\" in attributes and attributes[ \"location\" ] is not None:\n+ if \"location\" in attributes and attributes[ \"location\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"location\" ], ( str, unicode ) )\n self.__location = attributes[ \"location\" ]\n- if \"login\" in attributes and attributes[ \"login\" ] is not None:\n+ if \"login\" in attributes and attributes[ \"login\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"login\" ], ( str, unicode ) )\n self.__login = attributes[ \"login\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]\n- if \"owned_private_repos\" in attributes and attributes[ \"owned_private_repos\" ] is not None:\n+ if \"owned_private_repos\" in attributes and attributes[ \"owned_private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"owned_private_repos\" ], int )\n self.__owned_private_repos = attributes[ \"owned_private_repos\" ]\n- if \"plan\" in attributes and attributes[ \"plan\" ] is not None:\n+ if \"plan\" in attributes and attributes[ \"plan\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"plan\" ], dict )\n self.__plan = Plan.Plan( self.__requester, attributes[ \"plan\" ], completion = LazyCompletion )\n- if \"private_gists\" in attributes and attributes[ \"private_gists\" ] is not None:\n+ if \"private_gists\" in attributes and attributes[ \"private_gists\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"private_gists\" ], int )\n self.__private_gists = attributes[ \"private_gists\" ]\n- if \"public_gists\" in attributes and attributes[ \"public_gists\" ] is not None:\n+ if \"public_gists\" in attributes and attributes[ \"public_gists\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public_gists\" ], int )\n self.__public_gists = attributes[ \"public_gists\" ]\n- if \"public_repos\" in attributes and attributes[ \"public_repos\" ] is not None:\n+ if \"public_repos\" in attributes and attributes[ \"public_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public_repos\" ], int )\n self.__public_repos = attributes[ \"public_repos\" ]\n- if \"total_private_repos\" in attributes and attributes[ \"total_private_repos\" ] is not None:\n+ if \"total_private_repos\" in attributes and attributes[ \"total_private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"total_private_repos\" ], int )\n self.__total_private_repos = attributes[ \"total_private_repos\" ]\n- if \"type\" in attributes and attributes[ \"type\" ] is not None:\n+ if \"type\" in attributes and attributes[ \"type\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"type\" ], ( str, unicode ) )\n self.__type = attributes[ \"type\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":24,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Organization.py","changes":48,"additions":24,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Organization.py","filename":"src/github/Organization.py"},{"patch":"@@ -32,12 +32,12 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"admin\", \"pull\", \"push\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"admin\" in attributes and attributes[ \"admin\" ] is not None:\n+ if \"admin\" in attributes and attributes[ \"admin\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"admin\" ], bool )\n self.__admin = attributes[ \"admin\" ]\n- if \"pull\" in attributes and attributes[ \"pull\" ] is not None:\n+ if \"pull\" in attributes and attributes[ \"pull\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"pull\" ], bool )\n self.__pull = attributes[ \"pull\" ]\n- if \"push\" in attributes and attributes[ \"push\" ] is not None:\n+ if \"push\" in attributes and attributes[ \"push\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"push\" ], bool )\n self.__push = attributes[ \"push\" ]","status":"modified","deletions":3,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Permissions.py","changes":6,"additions":3,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Permissions.py","filename":"src/github/Permissions.py"},{"patch":"@@ -37,15 +37,15 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"collaborators\", \"name\", \"private_repos\", \"space\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None:\n+ if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"collaborators\" ], int )\n self.__collaborators = attributes[ \"collaborators\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]\n- if \"private_repos\" in attributes and attributes[ \"private_repos\" ] is not None:\n+ if \"private_repos\" in attributes and attributes[ \"private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"private_repos\" ], int )\n self.__private_repos = attributes[ \"private_repos\" ]\n- if \"space\" in attributes and attributes[ \"space\" ] is not None:\n+ if \"space\" in attributes and attributes[ \"space\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"space\" ], int )\n self.__space = attributes[ \"space\" ]","status":"modified","deletions":4,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Plan.py","changes":8,"additions":4,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Plan.py","filename":"src/github/Plan.py"},{"patch":"@@ -279,56 +279,56 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"additions\", \"base\", \"body\", \"changed_files\", \"closed_at\", \"comments\", \"commits\", \"created_at\", \"deletions\", \"diff_url\", \"head\", \"html_url\", \"id\", \"issue_url\", \"mergeable\", \"merged\", \"merged_at\", \"merged_by\", \"number\", \"patch_url\", \"review_comments\", \"state\", \"title\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"additions\" in attributes and attributes[ \"additions\" ] is not None:\n+ if \"additions\" in attributes and attributes[ \"additions\" ] is not None: # pragma no branch\n self.__additions = attributes[ \"additions\" ]\n- if \"base\" in attributes and attributes[ \"base\" ] is not None:\n+ if \"base\" in attributes and attributes[ \"base\" ] is not None: # pragma no branch\n self.__base = attributes[ \"base\" ]\n- if \"body\" in attributes and attributes[ \"body\" ] is not None:\n+ if \"body\" in attributes and attributes[ \"body\" ] is not None: # pragma no branch\n self.__body = attributes[ \"body\" ]\n- if \"changed_files\" in attributes and attributes[ \"changed_files\" ] is not None:\n+ if \"changed_files\" in attributes and attributes[ \"changed_files\" ] is not None: # pragma no branch\n self.__changed_files = attributes[ \"changed_files\" ]\n- if \"closed_at\" in attributes and attributes[ \"closed_at\" ] is not None:\n+ if \"closed_at\" in attributes and attributes[ \"closed_at\" ] is not None: # pragma no branch\n self.__closed_at = attributes[ \"closed_at\" ]\n- if \"comments\" in attributes and attributes[ \"comments\" ] is not None:\n+ if \"comments\" in attributes and attributes[ \"comments\" ] is not None: # pragma no branch\n self.__comments = attributes[ \"comments\" ]\n- if \"commits\" in attributes and attributes[ \"commits\" ] is not None:\n+ if \"commits\" in attributes and attributes[ \"commits\" ] is not None: # pragma no branch\n self.__commits = attributes[ \"commits\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None:\n+ if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None: # pragma no branch\n self.__deletions = attributes[ \"deletions\" ]\n- if \"diff_url\" in attributes and attributes[ \"diff_url\" ] is not None:\n+ if \"diff_url\" in attributes and attributes[ \"diff_url\" ] is not None: # pragma no branch\n self.__diff_url = attributes[ \"diff_url\" ]\n- if \"head\" in attributes and attributes[ \"head\" ] is not None:\n+ if \"head\" in attributes and attributes[ \"head\" ] is not None: # pragma no branch\n self.__head = attributes[ \"head\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"issue_url\" in attributes and attributes[ \"issue_url\" ] is not None:\n+ if \"issue_url\" in attributes and attributes[ \"issue_url\" ] is not None: # pragma no branch\n self.__issue_url = attributes[ \"issue_url\" ]\n- if \"mergeable\" in attributes and attributes[ \"mergeable\" ] is not None:\n+ if \"mergeable\" in attributes and attributes[ \"mergeable\" ] is not None: # pragma no branch\n self.__mergeable = attributes[ \"mergeable\" ]\n- if \"merged\" in attributes and attributes[ \"merged\" ] is not None:\n+ if \"merged\" in attributes and attributes[ \"merged\" ] is not None: # pragma no branch\n self.__merged = attributes[ \"merged\" ]\n- if \"merged_at\" in attributes and attributes[ \"merged_at\" ] is not None:\n+ if \"merged_at\" in attributes and attributes[ \"merged_at\" ] is not None: # pragma no branch\n self.__merged_at = attributes[ \"merged_at\" ]\n- if \"merged_by\" in attributes and attributes[ \"merged_by\" ] is not None:\n+ if \"merged_by\" in attributes and attributes[ \"merged_by\" ] is not None: # pragma no branch\n self.__merged_by = attributes[ \"merged_by\" ]\n- if \"number\" in attributes and attributes[ \"number\" ] is not None:\n+ if \"number\" in attributes and attributes[ \"number\" ] is not None: # pragma no branch\n self.__number = attributes[ \"number\" ]\n- if \"patch_url\" in attributes and attributes[ \"patch_url\" ] is not None:\n+ if \"patch_url\" in attributes and attributes[ \"patch_url\" ] is not None: # pragma no branch\n self.__patch_url = attributes[ \"patch_url\" ]\n- if \"review_comments\" in attributes and attributes[ \"review_comments\" ] is not None:\n+ if \"review_comments\" in attributes and attributes[ \"review_comments\" ] is not None: # pragma no branch\n self.__review_comments = attributes[ \"review_comments\" ]\n- if \"state\" in attributes and attributes[ \"state\" ] is not None:\n+ if \"state\" in attributes and attributes[ \"state\" ] is not None: # pragma no branch\n self.__state = attributes[ \"state\" ]\n- if \"title\" in attributes and attributes[ \"title\" ] is not None:\n+ if \"title\" in attributes and attributes[ \"title\" ] is not None: # pragma no branch\n self.__title = attributes[ \"title\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","status":"modified","deletions":26,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/PullRequest.py","changes":52,"additions":26,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/PullRequest.py","filename":"src/github/PullRequest.py"},{"patch":"@@ -121,26 +121,26 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"body\", \"commit_id\", \"created_at\", \"html_url\", \"id\", \"line\", \"path\", \"position\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"body\" in attributes and attributes[ \"body\" ] is not None:\n+ if \"body\" in attributes and attributes[ \"body\" ] is not None: # pragma no branch\n self.__body = attributes[ \"body\" ]\n- if \"commit_id\" in attributes and attributes[ \"commit_id\" ] is not None:\n+ if \"commit_id\" in attributes and attributes[ \"commit_id\" ] is not None: # pragma no branch\n self.__commit_id = attributes[ \"commit_id\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"line\" in attributes and attributes[ \"line\" ] is not None:\n+ if \"line\" in attributes and attributes[ \"line\" ] is not None: # pragma no branch\n self.__line = attributes[ \"line\" ]\n- if \"path\" in attributes and attributes[ \"path\" ] is not None:\n+ if \"path\" in attributes and attributes[ \"path\" ] is not None: # pragma no branch\n self.__path = attributes[ \"path\" ]\n- if \"position\" in attributes and attributes[ \"position\" ] is not None:\n+ if \"position\" in attributes and attributes[ \"position\" ] is not None: # pragma no branch\n self.__position = attributes[ \"position\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","status":"modified","deletions":11,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/PullRequestComment.py","changes":22,"additions":11,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/PullRequestComment.py","filename":"src/github/PullRequestComment.py"},{"patch":"@@ -62,21 +62,21 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"additions\", \"blob_url\", \"changes\", \"deletions\", \"filename\", \"patch\", \"raw_url\", \"sha\", \"status\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"additions\" in attributes and attributes[ \"additions\" ] is not None:\n+ if \"additions\" in attributes and attributes[ \"additions\" ] is not None: # pragma no branch\n self.__additions = attributes[ \"additions\" ]\n- if \"blob_url\" in attributes and attributes[ \"blob_url\" ] is not None:\n+ if \"blob_url\" in attributes and attributes[ \"blob_url\" ] is not None: # pragma no branch\n self.__blob_url = attributes[ \"blob_url\" ]\n- if \"changes\" in attributes and attributes[ \"changes\" ] is not None:\n+ if \"changes\" in attributes and attributes[ \"changes\" ] is not None: # pragma no branch\n self.__changes = attributes[ \"changes\" ]\n- if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None:\n+ if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None: # pragma no branch\n self.__deletions = attributes[ \"deletions\" ]\n- if \"filename\" in attributes and attributes[ \"filename\" ] is not None:\n+ if \"filename\" in attributes and attributes[ \"filename\" ] is not None: # pragma no branch\n self.__filename = attributes[ \"filename\" ]\n- if \"patch\" in attributes and attributes[ \"patch\" ] is not None:\n+ if \"patch\" in attributes and attributes[ \"patch\" ] is not None: # pragma no branch\n self.__patch = attributes[ \"patch\" ]\n- if \"raw_url\" in attributes and attributes[ \"raw_url\" ] is not None:\n+ if \"raw_url\" in attributes and attributes[ \"raw_url\" ] is not None: # pragma no branch\n self.__raw_url = attributes[ \"raw_url\" ]\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n self.__sha = attributes[ \"sha\" ]\n- if \"status\" in attributes and attributes[ \"status\" ] is not None:\n+ if \"status\" in attributes and attributes[ \"status\" ] is not None: # pragma no branch\n self.__status = attributes[ \"status\" ]","status":"modified","deletions":9,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/PullRequestFile.py","changes":18,"additions":9,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/PullRequestFile.py","filename":"src/github/PullRequestFile.py"},{"patch":"@@ -905,96 +905,96 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n 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\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"clone_url\" in attributes and attributes[ \"clone_url\" ] is not None:\n+ if \"clone_url\" in attributes and attributes[ \"clone_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"clone_url\" ], ( str, unicode ) )\n self.__clone_url = attributes[ \"clone_url\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"description\" in attributes and attributes[ \"description\" ] is not None:\n+ if \"description\" in attributes and attributes[ \"description\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"description\" ], ( str, unicode ) )\n self.__description = attributes[ \"description\" ]\n- if \"fork\" in attributes and attributes[ \"fork\" ] is not None:\n+ if \"fork\" in attributes and attributes[ \"fork\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"fork\" ], bool )\n self.__fork = attributes[ \"fork\" ]\n- if \"forks\" in attributes and attributes[ \"forks\" ] is not None:\n+ if \"forks\" in attributes and attributes[ \"forks\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"forks\" ], int )\n self.__forks = attributes[ \"forks\" ]\n- if \"full_name\" in attributes and attributes[ \"full_name\" ] is not None:\n+ if \"full_name\" in attributes and attributes[ \"full_name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"full_name\" ], ( str, unicode ) )\n self.__full_name = attributes[ \"full_name\" ]\n- if \"git_url\" in attributes and attributes[ \"git_url\" ] is not None:\n+ if \"git_url\" in attributes and attributes[ \"git_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"git_url\" ], ( str, unicode ) )\n self.__git_url = attributes[ \"git_url\" ]\n- if \"has_downloads\" in attributes and attributes[ \"has_downloads\" ] is not None:\n+ if \"has_downloads\" in attributes and attributes[ \"has_downloads\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"has_downloads\" ], bool )\n self.__has_downloads = attributes[ \"has_downloads\" ]\n- if \"has_issues\" in attributes and attributes[ \"has_issues\" ] is not None:\n+ if \"has_issues\" in attributes and attributes[ \"has_issues\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"has_issues\" ], bool )\n self.__has_issues = attributes[ \"has_issues\" ]\n- if \"has_wiki\" in attributes and attributes[ \"has_wiki\" ] is not None:\n+ if \"has_wiki\" in attributes and attributes[ \"has_wiki\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"has_wiki\" ], bool )\n self.__has_wiki = attributes[ \"has_wiki\" ]\n- if \"homepage\" in attributes and attributes[ \"homepage\" ] is not None:\n+ if \"homepage\" in attributes and attributes[ \"homepage\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"homepage\" ], ( str, unicode ) )\n self.__homepage = attributes[ \"homepage\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"language\" in attributes and attributes[ \"language\" ] is not None:\n+ if \"language\" in attributes and attributes[ \"language\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"language\" ], ( str, unicode ) )\n self.__language = attributes[ \"language\" ]\n- if \"master_branch\" in attributes and attributes[ \"master_branch\" ] is not None:\n+ if \"master_branch\" in attributes and attributes[ \"master_branch\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"master_branch\" ], ( str, unicode ) )\n self.__master_branch = attributes[ \"master_branch\" ]\n- if \"mirror_url\" in attributes and attributes[ \"mirror_url\" ] is not None:\n+ if \"mirror_url\" in attributes and attributes[ \"mirror_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"mirror_url\" ], ( str, unicode ) )\n self.__mirror_url = attributes[ \"mirror_url\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]\n- if \"open_issues\" in attributes and attributes[ \"open_issues\" ] is not None:\n+ if \"open_issues\" in attributes and attributes[ \"open_issues\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"open_issues\" ], int )\n self.__open_issues = attributes[ \"open_issues\" ]\n- if \"organization\" in attributes and attributes[ \"organization\" ] is not None:\n+ if \"organization\" in attributes and attributes[ \"organization\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"organization\" ], dict )\n self.__organization = Organization.Organization( self.__requester, attributes[ \"organization\" ], completion = LazyCompletion )\n- if \"owner\" in attributes and attributes[ \"owner\" ] is not None:\n+ if \"owner\" in attributes and attributes[ \"owner\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"owner\" ], dict )\n self.__owner = NamedUser.NamedUser( self.__requester, attributes[ \"owner\" ], completion = LazyCompletion )\n- if \"parent\" in attributes and attributes[ \"parent\" ] is not None:\n+ if \"parent\" in attributes and attributes[ \"parent\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"parent\" ], dict )\n self.__parent = Repository( self.__requester, attributes[ \"parent\" ], completion = LazyCompletion )\n- if \"permissions\" in attributes and attributes[ \"permissions\" ] is not None:\n+ if \"permissions\" in attributes and attributes[ \"permissions\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"permissions\" ], dict )\n self.__permissions = Permissions.Permissions( self.__requester, attributes[ \"permissions\" ], completion = LazyCompletion )\n- if \"private\" in attributes and attributes[ \"private\" ] is not None:\n+ if \"private\" in attributes and attributes[ \"private\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"private\" ], bool )\n self.__private = attributes[ \"private\" ]\n- if \"pushed_at\" in attributes and attributes[ \"pushed_at\" ] is not None:\n+ if \"pushed_at\" in attributes and attributes[ \"pushed_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"pushed_at\" ], ( str, unicode ) )\n self.__pushed_at = attributes[ \"pushed_at\" ]\n- if \"size\" in attributes and attributes[ \"size\" ] is not None:\n+ if \"size\" in attributes and attributes[ \"size\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"size\" ], int )\n self.__size = attributes[ \"size\" ]\n- if \"source\" in attributes and attributes[ \"source\" ] is not None:\n+ if \"source\" in attributes and attributes[ \"source\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"source\" ], dict )\n self.__source = Repository( self.__requester, attributes[ \"source\" ], completion = LazyCompletion )\n- if \"ssh_url\" in attributes and attributes[ \"ssh_url\" ] is not None:\n+ if \"ssh_url\" in attributes and attributes[ \"ssh_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"ssh_url\" ], ( str, unicode ) )\n self.__ssh_url = attributes[ \"ssh_url\" ]\n- if \"svn_url\" in attributes and attributes[ \"svn_url\" ] is not None:\n+ if \"svn_url\" in attributes and attributes[ \"svn_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"svn_url\" ], ( str, unicode ) )\n self.__svn_url = attributes[ \"svn_url\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"updated_at\" ], ( str, unicode ) )\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]\n- if \"watchers\" in attributes and attributes[ \"watchers\" ] is not None:\n+ if \"watchers\" in attributes and attributes[ \"watchers\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"watchers\" ], int )\n self.__watchers = attributes[ \"watchers\" ]","status":"modified","deletions":31,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Repository.py","changes":62,"additions":31,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Repository.py","filename":"src/github/Repository.py"},{"patch":"@@ -87,14 +87,14 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"id\", \"key\", \"title\", \"url\", \"verified\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"key\" in attributes and attributes[ \"key\" ] is not None:\n+ if \"key\" in attributes and attributes[ \"key\" ] is not None: # pragma no branch\n self.__key = attributes[ \"key\" ]\n- if \"title\" in attributes and attributes[ \"title\" ] is not None:\n+ if \"title\" in attributes and attributes[ \"title\" ] is not None: # pragma no branch\n self.__title = attributes[ \"title\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]\n- if \"verified\" in attributes and attributes[ \"verified\" ] is not None:\n+ if \"verified\" in attributes and attributes[ \"verified\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"verified\" ], bool )\n self.__verified = attributes[ \"verified\" ]","status":"modified","deletions":5,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/RepositoryKey.py","changes":10,"additions":5,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/RepositoryKey.py","filename":"src/github/RepositoryKey.py"},{"patch":"@@ -38,15 +38,15 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"commit\", \"name\", \"tarball_url\", \"zipball_url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"commit\" in attributes and attributes[ \"commit\" ] is not None:\n+ if \"commit\" in attributes and attributes[ \"commit\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"commit\" ], dict )\n self.__commit = Commit.Commit( self.__requester, attributes[ \"commit\" ], completion = LazyCompletion )\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]\n- if \"tarball_url\" in attributes and attributes[ \"tarball_url\" ] is not None:\n+ if \"tarball_url\" in attributes and attributes[ \"tarball_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"tarball_url\" ], ( str, unicode ) )\n self.__tarball_url = attributes[ \"tarball_url\" ]\n- if \"zipball_url\" in attributes and attributes[ \"zipball_url\" ] is not None:\n+ if \"zipball_url\" in attributes and attributes[ \"zipball_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"zipball_url\" ], ( str, unicode ) )\n self.__zipball_url = attributes[ \"zipball_url\" ]","status":"modified","deletions":4,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Tag.py","changes":8,"additions":4,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Tag.py","filename":"src/github/Tag.py"},{"patch":"@@ -172,15 +172,15 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"id\", \"members_count\", \"name\", \"permission\", \"repos_count\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"members_count\" in attributes and attributes[ \"members_count\" ] is not None:\n+ if \"members_count\" in attributes and attributes[ \"members_count\" ] is not None: # pragma no branch\n self.__members_count = attributes[ \"members_count\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n self.__name = attributes[ \"name\" ]\n- if \"permission\" in attributes and attributes[ \"permission\" ] is not None:\n+ if \"permission\" in attributes and attributes[ \"permission\" ] is not None: # pragma no branch\n self.__permission = attributes[ \"permission\" ]\n- if \"repos_count\" in attributes and attributes[ \"repos_count\" ] is not None:\n+ if \"repos_count\" in attributes and attributes[ \"repos_count\" ] is not None: # pragma no branch\n self.__repos_count = attributes[ \"repos_count\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]","status":"modified","deletions":6,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Team.py","changes":12,"additions":6,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Team.py","filename":"src/github/Team.py"},{"patch":"@@ -87,14 +87,14 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"id\", \"key\", \"title\", \"url\", \"verified\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"key\" in attributes and attributes[ \"key\" ] is not None:\n+ if \"key\" in attributes and attributes[ \"key\" ] is not None: # pragma no branch\n self.__key = attributes[ \"key\" ]\n- if \"title\" in attributes and attributes[ \"title\" ] is not None:\n+ if \"title\" in attributes and attributes[ \"title\" ] is not None: # pragma no branch\n self.__title = attributes[ \"title\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]\n- if \"verified\" in attributes and attributes[ \"verified\" ] is not None:\n+ if \"verified\" in attributes and attributes[ \"verified\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"verified\" ], bool )\n self.__verified = attributes[ \"verified\" ]","status":"modified","deletions":5,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/UserKey.py","changes":10,"additions":5,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/UserKey.py","filename":"src/github/UserKey.py"},{"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","status":"modified","deletions":1,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/Issue.py","changes":26,"additions":25,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/Issue.py","filename":"test/Issue.py"},{"patch":"@@ -3,13 +3,13 @@\n class IssueEvent( Framework.TestCase ):\r\n def setUp( self ):\r\n Framework.TestCase.setUp( self )\r\n- self.event = self.g.get_user().get_repo( \"PyGithub\" ).get_issues_event( 15819975 )\r\n+ self.event = self.g.get_user().get_repo( \"PyGithub\" ).get_issues_event( 16348656 )\r\n \r\n def testAttributes( self ):\r\n self.assertEqual( self.event.actor.login, \"jacquev6\" )\r\n- self.assertEqual( self.event.commit_id, None )\r\n- self.assertEqual( self.event.created_at, \"2012-05-19T10:38:23Z\" )\r\n- self.assertEqual( self.event.event, \"subscribed\" )\r\n- self.assertEqual( self.event.id, 15819975 )\r\n- self.assertEqual( self.event.issue.number, 28 )\r\n- self.assertEqual( self.event.url, \"https://api.github.com/repos/jacquev6/PyGithub/issues/events/15819975\" )\r\n+ self.assertEqual( self.event.commit_id, \"ed866fc43833802ab553e5ff8581c81bb00dd433\" )\r\n+ self.assertEqual( self.event.created_at, \"2012-05-27T07:29:25Z\" )\r\n+ self.assertEqual( self.event.event, \"referenced\" )\r\n+ self.assertEqual( self.event.id, 16348656 )\r\n+ self.assertEqual( self.event.issue.number, 30 )\r\n+ self.assertEqual( self.event.url, \"https://api.github.com/repos/jacquev6/PyGithub/issues/events/16348656\" )\r","status":"modified","deletions":7,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/IssueEvent.py","changes":14,"additions":7,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/IssueEvent.py","filename":"test/IssueEvent.py"},{"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+","status":"added","deletions":0,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testAddAndRemoveLabels.txt","changes":45,"additions":45,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testAddAndRemoveLabels.txt","filename":"test/ReplayData/Issue.testAddAndRemoveLabels.txt"},{"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+","status":"added","deletions":0,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testDeleteAndSetLabels.txt","changes":35,"additions":35,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testDeleteAndSetLabels.txt","filename":"test/ReplayData/Issue.testDeleteAndSetLabels.txt"},{"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+","status":"added","deletions":0,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testGetLabels.txt","changes":5,"additions":5,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testGetLabels.txt","filename":"test/ReplayData/Issue.testGetLabels.txt"},{"patch":"@@ -1,15 +1,15 @@\n GET /user {'Authorization': 'Basic login_and_password_removed'} null\n 200\n-[('status', '200 OK'), ('x-ratelimit-remaining', '4907'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"99c9bfb75395b749e9913a4729126fb5\"'), ('date', 'Sun, 27 May 2012 07:19:30 GMT'), ('content-type', 'application/json; charset=utf-8')]\n-{\"private_gists\":5,\"type\":\"User\",\"company\":\"Criteo\",\"location\":\"Paris, France\",\"hireable\":false,\"gravatar_id\":\"b68de5ae38616c296fa345d2b9df2225\",\"bio\":\"\",\"following\":24,\"blog\":\"http://vincent-jacques.net\",\"avatar_url\":\"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png\",\"total_private_repos\":5,\"followers\":13,\"owned_private_repos\":5,\"disk_usage\":16976,\"collaborators\":0,\"html_url\":\"https://github.com/jacquev6\",\"url\":\"https://api.github.com/users/jacquev6\",\"name\":\"Vincent Jacques\",\"login\":\"jacquev6\",\"public_repos\":11,\"public_gists\":3,\"email\":\"vincent@vincent-jacques.net\",\"id\":327146,\"plan\":{\"private_repos\":5,\"collaborators\":1,\"name\":\"micro\",\"space\":614400},\"created_at\":\"2010-07-09T06:10:06Z\"}\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4996'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"8974bb1628a3e3a6d3eb3b08c1b5a46b\"'), ('date', 'Sun, 27 May 2012 07:32:54 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+{\"type\":\"User\",\"bio\":\"\",\"disk_usage\":16976,\"total_private_repos\":5,\"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\",\"owned_private_repos\":5,\"collaborators\":0,\"plan\":{\"collaborators\":1,\"private_repos\":5,\"name\":\"micro\",\"space\":614400},\"company\":\"Criteo\",\"gravatar_id\":\"b68de5ae38616c296fa345d2b9df2225\",\"login\":\"jacquev6\",\"email\":\"vincent@vincent-jacques.net\",\"public_gists\":3,\"followers\":13,\"name\":\"Vincent Jacques\",\"created_at\":\"2010-07-09T06:10:06Z\",\"blog\":\"http://vincent-jacques.net\",\"location\":\"Paris, France\",\"hireable\":false,\"id\":327146,\"private_gists\":5,\"public_repos\":11,\"following\":24,\"html_url\":\"https://github.com/jacquev6\"}\n \n GET /repos/jacquev6/PyGithub {'Authorization': 'Basic login_and_password_removed'} null\n 200\n-[('status', '200 OK'), ('x-ratelimit-remaining', '4906'), ('content-length', '1129'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"4c20acf0b23f75bbf25106b1a04f65a5\"'), ('date', 'Sun, 27 May 2012 07:19:31 GMT'), ('content-type', 'application/json; charset=utf-8')]\n-{\"description\":\"Python library implementing the full Github API v3\",\"full_name\":\"jacquev6/PyGithub\",\"has_wiki\":false,\"has_issues\":true,\"updated_at\":\"2012-05-27T06:55:28Z\",\"forks\":3,\"mirror_url\":null,\"homepage\":\"http://vincent-jacques.net/PyGithub\",\"ssh_url\":\"git@github.com:jacquev6/PyGithub.git\",\"open_issues\":16,\"fork\":false,\"svn_url\":\"https://github.com/jacquev6/PyGithub\",\"pushed_at\":\"2012-05-27T06:00:28Z\",\"size\":308,\"html_url\":\"https://github.com/jacquev6/PyGithub\",\"private\":false,\"url\":\"https://api.github.com/repos/jacquev6/PyGithub\",\"clone_url\":\"https://github.com/jacquev6/PyGithub.git\",\"owner\":{\"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},\"name\":\"PyGithub\",\"has_downloads\":true,\"language\":\"Python\",\"watchers\":15,\"git_url\":\"git://github.com/jacquev6/PyGithub.git\",\"id\":3544490,\"permissions\":{\"admin\":true,\"pull\":true,\"push\":true},\"created_at\":\"2012-02-25T12:53:47Z\"}\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4995'), ('content-length', '1129'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"f1e4eb3993a364b66b68ec9db42405bd\"'), ('date', 'Sun, 27 May 2012 07:32:55 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+{\"clone_url\":\"https://github.com/jacquev6/PyGithub.git\",\"has_downloads\":true,\"watchers\":15,\"updated_at\":\"2012-05-27T07:29:24Z\",\"permissions\":{\"pull\":true,\"admin\":true,\"push\":true},\"homepage\":\"http://vincent-jacques.net/PyGithub\",\"url\":\"https://api.github.com/repos/jacquev6/PyGithub\",\"mirror_url\":null,\"has_wiki\":false,\"has_issues\":true,\"fork\":false,\"forks\":3,\"git_url\":\"git://github.com/jacquev6/PyGithub.git\",\"size\":308,\"private\":false,\"open_issues\":16,\"svn_url\":\"https://github.com/jacquev6/PyGithub\",\"owner\":{\"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},\"name\":\"PyGithub\",\"language\":\"Python\",\"description\":\"Python library implementing the full Github API v3\",\"ssh_url\":\"git@github.com:jacquev6/PyGithub.git\",\"pushed_at\":\"2012-05-27T07:29:24Z\",\"created_at\":\"2012-02-25T12:53:47Z\",\"id\":3544490,\"html_url\":\"https://github.com/jacquev6/PyGithub\",\"full_name\":\"jacquev6/PyGithub\"}\n \n-GET /repos/jacquev6/PyGithub/issues/events/15819975 {'Authorization': 'Basic login_and_password_removed'} null\n+GET /repos/jacquev6/PyGithub/issues/events/16348656 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} null\n 200\n-[('status', '200 OK'), ('x-ratelimit-remaining', '4905'), ('content-length', '2430'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"a3d244842d23f92f69a23e21626fad11\"'), ('date', 'Sun, 27 May 2012 07:19:31 GMT'), ('content-type', 'application/json; charset=utf-8')]\n-{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/issues/events/15819975\",\"issue\":{\"updated_at\":\"2012-05-26T14:59:33Z\",\"body\":\"Body edited by PyGithub\",\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/issues/28\",\"comments\":0,\"milestone\":{\"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/1\",\"number\":1,\"title\":\"Version 0.4\",\"due_on\":\"2012-03-13T07:00:00Z\",\"closed_issues\":3,\"open_issues\":0,\"created_at\":\"2012-03-08T12:22:10Z\",\"state\":\"closed\",\"description\":\"\",\"id\":93546},\"number\":28,\"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\":\"2012-05-26T14:59:33Z\",\"title\":\"Issue created by PyGithub\",\"labels\":[{\"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\"}],\"created_at\":\"2012-05-19T10:38:23Z\",\"state\":\"closed\",\"user\":{\"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},\"id\":4653757,\"pull_request\":{\"diff_url\":null,\"patch_url\":null,\"html_url\":null},\"html_url\":\"https://github.com/jacquev6/PyGithub/issues/28\"},\"commit_id\":null,\"created_at\":\"2012-05-19T10:38:23Z\",\"event\":\"subscribed\",\"id\":15819975,\"actor\":{\"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}}\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '1384'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"fefecab09e7355d4ef9875677c2631da\"'), ('date', 'Sun, 27 May 2012 07:32:56 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/issues/events/16348656\",\"issue\":{\"updated_at\":\"2012-05-27T07:27:51Z\",\"body\":\"Body created by PyGithub\",\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/issues/30\",\"comments\":0,\"milestone\":null,\"number\":30,\"assignee\":null,\"closed_at\":null,\"title\":\"Issue also created by PyGithub\",\"labels\":[{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Question\",\"name\":\"Question\",\"color\":\"02e10c\"}],\"created_at\":\"2012-05-27T05:40:15Z\",\"state\":\"open\",\"user\":{\"url\":\"https://api.github.com/users/jacquev6\",\"gravatar_id\":\"b68de5ae38616c296fa345d2b9df2225\",\"login\":\"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\"},\"id\":4769659,\"pull_request\":{\"patch_url\":null,\"diff_url\":null,\"html_url\":null},\"html_url\":\"https://github.com/jacquev6/PyGithub/issues/30\"},\"commit_id\":\"ed866fc43833802ab553e5ff8581c81bb00dd433\",\"created_at\":\"2012-05-27T07:29:25Z\",\"event\":\"referenced\",\"id\":16348656,\"actor\":{\"url\":\"https://api.github.com/users/jacquev6\",\"gravatar_id\":\"b68de5ae38616c296fa345d2b9df2225\",\"login\":\"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\"}}\n ","status":"modified","deletions":7,"blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/IssueEvent.setUp.txt","changes":14,"additions":7,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206","raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/IssueEvent.setUp.txt","filename":"test/ReplayData/IssueEvent.setUp.txt"}] diff --git a/test/ReplayData/PullRequest.testGetIssueComment.txt b/github/tests/ReplayData/PullRequest.testGetIssueComment.txt similarity index 100% rename from test/ReplayData/PullRequest.testGetIssueComment.txt rename to github/tests/ReplayData/PullRequest.testGetIssueComment.txt diff --git a/test/ReplayData/PullRequest.testGetIssueComments.txt b/github/tests/ReplayData/PullRequest.testGetIssueComments.txt similarity index 100% rename from test/ReplayData/PullRequest.testGetIssueComments.txt rename to github/tests/ReplayData/PullRequest.testGetIssueComments.txt diff --git a/test/ReplayData/PullRequest.testMerge.txt b/github/tests/ReplayData/PullRequest.testMerge.txt similarity index 93% rename from test/ReplayData/PullRequest.testMerge.txt rename to github/tests/ReplayData/PullRequest.testMerge.txt index dee93db3..1d093698 100644 --- a/test/ReplayData/PullRequest.testMerge.txt +++ b/github/tests/ReplayData/PullRequest.testMerge.txt @@ -3,7 +3,7 @@ https GET api.github.com None /repos/jacquev6/PyGithub/pulls/31/merge {'Authoriz [('status', '404 Not Found'), ('x-ratelimit-remaining', '4953'), ('content-length', '23'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"e66a7a6c91e2c26803f3f49feb7a883f"'), ('date', 'Sun, 27 May 2012 10:29:06 GMT'), ('content-type', 'application/json; charset=utf-8')] {"message":"Not Found"} -https PUT api.github.com None /repos/jacquev6/PyGithub/pulls/31/merge {'Authorization': 'Basic login_and_password_removed'} {} +https PUT api.github.com None /repos/jacquev6/PyGithub/pulls/31/merge {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4952'), ('content-length', '109'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"2cf4589169510ce73907214b7327fe5a"'), ('date', 'Sun, 27 May 2012 10:29:07 GMT'), ('content-type', 'application/json; charset=utf-8')] {"merged":true,"message":"Pull Request successfully merged","sha":"688208b1a5a074871d0e9376119556897439697d"} diff --git a/test/ReplayData/PullRequest.testMergeWithCommitMessage.txt b/github/tests/ReplayData/PullRequest.testMergeWithCommitMessage.txt similarity index 98% rename from test/ReplayData/PullRequest.testMergeWithCommitMessage.txt rename to github/tests/ReplayData/PullRequest.testMergeWithCommitMessage.txt index c60f403f..7087fa88 100644 --- a/test/ReplayData/PullRequest.testMergeWithCommitMessage.txt +++ b/github/tests/ReplayData/PullRequest.testMergeWithCommitMessage.txt @@ -13,7 +13,7 @@ https GET api.github.com None /repos/jacquev6/PyGithub/pulls/39 {'Authorization' [('status', '200 OK'), ('x-ratelimit-remaining', '4990'), ('content-length', '4494'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"716935e701e066a56718d7a8b2f409f8"'), ('date', 'Tue, 29 May 2012 18:07:53 GMT'), ('content-type', 'application/json; charset=utf-8')] {"merged":false,"diff_url":"https://github.com/jacquev6/PyGithub/pull/39.diff","head":{"ref":"master","label":"BeaverSoftware:master","repo":{"clone_url":"https://github.com/BeaverSoftware/PyGithub.git","has_downloads":true,"watchers":1,"updated_at":"2012-05-29T18:05:10Z","homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/BeaverSoftware/PyGithub","git_url":"git://github.com/BeaverSoftware/PyGithub.git","html_url":"https://github.com/BeaverSoftware/PyGithub","has_wiki":false,"has_issues":false,"fork":true,"forks":0,"mirror_url":null,"size":428,"private":false,"open_issues":0,"svn_url":"https://github.com/BeaverSoftware/PyGithub","owner":{"url":"https://api.github.com/users/BeaverSoftware","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","id":1424031},"name":"PyGithub","language":"Python","description":"Python library implementing the full Github API v3","ssh_url":"git@github.com:BeaverSoftware/PyGithub.git","pushed_at":"2012-05-29T18:05:10Z","created_at":"2012-05-29T18:03:19Z","id":4485562,"full_name":"BeaverSoftware/PyGithub"},"user":{"url":"https://api.github.com/users/BeaverSoftware","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","id":1424031},"sha":"ca6e7ef9ce22dc01290bb59507f24cc17f42daa4"},"updated_at":"2012-05-29T18:06:07Z","issue_url":"https://github.com/jacquev6/PyGithub/issues/39","_links":{"self":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/39"},"review_comments":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/39/comments"},"comments":{"href":"https://api.github.com/repos/jacquev6/PyGithub/issues/39/comments"},"issue":{"href":"https://api.github.com/repos/jacquev6/PyGithub/issues/39"},"html":{"href":"https://github.com/jacquev6/PyGithub/pull/39"}},"body":"","url":"https://api.github.com/repos/jacquev6/PyGithub/pulls/39","comments":0,"review_comments":0,"changed_files":15,"base":{"ref":"topic/RewriteWithGeneratedCode","label":"jacquev6:topic/RewriteWithGeneratedCode","repo":{"clone_url":"https://github.com/jacquev6/PyGithub.git","has_downloads":true,"watchers":17,"updated_at":"2012-05-29T18:04:08Z","homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","git_url":"git://github.com/jacquev6/PyGithub.git","html_url":"https://github.com/jacquev6/PyGithub","has_wiki":false,"has_issues":true,"fork":false,"forks":3,"mirror_url":null,"size":480,"private":false,"open_issues":15,"svn_url":"https://github.com/jacquev6/PyGithub","owner":{"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},"name":"PyGithub","language":"Python","description":"Python library implementing the full Github API v3","ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-29T18:04:07Z","created_at":"2012-02-25T12:53:47Z","id":3544490,"full_name":"jacquev6/PyGithub"},"user":{"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},"sha":"d57aea6a898050115a089e6f86c5314d7daf97e8"},"number":39,"html_url":"https://github.com/jacquev6/PyGithub/pull/39","patch_url":"https://github.com/jacquev6/PyGithub/pull/39.patch","mergeable":true,"title":"Pull request to be merged by PyGithub with a custom commit message","deletions":31,"merged_by":null,"additions":95,"closed_at":null,"created_at":"2012-05-29T18:06:07Z","user":{"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},"state":"open","id":1448168,"commits":2,"merged_at":null} -https PUT api.github.com None /repos/jacquev6/PyGithub/pulls/39/merge {'Authorization': 'Basic login_and_password_removed'} {"commit_message": "Custom commit message created by PyGithub"} +https PUT api.github.com None /repos/jacquev6/PyGithub/pulls/39/merge {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"commit_message": "Custom commit message created by PyGithub"} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4989'), ('content-length', '109'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"378c85a4f6b6694e0f7686effbc2c29f"'), ('date', 'Tue, 29 May 2012 18:07:54 GMT'), ('content-type', 'application/json; charset=utf-8')] {"merged":true,"message":"Pull Request successfully merged","sha":"2525d86ae3bf7d26003e2a6d5226a8d870499792"} diff --git a/test/ReplayData/PullRequestComment.setUp.txt b/github/tests/ReplayData/PullRequestComment.setUp.txt similarity index 100% rename from test/ReplayData/PullRequestComment.setUp.txt rename to github/tests/ReplayData/PullRequestComment.setUp.txt diff --git a/test/ReplayData/PullRequestComment.testDelete.txt b/github/tests/ReplayData/PullRequestComment.testDelete.txt similarity index 100% rename from test/ReplayData/PullRequestComment.testDelete.txt rename to github/tests/ReplayData/PullRequestComment.testDelete.txt diff --git a/test/ReplayData/PullRequestComment.testEdit.txt b/github/tests/ReplayData/PullRequestComment.testEdit.txt similarity index 90% rename from test/ReplayData/PullRequestComment.testEdit.txt rename to github/tests/ReplayData/PullRequestComment.testEdit.txt index 25ae20ff..d1b2cae8 100644 --- a/test/ReplayData/PullRequestComment.testEdit.txt +++ b/github/tests/ReplayData/PullRequestComment.testEdit.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /repos/jacquev6/PyGithub/pulls/comments/886298 {'Authorization': 'Basic login_and_password_removed'} {"body": "Comment edited by PyGithub"} +https PATCH api.github.com None /repos/jacquev6/PyGithub/pulls/comments/886298 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"body": "Comment edited by PyGithub"} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4991'), ('content-length', '936'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"e8c290c08cd5ed76a92529759e9148bc"'), ('date', 'Sun, 27 May 2012 10:09:07 GMT'), ('content-type', 'application/json; charset=utf-8')] {"updated_at":"2012-05-27T10:09:07Z","position":5,"_links":{"self":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/comments/886298"},"html":{"href":"https://github.com/jacquev6/PyGithub/pull/31#r886298"},"pull_request":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31"}},"original_position":5,"body":"Comment edited by PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub/pulls/comments/886298","commit_id":"8a4f306d4b223682dd19410d4a9150636ebe4206","created_at":"2012-05-27T09:40:12Z","user":{"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},"original_commit_id":"8a4f306d4b223682dd19410d4a9150636ebe4206","path":"src/github/Issue.py","id":886298} diff --git a/test/ReplayData/PullRequestFile.setUp.txt b/github/tests/ReplayData/PullRequestFile.setUp.txt similarity index 97% rename from test/ReplayData/PullRequestFile.setUp.txt rename to github/tests/ReplayData/PullRequestFile.setUp.txt index a632c90c..80944b6f 100644 --- a/test/ReplayData/PullRequestFile.setUp.txt +++ b/github/tests/ReplayData/PullRequestFile.setUp.txt @@ -16,5 +16,5 @@ https GET api.github.com None /repos/jacquev6/PyGithub/pulls/31 {'Authorization' https GET api.github.com None /repos/jacquev6/PyGithub/pulls/31/files {'Authorization': 'Basic login_and_password_removed'} null 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4941'), ('content-length', '169480'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"0eeb19c75ce5a922107d104ec2a5dd4e"'), ('date', 'Sun, 27 May 2012 10:47:16 GMT'), ('content-type', 'application/json; charset=utf-8')] -[{"status":"modified","changes":2,"deletions":1,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/codegen/templates/GithubObject.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/codegen/templates/GithubObject.py","filename":"codegen/templates/GithubObject.py","patch":"@@ -70,7 +70,7 @@ def __useAttributes( self, attributes ):\n \n # @toto No need to check if attribute is in attributes when attribute is mandatory\n {% for attribute in class.attributes|dictsort:\"name\" %}\n- if \"{{ attribute.name }}\" in attributes and attributes[ \"{{ attribute.name }}\" ] is not None:\n+ if \"{{ attribute.name }}\" in attributes and attributes[ \"{{ attribute.name }}\" ] is not None: # pragma no branch\n \n {% if attribute.type.cardinality == \"scalar\" %}\n {% if attribute.type.simple %}","additions":1,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":50,"deletions":25,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/AuthenticatedUser.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/AuthenticatedUser.py","filename":"src/github/AuthenticatedUser.py","patch":"@@ -568,78 +568,78 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"avatar_url\", \"bio\", \"blog\", \"collaborators\", \"company\", \"created_at\", \"disk_usage\", \"email\", \"followers\", \"following\", \"gravatar_id\", \"hireable\", \"html_url\", \"id\", \"location\", \"login\", \"name\", \"owned_private_repos\", \"plan\", \"private_gists\", \"public_gists\", \"public_repos\", \"total_private_repos\", \"type\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"avatar_url\" in attributes and attributes[ \"avatar_url\" ] is not None:\n+ if \"avatar_url\" in attributes and attributes[ \"avatar_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"avatar_url\" ], ( str, unicode ) )\n self.__avatar_url = attributes[ \"avatar_url\" ]\n- if \"bio\" in attributes and attributes[ \"bio\" ] is not None:\n+ if \"bio\" in attributes and attributes[ \"bio\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"bio\" ], ( str, unicode ) )\n self.__bio = attributes[ \"bio\" ]\n- if \"blog\" in attributes and attributes[ \"blog\" ] is not None:\n+ if \"blog\" in attributes and attributes[ \"blog\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"blog\" ], ( str, unicode ) )\n self.__blog = attributes[ \"blog\" ]\n- if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None:\n+ if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"collaborators\" ], int )\n self.__collaborators = attributes[ \"collaborators\" ]\n- if \"company\" in attributes and attributes[ \"company\" ] is not None:\n+ if \"company\" in attributes and attributes[ \"company\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"company\" ], ( str, unicode ) )\n self.__company = attributes[ \"company\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"disk_usage\" in attributes and attributes[ \"disk_usage\" ] is not None:\n+ if \"disk_usage\" in attributes and attributes[ \"disk_usage\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"disk_usage\" ], int )\n self.__disk_usage = attributes[ \"disk_usage\" ]\n- if \"email\" in attributes and attributes[ \"email\" ] is not None:\n+ if \"email\" in attributes and attributes[ \"email\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"email\" ], ( str, unicode ) )\n self.__email = attributes[ \"email\" ]\n- if \"followers\" in attributes and attributes[ \"followers\" ] is not None:\n+ if \"followers\" in attributes and attributes[ \"followers\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"followers\" ], int )\n self.__followers = attributes[ \"followers\" ]\n- if \"following\" in attributes and attributes[ \"following\" ] is not None:\n+ if \"following\" in attributes and attributes[ \"following\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"following\" ], int )\n self.__following = attributes[ \"following\" ]\n- if \"gravatar_id\" in attributes and attributes[ \"gravatar_id\" ] is not None:\n+ if \"gravatar_id\" in attributes and attributes[ \"gravatar_id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"gravatar_id\" ], ( str, unicode ) )\n self.__gravatar_id = attributes[ \"gravatar_id\" ]\n- if \"hireable\" in attributes and attributes[ \"hireable\" ] is not None:\n+ if \"hireable\" in attributes and attributes[ \"hireable\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"hireable\" ], bool )\n self.__hireable = attributes[ \"hireable\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"location\" in attributes and attributes[ \"location\" ] is not None:\n+ if \"location\" in attributes and attributes[ \"location\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"location\" ], ( str, unicode ) )\n self.__location = attributes[ \"location\" ]\n- if \"login\" in attributes and attributes[ \"login\" ] is not None:\n+ if \"login\" in attributes and attributes[ \"login\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"login\" ], ( str, unicode ) )\n self.__login = attributes[ \"login\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]\n- if \"owned_private_repos\" in attributes and attributes[ \"owned_private_repos\" ] is not None:\n+ if \"owned_private_repos\" in attributes and attributes[ \"owned_private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"owned_private_repos\" ], int )\n self.__owned_private_repos = attributes[ \"owned_private_repos\" ]\n- if \"plan\" in attributes and attributes[ \"plan\" ] is not None:\n+ if \"plan\" in attributes and attributes[ \"plan\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"plan\" ], dict )\n self.__plan = Plan.Plan( self.__requester, attributes[ \"plan\" ], completion = LazyCompletion )\n- if \"private_gists\" in attributes and attributes[ \"private_gists\" ] is not None:\n+ if \"private_gists\" in attributes and attributes[ \"private_gists\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"private_gists\" ], int )\n self.__private_gists = attributes[ \"private_gists\" ]\n- if \"public_gists\" in attributes and attributes[ \"public_gists\" ] is not None:\n+ if \"public_gists\" in attributes and attributes[ \"public_gists\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public_gists\" ], int )\n self.__public_gists = attributes[ \"public_gists\" ]\n- if \"public_repos\" in attributes and attributes[ \"public_repos\" ] is not None:\n+ if \"public_repos\" in attributes and attributes[ \"public_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public_repos\" ], int )\n self.__public_repos = attributes[ \"public_repos\" ]\n- if \"total_private_repos\" in attributes and attributes[ \"total_private_repos\" ] is not None:\n+ if \"total_private_repos\" in attributes and attributes[ \"total_private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"total_private_repos\" ], int )\n self.__total_private_repos = attributes[ \"total_private_repos\" ]\n- if \"type\" in attributes and attributes[ \"type\" ] is not None:\n+ if \"type\" in attributes and attributes[ \"type\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"type\" ], ( str, unicode ) )\n self.__type = attributes[ \"type\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":25,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":18,"deletions":9,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Authorization.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Authorization.py","filename":"src/github/Authorization.py","patch":"@@ -117,21 +117,21 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"app\", \"created_at\", \"id\", \"note\", \"note_url\", \"scopes\", \"token\", \"updated_at\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"app\" in attributes and attributes[ \"app\" ] is not None:\n+ if \"app\" in attributes and attributes[ \"app\" ] is not None: # pragma no branch\n self.__app = attributes[ \"app\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"note\" in attributes and attributes[ \"note\" ] is not None:\n+ if \"note\" in attributes and attributes[ \"note\" ] is not None: # pragma no branch\n self.__note = attributes[ \"note\" ]\n- if \"note_url\" in attributes and attributes[ \"note_url\" ] is not None:\n+ if \"note_url\" in attributes and attributes[ \"note_url\" ] is not None: # pragma no branch\n self.__note_url = attributes[ \"note_url\" ]\n- if \"scopes\" in attributes and attributes[ \"scopes\" ] is not None:\n+ if \"scopes\" in attributes and attributes[ \"scopes\" ] is not None: # pragma no branch\n self.__scopes = attributes[ \"scopes\" ]\n- if \"token\" in attributes and attributes[ \"token\" ] is not None:\n+ if \"token\" in attributes and attributes[ \"token\" ] is not None: # pragma no branch\n self.__token = attributes[ \"token\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]","additions":9,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":4,"deletions":2,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Branch.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Branch.py","filename":"src/github/Branch.py","patch":"@@ -28,9 +28,9 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"commit\", \"name\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"commit\" in attributes and attributes[ \"commit\" ] is not None:\n+ if \"commit\" in attributes and attributes[ \"commit\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"commit\" ], dict )\n self.__commit = Commit.Commit( self.__requester, attributes[ \"commit\" ], completion = LazyCompletion )\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]","additions":2,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":16,"deletions":8,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Commit.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Commit.py","filename":"src/github/Commit.py","patch":"@@ -120,33 +120,33 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"author\", \"commit\", \"committer\", \"files\", \"parents\", \"sha\", \"stats\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"author\" in attributes and attributes[ \"author\" ] is not None:\n+ if \"author\" in attributes and attributes[ \"author\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"author\" ], dict )\n self.__author = NamedUser.NamedUser( self.__requester, attributes[ \"author\" ], completion = LazyCompletion )\n- if \"commit\" in attributes and attributes[ \"commit\" ] is not None:\n+ if \"commit\" in attributes and attributes[ \"commit\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"commit\" ], dict )\n self.__commit = GitCommit.GitCommit( self.__requester, attributes[ \"commit\" ], completion = LazyCompletion )\n- if \"committer\" in attributes and attributes[ \"committer\" ] is not None:\n+ if \"committer\" in attributes and attributes[ \"committer\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"committer\" ], dict )\n self.__committer = NamedUser.NamedUser( self.__requester, attributes[ \"committer\" ], completion = LazyCompletion )\n- if \"files\" in attributes and attributes[ \"files\" ] is not None:\n+ if \"files\" in attributes and attributes[ \"files\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"files\" ], list ) and ( len( attributes[ \"files\" ] ) == 0 or isinstance( attributes[ \"files\" ][ 0 ], dict ) )\n self.__files = [\n CommitFile.CommitFile( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"files\" ]\n ]\n- if \"parents\" in attributes and attributes[ \"parents\" ] is not None:\n+ if \"parents\" in attributes and attributes[ \"parents\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"parents\" ], list ) and ( len( attributes[ \"parents\" ] ) == 0 or isinstance( attributes[ \"parents\" ][ 0 ], dict ) )\n self.__parents = [\n Commit( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"parents\" ]\n ]\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"stats\" in attributes and attributes[ \"stats\" ] is not None:\n+ if \"stats\" in attributes and attributes[ \"stats\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"stats\" ], dict )\n self.__stats = CommitStats.CommitStats( self.__requester, attributes[ \"stats\" ], completion = LazyCompletion )\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":8,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":22,"deletions":11,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/CommitComment.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/CommitComment.py","filename":"src/github/CommitComment.py","patch":"@@ -121,36 +121,36 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"body\", \"commit_id\", \"created_at\", \"html_url\", \"id\", \"line\", \"path\", \"position\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"body\" in attributes and attributes[ \"body\" ] is not None:\n+ if \"body\" in attributes and attributes[ \"body\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"body\" ], ( str, unicode ) )\n self.__body = attributes[ \"body\" ]\n- if \"commit_id\" in attributes and attributes[ \"commit_id\" ] is not None:\n+ if \"commit_id\" in attributes and attributes[ \"commit_id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"commit_id\" ], ( str, unicode ) )\n self.__commit_id = attributes[ \"commit_id\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"line\" in attributes and attributes[ \"line\" ] is not None:\n+ if \"line\" in attributes and attributes[ \"line\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"line\" ], int )\n self.__line = attributes[ \"line\" ]\n- if \"path\" in attributes and attributes[ \"path\" ] is not None:\n+ if \"path\" in attributes and attributes[ \"path\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"path\" ], ( str, unicode ) )\n self.__path = attributes[ \"path\" ]\n- if \"position\" in attributes and attributes[ \"position\" ] is not None:\n+ if \"position\" in attributes and attributes[ \"position\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"position\" ], int )\n self.__position = attributes[ \"position\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"updated_at\" ], ( str, unicode ) )\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","additions":11,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":18,"deletions":9,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/CommitFile.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/CommitFile.py","filename":"src/github/CommitFile.py","patch":"@@ -62,21 +62,21 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"additions\", \"blob_url\", \"changes\", \"deletions\", \"filename\", \"patch\", \"raw_url\", \"sha\", \"status\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"additions\" in attributes and attributes[ \"additions\" ] is not None:\n+ if \"additions\" in attributes and attributes[ \"additions\" ] is not None: # pragma no branch\n self.__additions = attributes[ \"additions\" ]\n- if \"blob_url\" in attributes and attributes[ \"blob_url\" ] is not None:\n+ if \"blob_url\" in attributes and attributes[ \"blob_url\" ] is not None: # pragma no branch\n self.__blob_url = attributes[ \"blob_url\" ]\n- if \"changes\" in attributes and attributes[ \"changes\" ] is not None:\n+ if \"changes\" in attributes and attributes[ \"changes\" ] is not None: # pragma no branch\n self.__changes = attributes[ \"changes\" ]\n- if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None:\n+ if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None: # pragma no branch\n self.__deletions = attributes[ \"deletions\" ]\n- if \"filename\" in attributes and attributes[ \"filename\" ] is not None:\n+ if \"filename\" in attributes and attributes[ \"filename\" ] is not None: # pragma no branch\n self.__filename = attributes[ \"filename\" ]\n- if \"patch\" in attributes and attributes[ \"patch\" ] is not None:\n+ if \"patch\" in attributes and attributes[ \"patch\" ] is not None: # pragma no branch\n self.__patch = attributes[ \"patch\" ]\n- if \"raw_url\" in attributes and attributes[ \"raw_url\" ] is not None:\n+ if \"raw_url\" in attributes and attributes[ \"raw_url\" ] is not None: # pragma no branch\n self.__raw_url = attributes[ \"raw_url\" ]\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n self.__sha = attributes[ \"sha\" ]\n- if \"status\" in attributes and attributes[ \"status\" ] is not None:\n+ if \"status\" in attributes and attributes[ \"status\" ] is not None: # pragma no branch\n self.__status = attributes[ \"status\" ]","additions":9,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":6,"deletions":3,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/CommitStats.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/CommitStats.py","filename":"src/github/CommitStats.py","patch":"@@ -32,12 +32,12 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"additions\", \"deletions\", \"total\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"additions\" in attributes and attributes[ \"additions\" ] is not None:\n+ if \"additions\" in attributes and attributes[ \"additions\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"additions\" ], int )\n self.__additions = attributes[ \"additions\" ]\n- if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None:\n+ if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"deletions\" ], int )\n self.__deletions = attributes[ \"deletions\" ]\n- if \"total\" in attributes and attributes[ \"total\" ] is not None:\n+ if \"total\" in attributes and attributes[ \"total\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"total\" ], int )\n self.__total = attributes[ \"total\" ]","additions":3,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":40,"deletions":20,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Download.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Download.py","filename":"src/github/Download.py","patch":"@@ -162,43 +162,43 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"accesskeyid\", \"acl\", \"bucket\", \"content_type\", \"created_at\", \"description\", \"download_count\", \"expirationdate\", \"html_url\", \"id\", \"mime_type\", \"name\", \"path\", \"policy\", \"prefix\", \"redirect\", \"s3_url\", \"signature\", \"size\", \"url\", \"x-amz-meta-content-disposition\" ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"accesskeyid\" in attributes and attributes[ \"accesskeyid\" ] is not None:\n+ if \"accesskeyid\" in attributes and attributes[ \"accesskeyid\" ] is not None: # pragma no branch\n self.__accesskeyid = attributes[ \"accesskeyid\" ]\n- if \"acl\" in attributes and attributes[ \"acl\" ] is not None:\n+ if \"acl\" in attributes and attributes[ \"acl\" ] is not None: # pragma no branch\n self.__acl = attributes[ \"acl\" ]\n- if \"bucket\" in attributes and attributes[ \"bucket\" ] is not None:\n+ if \"bucket\" in attributes and attributes[ \"bucket\" ] is not None: # pragma no branch\n self.__bucket = attributes[ \"bucket\" ]\n- if \"content_type\" in attributes and attributes[ \"content_type\" ] is not None:\n+ if \"content_type\" in attributes and attributes[ \"content_type\" ] is not None: # pragma no branch\n self.__content_type = attributes[ \"content_type\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"description\" in attributes and attributes[ \"description\" ] is not None:\n+ if \"description\" in attributes and attributes[ \"description\" ] is not None: # pragma no branch\n self.__description = attributes[ \"description\" ]\n- if \"download_count\" in attributes and attributes[ \"download_count\" ] is not None:\n+ if \"download_count\" in attributes and attributes[ \"download_count\" ] is not None: # pragma no branch\n self.__download_count = attributes[ \"download_count\" ]\n- if \"expirationdate\" in attributes and attributes[ \"expirationdate\" ] is not None:\n+ if \"expirationdate\" in attributes and attributes[ \"expirationdate\" ] is not None: # pragma no branch\n self.__expirationdate = attributes[ \"expirationdate\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"mime_type\" in attributes and attributes[ \"mime_type\" ] is not None:\n+ if \"mime_type\" in attributes and attributes[ \"mime_type\" ] is not None: # pragma no branch\n self.__mime_type = attributes[ \"mime_type\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n self.__name = attributes[ \"name\" ]\n- if \"path\" in attributes and attributes[ \"path\" ] is not None:\n+ if \"path\" in attributes and attributes[ \"path\" ] is not None: # pragma no branch\n self.__path = attributes[ \"path\" ]\n- if \"policy\" in attributes and attributes[ \"policy\" ] is not None:\n+ if \"policy\" in attributes and attributes[ \"policy\" ] is not None: # pragma no branch\n self.__policy = attributes[ \"policy\" ]\n- if \"prefix\" in attributes and attributes[ \"prefix\" ] is not None:\n+ if \"prefix\" in attributes and attributes[ \"prefix\" ] is not None: # pragma no branch\n self.__prefix = attributes[ \"prefix\" ]\n- if \"redirect\" in attributes and attributes[ \"redirect\" ] is not None:\n+ if \"redirect\" in attributes and attributes[ \"redirect\" ] is not None: # pragma no branch\n self.__redirect = attributes[ \"redirect\" ]\n- if \"s3_url\" in attributes and attributes[ \"s3_url\" ] is not None:\n+ if \"s3_url\" in attributes and attributes[ \"s3_url\" ] is not None: # pragma no branch\n self.__s3_url = attributes[ \"s3_url\" ]\n- if \"signature\" in attributes and attributes[ \"signature\" ] is not None:\n+ if \"signature\" in attributes and attributes[ \"signature\" ] is not None: # pragma no branch\n self.__signature = attributes[ \"signature\" ]\n- if \"size\" in attributes and attributes[ \"size\" ] is not None:\n+ if \"size\" in attributes and attributes[ \"size\" ] is not None: # pragma no branch\n self.__size = attributes[ \"size\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]","additions":20,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":16,"deletions":8,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Event.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Event.py","filename":"src/github/Event.py","patch":"@@ -60,22 +60,22 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"actor\", \"created_at\", \"id\", \"org\", \"payload\", \"public\", \"repo\", \"type\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"actor\" in attributes and attributes[ \"actor\" ] is not None:\n+ if \"actor\" in attributes and attributes[ \"actor\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"actor\" ], dict )\n self.__actor = NamedUser.NamedUser( self.__requester, attributes[ \"actor\" ], completion = LazyCompletion )\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"org\" in attributes and attributes[ \"org\" ] is not None:\n+ if \"org\" in attributes and attributes[ \"org\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"org\" ], dict )\n self.__org = Organization.Organization( self.__requester, attributes[ \"org\" ], completion = LazyCompletion )\n- if \"payload\" in attributes and attributes[ \"payload\" ] is not None:\n+ if \"payload\" in attributes and attributes[ \"payload\" ] is not None: # pragma no branch\n self.__payload = attributes[ \"payload\" ]\n- if \"public\" in attributes and attributes[ \"public\" ] is not None:\n+ if \"public\" in attributes and attributes[ \"public\" ] is not None: # pragma no branch\n self.__public = attributes[ \"public\" ]\n- if \"repo\" in attributes and attributes[ \"repo\" ] is not None:\n+ if \"repo\" in attributes and attributes[ \"repo\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"repo\" ], dict )\n self.__repo = Repository.Repository( self.__requester, attributes[ \"repo\" ], completion = LazyCompletion )\n- if \"type\" in attributes and attributes[ \"type\" ] is not None:\n+ if \"type\" in attributes and attributes[ \"type\" ] is not None: # pragma no branch\n self.__type = attributes[ \"type\" ]","additions":8,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":30,"deletions":15,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Gist.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Gist.py","filename":"src/github/Gist.py","patch":"@@ -220,53 +220,53 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"comments\", \"created_at\", \"description\", \"files\", \"fork_of\", \"forks\", \"git_pull_url\", \"git_push_url\", \"history\", \"html_url\", \"id\", \"public\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"comments\" in attributes and attributes[ \"comments\" ] is not None:\n+ if \"comments\" in attributes and attributes[ \"comments\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"comments\" ], int )\n self.__comments = attributes[ \"comments\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"description\" in attributes and attributes[ \"description\" ] is not None:\n+ if \"description\" in attributes and attributes[ \"description\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"description\" ], ( str, unicode ) )\n self.__description = attributes[ \"description\" ]\n- if \"files\" in attributes and attributes[ \"files\" ] is not None:\n+ if \"files\" in attributes and attributes[ \"files\" ] is not None: # pragma no branch\n self.__files = attributes[ \"files\" ]\n- if \"fork_of\" in attributes and attributes[ \"fork_of\" ] is not None:\n+ if \"fork_of\" in attributes and attributes[ \"fork_of\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"fork_of\" ], dict )\n self.__fork_of = Gist( self.__requester, attributes[ \"fork_of\" ], completion = LazyCompletion )\n- if \"forks\" in attributes and attributes[ \"forks\" ] is not None:\n+ if \"forks\" in attributes and attributes[ \"forks\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"forks\" ], list ) and ( len( attributes[ \"forks\" ] ) == 0 or isinstance( attributes[ \"forks\" ][ 0 ], dict ) )\n self.__forks = [\n Gist( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"forks\" ]\n ]\n- if \"git_pull_url\" in attributes and attributes[ \"git_pull_url\" ] is not None:\n+ if \"git_pull_url\" in attributes and attributes[ \"git_pull_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"git_pull_url\" ], ( str, unicode ) )\n self.__git_pull_url = attributes[ \"git_pull_url\" ]\n- if \"git_push_url\" in attributes and attributes[ \"git_push_url\" ] is not None:\n+ if \"git_push_url\" in attributes and attributes[ \"git_push_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"git_push_url\" ], ( str, unicode ) )\n self.__git_push_url = attributes[ \"git_push_url\" ]\n- if \"history\" in attributes and attributes[ \"history\" ] is not None:\n+ if \"history\" in attributes and attributes[ \"history\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"history\" ], list ) and ( len( attributes[ \"history\" ] ) == 0 or isinstance( attributes[ \"history\" ][ 0 ], dict ) )\n self.__history = [\n GistHistoryState.GistHistoryState( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"history\" ]\n ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], ( str, unicode ) )\n self.__id = attributes[ \"id\" ]\n- if \"public\" in attributes and attributes[ \"public\" ] is not None:\n+ if \"public\" in attributes and attributes[ \"public\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public\" ], bool )\n self.__public = attributes[ \"public\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"updated_at\" ], ( str, unicode ) )\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","additions":15,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":12,"deletions":6,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GistComment.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GistComment.py","filename":"src/github/GistComment.py","patch":"@@ -68,16 +68,16 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"body\", \"created_at\", \"id\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"body\" in attributes and attributes[ \"body\" ] is not None:\n+ if \"body\" in attributes and attributes[ \"body\" ] is not None: # pragma no branch\n self.__body = attributes[ \"body\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","additions":6,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":10,"deletions":5,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GistHistoryState.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GistHistoryState.py","filename":"src/github/GistHistoryState.py","patch":"@@ -44,18 +44,18 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"change_status\", \"committed_at\", \"url\", \"user\", \"version\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"change_status\" in attributes and attributes[ \"change_status\" ] is not None:\n+ if \"change_status\" in attributes and attributes[ \"change_status\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"change_status\" ], dict )\n self.__change_status = CommitStats.CommitStats( self.__requester, attributes[ \"change_status\" ], completion = LazyCompletion )\n- if \"committed_at\" in attributes and attributes[ \"committed_at\" ] is not None:\n+ if \"committed_at\" in attributes and attributes[ \"committed_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"committed_at\" ], ( str, unicode ) )\n self.__committed_at = attributes[ \"committed_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )\n- if \"version\" in attributes and attributes[ \"version\" ] is not None:\n+ if \"version\" in attributes and attributes[ \"version\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"version\" ], ( str, unicode ) )\n self.__version = attributes[ \"version\" ]","additions":5,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":6,"deletions":3,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitAuthor.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitAuthor.py","filename":"src/github/GitAuthor.py","patch":"@@ -32,12 +32,12 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"date\", \"email\", \"name\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"date\" in attributes and attributes[ \"date\" ] is not None:\n+ if \"date\" in attributes and attributes[ \"date\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"date\" ], ( str, unicode ) )\n self.__date = attributes[ \"date\" ]\n- if \"email\" in attributes and attributes[ \"email\" ] is not None:\n+ if \"email\" in attributes and attributes[ \"email\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"email\" ], ( str, unicode ) )\n self.__email = attributes[ \"email\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]","additions":3,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":10,"deletions":5,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitBlob.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitBlob.py","filename":"src/github/GitBlob.py","patch":"@@ -42,18 +42,18 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"content\", \"encoding\", \"sha\", \"size\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"content\" in attributes and attributes[ \"content\" ] is not None:\n+ if \"content\" in attributes and attributes[ \"content\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"content\" ], ( str, unicode ) )\n self.__content = attributes[ \"content\" ]\n- if \"encoding\" in attributes and attributes[ \"encoding\" ] is not None:\n+ if \"encoding\" in attributes and attributes[ \"encoding\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"encoding\" ], ( str, unicode ) )\n self.__encoding = attributes[ \"encoding\" ]\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"size\" in attributes and attributes[ \"size\" ] is not None:\n+ if \"size\" in attributes and attributes[ \"size\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"size\" ], int )\n self.__size = attributes[ \"size\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":5,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":14,"deletions":7,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitCommit.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitCommit.py","filename":"src/github/GitCommit.py","patch":"@@ -55,27 +55,27 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"author\", \"committer\", \"message\", \"parents\", \"sha\", \"tree\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"author\" in attributes and attributes[ \"author\" ] is not None:\n+ if \"author\" in attributes and attributes[ \"author\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"author\" ], dict )\n self.__author = GitAuthor.GitAuthor( self.__requester, attributes[ \"author\" ], completion = LazyCompletion )\n- if \"committer\" in attributes and attributes[ \"committer\" ] is not None:\n+ if \"committer\" in attributes and attributes[ \"committer\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"committer\" ], dict )\n self.__committer = GitAuthor.GitAuthor( self.__requester, attributes[ \"committer\" ], completion = LazyCompletion )\n- if \"message\" in attributes and attributes[ \"message\" ] is not None:\n+ if \"message\" in attributes and attributes[ \"message\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"message\" ], ( str, unicode ) )\n self.__message = attributes[ \"message\" ]\n- if \"parents\" in attributes and attributes[ \"parents\" ] is not None:\n+ if \"parents\" in attributes and attributes[ \"parents\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"parents\" ], list ) and ( len( attributes[ \"parents\" ] ) == 0 or isinstance( attributes[ \"parents\" ][ 0 ], dict ) )\n self.__parents = [\n GitCommit( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"parents\" ]\n ]\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"tree\" in attributes and attributes[ \"tree\" ] is not None:\n+ if \"tree\" in attributes and attributes[ \"tree\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"tree\" ], dict )\n self.__tree = GitTree.GitTree( self.__requester, attributes[ \"tree\" ], completion = LazyCompletion )\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":7,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":6,"deletions":3,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitObject.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitObject.py","filename":"src/github/GitObject.py","patch":"@@ -32,12 +32,12 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"sha\", \"type\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"type\" in attributes and attributes[ \"type\" ] is not None:\n+ if \"type\" in attributes and attributes[ \"type\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"type\" ], ( str, unicode ) )\n self.__type = attributes[ \"type\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":3,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":6,"deletions":3,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitRef.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitRef.py","filename":"src/github/GitRef.py","patch":"@@ -55,12 +55,12 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"object\", \"ref\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"object\" in attributes and attributes[ \"object\" ] is not None:\n+ if \"object\" in attributes and attributes[ \"object\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"object\" ], dict )\n self.__object = GitObject.GitObject( self.__requester, attributes[ \"object\" ], completion = LazyCompletion )\n- if \"ref\" in attributes and attributes[ \"ref\" ] is not None:\n+ if \"ref\" in attributes and attributes[ \"ref\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"ref\" ], ( str, unicode ) )\n self.__ref = attributes[ \"ref\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":3,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":12,"deletions":6,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitTag.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitTag.py","filename":"src/github/GitTag.py","patch":"@@ -49,21 +49,21 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"message\", \"object\", \"sha\", \"tag\", \"tagger\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"message\" in attributes and attributes[ \"message\" ] is not None:\n+ if \"message\" in attributes and attributes[ \"message\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"message\" ], ( str, unicode ) )\n self.__message = attributes[ \"message\" ]\n- if \"object\" in attributes and attributes[ \"object\" ] is not None:\n+ if \"object\" in attributes and attributes[ \"object\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"object\" ], dict )\n self.__object = GitObject.GitObject( self.__requester, attributes[ \"object\" ], completion = LazyCompletion )\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"tag\" in attributes and attributes[ \"tag\" ] is not None:\n+ if \"tag\" in attributes and attributes[ \"tag\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"tag\" ], ( str, unicode ) )\n self.__tag = attributes[ \"tag\" ]\n- if \"tagger\" in attributes and attributes[ \"tagger\" ] is not None:\n+ if \"tagger\" in attributes and attributes[ \"tagger\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"tagger\" ], dict )\n self.__tagger = GitAuthor.GitAuthor( self.__requester, attributes[ \"tagger\" ], completion = LazyCompletion )\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":6,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":6,"deletions":3,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitTree.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitTree.py","filename":"src/github/GitTree.py","patch":"@@ -33,15 +33,15 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"sha\", \"tree\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"tree\" in attributes and attributes[ \"tree\" ] is not None:\n+ if \"tree\" in attributes and attributes[ \"tree\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"tree\" ], list ) and ( len( attributes[ \"tree\" ] ) == 0 or isinstance( attributes[ \"tree\" ][ 0 ], dict ) )\n self.__tree = [\n GitTreeElement.GitTreeElement( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"tree\" ]\n ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":3,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":12,"deletions":6,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitTreeElement.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitTreeElement.py","filename":"src/github/GitTreeElement.py","patch":"@@ -47,21 +47,21 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"mode\", \"path\", \"sha\", \"size\", \"type\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"mode\" in attributes and attributes[ \"mode\" ] is not None:\n+ if \"mode\" in attributes and attributes[ \"mode\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"mode\" ], ( str, unicode ) )\n self.__mode = attributes[ \"mode\" ]\n- if \"path\" in attributes and attributes[ \"path\" ] is not None:\n+ if \"path\" in attributes and attributes[ \"path\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"path\" ], ( str, unicode ) )\n self.__path = attributes[ \"path\" ]\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"size\" in attributes and attributes[ \"size\" ] is not None:\n+ if \"size\" in attributes and attributes[ \"size\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"size\" ], int )\n self.__size = attributes[ \"size\" ]\n- if \"type\" in attributes and attributes[ \"type\" ] is not None:\n+ if \"type\" in attributes and attributes[ \"type\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"type\" ], ( str, unicode ) )\n self.__type = attributes[ \"type\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":6,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":18,"deletions":9,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Hook.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Hook.py","filename":"src/github/Hook.py","patch":"@@ -99,21 +99,21 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"active\", \"config\", \"created_at\", \"events\", \"id\", \"last_response\", \"name\", \"updated_at\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"active\" in attributes and attributes[ \"active\" ] is not None:\n+ if \"active\" in attributes and attributes[ \"active\" ] is not None: # pragma no branch\n self.__active = attributes[ \"active\" ]\n- if \"config\" in attributes and attributes[ \"config\" ] is not None:\n+ if \"config\" in attributes and attributes[ \"config\" ] is not None: # pragma no branch\n self.__config = attributes[ \"config\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"events\" in attributes and attributes[ \"events\" ] is not None:\n+ if \"events\" in attributes and attributes[ \"events\" ] is not None: # pragma no branch\n self.__events = attributes[ \"events\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"last_response\" in attributes and attributes[ \"last_response\" ] is not None:\n+ if \"last_response\" in attributes and attributes[ \"last_response\" ] is not None: # pragma no branch\n self.__last_response = attributes[ \"last_response\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n self.__name = attributes[ \"name\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]","additions":9,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":53,"deletions":21,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Issue.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Issue.py","filename":"src/github/Issue.py","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\n@@ -257,59 +268,59 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"assignee\", \"body\", \"closed_at\", \"closed_by\", \"comments\", \"created_at\", \"html_url\", \"id\", \"labels\", \"milestone\", \"number\", \"pull_request\", \"repository\", \"state\", \"title\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"assignee\" in attributes and attributes[ \"assignee\" ] is not None:\n+ if \"assignee\" in attributes and attributes[ \"assignee\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"assignee\" ], dict )\n self.__assignee = NamedUser.NamedUser( self.__requester, attributes[ \"assignee\" ], completion = LazyCompletion )\n- if \"body\" in attributes and attributes[ \"body\" ] is not None:\n+ if \"body\" in attributes and attributes[ \"body\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"body\" ], ( str, unicode ) )\n self.__body = attributes[ \"body\" ]\n- if \"closed_at\" in attributes and attributes[ \"closed_at\" ] is not None:\n+ if \"closed_at\" in attributes and attributes[ \"closed_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"closed_at\" ], ( str, unicode ) )\n self.__closed_at = attributes[ \"closed_at\" ]\n- if \"closed_by\" in attributes and attributes[ \"closed_by\" ] is not None:\n+ if \"closed_by\" in attributes and attributes[ \"closed_by\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"closed_by\" ], dict )\n self.__closed_by = NamedUser.NamedUser( self.__requester, attributes[ \"closed_by\" ], completion = LazyCompletion )\n- if \"comments\" in attributes and attributes[ \"comments\" ] is not None:\n+ if \"comments\" in attributes and attributes[ \"comments\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"comments\" ], int )\n self.__comments = attributes[ \"comments\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"labels\" in attributes and attributes[ \"labels\" ] is not None:\n+ if \"labels\" in attributes and attributes[ \"labels\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"labels\" ], list ) and ( len( attributes[ \"labels\" ] ) == 0 or isinstance( attributes[ \"labels\" ][ 0 ], dict ) )\n self.__labels = [\n Label.Label( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"labels\" ]\n ]\n- if \"milestone\" in attributes and attributes[ \"milestone\" ] is not None:\n+ if \"milestone\" in attributes and attributes[ \"milestone\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"milestone\" ], dict )\n self.__milestone = Milestone.Milestone( self.__requester, attributes[ \"milestone\" ], completion = LazyCompletion )\n- if \"number\" in attributes and attributes[ \"number\" ] is not None:\n+ if \"number\" in attributes and attributes[ \"number\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"number\" ], int )\n self.__number = attributes[ \"number\" ]\n- if \"pull_request\" in attributes and attributes[ \"pull_request\" ] is not None:\n+ if \"pull_request\" in attributes and attributes[ \"pull_request\" ] is not None: # pragma no branch\n self.__pull_request = attributes[ \"pull_request\" ]\n- if \"repository\" in attributes and attributes[ \"repository\" ] is not None:\n+ if \"repository\" in attributes and attributes[ \"repository\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"repository\" ], dict )\n self.__repository = Repository.Repository( self.__requester, attributes[ \"repository\" ], completion = LazyCompletion )\n- if \"state\" in attributes and attributes[ \"state\" ] is not None:\n+ if \"state\" in attributes and attributes[ \"state\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"state\" ], ( str, unicode ) )\n self.__state = attributes[ \"state\" ]\n- if \"title\" in attributes and attributes[ \"title\" ] is not None:\n+ if \"title\" in attributes and attributes[ \"title\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"title\" ], ( str, unicode ) )\n self.__title = attributes[ \"title\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"updated_at\" ], ( str, unicode ) )\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","additions":32,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":12,"deletions":6,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/IssueComment.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/IssueComment.py","filename":"src/github/IssueComment.py","patch":"@@ -68,16 +68,16 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"body\", \"created_at\", \"id\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"body\" in attributes and attributes[ \"body\" ] is not None:\n+ if \"body\" in attributes and attributes[ \"body\" ] is not None: # pragma no branch\n self.__body = attributes[ \"body\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","additions":6,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":14,"deletions":7,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/IssueEvent.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/IssueEvent.py","filename":"src/github/IssueEvent.py","patch":"@@ -78,24 +78,24 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"actor\", \"commit_id\", \"created_at\", \"event\", \"id\", \"issue\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"actor\" in attributes and attributes[ \"actor\" ] is not None:\n+ if \"actor\" in attributes and attributes[ \"actor\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"actor\" ], dict )\n self.__actor = NamedUser.NamedUser( self.__requester, attributes[ \"actor\" ], completion = LazyCompletion )\n- if \"commit_id\" in attributes and attributes[ \"commit_id\" ] is not None:\n+ if \"commit_id\" in attributes and attributes[ \"commit_id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"commit_id\" ], ( str, unicode ) )\n self.__commit_id = attributes[ \"commit_id\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"event\" in attributes and attributes[ \"event\" ] is not None:\n+ if \"event\" in attributes and attributes[ \"event\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"event\" ], ( str, unicode ) )\n self.__event = attributes[ \"event\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"issue\" in attributes and attributes[ \"issue\" ] is not None:\n+ if \"issue\" in attributes and attributes[ \"issue\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"issue\" ], dict )\n self.__issue = Issue.Issue( self.__requester, attributes[ \"issue\" ], completion = LazyCompletion )\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":7,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":13,"deletions":3,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Label.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Label.py","filename":"src/github/Label.py","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+ # @toto 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\n@@ -53,9 +60,9 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"color\", \"name\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"color\" in attributes and attributes[ \"color\" ] is not None:\n+ if \"color\" in attributes and attributes[ \"color\" ] is not None: # pragma no branch\n self.__color = attributes[ \"color\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n self.__name = attributes[ \"name\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]","additions":10,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":22,"deletions":11,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Milestone.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Milestone.py","filename":"src/github/Milestone.py","patch":"@@ -114,36 +114,36 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"closed_issues\", \"created_at\", \"creator\", \"description\", \"due_on\", \"id\", \"number\", \"open_issues\", \"state\", \"title\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"closed_issues\" in attributes and attributes[ \"closed_issues\" ] is not None:\n+ if \"closed_issues\" in attributes and attributes[ \"closed_issues\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"closed_issues\" ], int )\n self.__closed_issues = attributes[ \"closed_issues\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"creator\" in attributes and attributes[ \"creator\" ] is not None:\n+ if \"creator\" in attributes and attributes[ \"creator\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"creator\" ], dict )\n self.__creator = NamedUser.NamedUser( self.__requester, attributes[ \"creator\" ], completion = LazyCompletion )\n- if \"description\" in attributes and attributes[ \"description\" ] is not None:\n+ if \"description\" in attributes and attributes[ \"description\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"description\" ], ( str, unicode ) )\n self.__description = attributes[ \"description\" ]\n- if \"due_on\" in attributes and attributes[ \"due_on\" ] is not None:\n+ if \"due_on\" in attributes and attributes[ \"due_on\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"due_on\" ], ( str, unicode ) )\n self.__due_on = attributes[ \"due_on\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"number\" in attributes and attributes[ \"number\" ] is not None:\n+ if \"number\" in attributes and attributes[ \"number\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"number\" ], int )\n self.__number = attributes[ \"number\" ]\n- if \"open_issues\" in attributes and attributes[ \"open_issues\" ] is not None:\n+ if \"open_issues\" in attributes and attributes[ \"open_issues\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"open_issues\" ], int )\n self.__open_issues = attributes[ \"open_issues\" ]\n- if \"state\" in attributes and attributes[ \"state\" ] is not None:\n+ if \"state\" in attributes and attributes[ \"state\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"state\" ], ( str, unicode ) )\n self.__state = attributes[ \"state\" ]\n- if \"title\" in attributes and attributes[ \"title\" ] is not None:\n+ if \"title\" in attributes and attributes[ \"title\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"title\" ], ( str, unicode ) )\n self.__title = attributes[ \"title\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":11,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":52,"deletions":26,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/NamedUser.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/NamedUser.py","filename":"src/github/NamedUser.py","patch":"@@ -365,81 +365,81 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"avatar_url\", \"bio\", \"blog\", \"collaborators\", \"company\", \"contributions\", \"created_at\", \"disk_usage\", \"email\", \"followers\", \"following\", \"gravatar_id\", \"hireable\", \"html_url\", \"id\", \"location\", \"login\", \"name\", \"owned_private_repos\", \"plan\", \"private_gists\", \"public_gists\", \"public_repos\", \"total_private_repos\", \"type\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"avatar_url\" in attributes and attributes[ \"avatar_url\" ] is not None:\n+ if \"avatar_url\" in attributes and attributes[ \"avatar_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"avatar_url\" ], ( str, unicode ) )\n self.__avatar_url = attributes[ \"avatar_url\" ]\n- if \"bio\" in attributes and attributes[ \"bio\" ] is not None:\n+ if \"bio\" in attributes and attributes[ \"bio\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"bio\" ], ( str, unicode ) )\n self.__bio = attributes[ \"bio\" ]\n- if \"blog\" in attributes and attributes[ \"blog\" ] is not None:\n+ if \"blog\" in attributes and attributes[ \"blog\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"blog\" ], ( str, unicode ) )\n self.__blog = attributes[ \"blog\" ]\n- if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None:\n+ if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"collaborators\" ], int )\n self.__collaborators = attributes[ \"collaborators\" ]\n- if \"company\" in attributes and attributes[ \"company\" ] is not None:\n+ if \"company\" in attributes and attributes[ \"company\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"company\" ], ( str, unicode ) )\n self.__company = attributes[ \"company\" ]\n- if \"contributions\" in attributes and attributes[ \"contributions\" ] is not None:\n+ if \"contributions\" in attributes and attributes[ \"contributions\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"contributions\" ], int )\n self.__contributions = attributes[ \"contributions\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"disk_usage\" in attributes and attributes[ \"disk_usage\" ] is not None:\n+ if \"disk_usage\" in attributes and attributes[ \"disk_usage\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"disk_usage\" ], int )\n self.__disk_usage = attributes[ \"disk_usage\" ]\n- if \"email\" in attributes and attributes[ \"email\" ] is not None:\n+ if \"email\" in attributes and attributes[ \"email\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"email\" ], ( str, unicode ) )\n self.__email = attributes[ \"email\" ]\n- if \"followers\" in attributes and attributes[ \"followers\" ] is not None:\n+ if \"followers\" in attributes and attributes[ \"followers\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"followers\" ], int )\n self.__followers = attributes[ \"followers\" ]\n- if \"following\" in attributes and attributes[ \"following\" ] is not None:\n+ if \"following\" in attributes and attributes[ \"following\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"following\" ], int )\n self.__following = attributes[ \"following\" ]\n- if \"gravatar_id\" in attributes and attributes[ \"gravatar_id\" ] is not None:\n+ if \"gravatar_id\" in attributes and attributes[ \"gravatar_id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"gravatar_id\" ], ( str, unicode ) )\n self.__gravatar_id = attributes[ \"gravatar_id\" ]\n- if \"hireable\" in attributes and attributes[ \"hireable\" ] is not None:\n+ if \"hireable\" in attributes and attributes[ \"hireable\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"hireable\" ], bool )\n self.__hireable = attributes[ \"hireable\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"location\" in attributes and attributes[ \"location\" ] is not None:\n+ if \"location\" in attributes and attributes[ \"location\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"location\" ], ( str, unicode ) )\n self.__location = attributes[ \"location\" ]\n- if \"login\" in attributes and attributes[ \"login\" ] is not None:\n+ if \"login\" in attributes and attributes[ \"login\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"login\" ], ( str, unicode ) )\n self.__login = attributes[ \"login\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]\n- if \"owned_private_repos\" in attributes and attributes[ \"owned_private_repos\" ] is not None:\n+ if \"owned_private_repos\" in attributes and attributes[ \"owned_private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"owned_private_repos\" ], int )\n self.__owned_private_repos = attributes[ \"owned_private_repos\" ]\n- if \"plan\" in attributes and attributes[ \"plan\" ] is not None:\n+ if \"plan\" in attributes and attributes[ \"plan\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"plan\" ], dict )\n self.__plan = Plan.Plan( self.__requester, attributes[ \"plan\" ], completion = LazyCompletion )\n- if \"private_gists\" in attributes and attributes[ \"private_gists\" ] is not None:\n+ if \"private_gists\" in attributes and attributes[ \"private_gists\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"private_gists\" ], int )\n self.__private_gists = attributes[ \"private_gists\" ]\n- if \"public_gists\" in attributes and attributes[ \"public_gists\" ] is not None:\n+ if \"public_gists\" in attributes and attributes[ \"public_gists\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public_gists\" ], int )\n self.__public_gists = attributes[ \"public_gists\" ]\n- if \"public_repos\" in attributes and attributes[ \"public_repos\" ] is not None:\n+ if \"public_repos\" in attributes and attributes[ \"public_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public_repos\" ], int )\n self.__public_repos = attributes[ \"public_repos\" ]\n- if \"total_private_repos\" in attributes and attributes[ \"total_private_repos\" ] is not None:\n+ if \"total_private_repos\" in attributes and attributes[ \"total_private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"total_private_repos\" ], int )\n self.__total_private_repos = attributes[ \"total_private_repos\" ]\n- if \"type\" in attributes and attributes[ \"type\" ] is not None:\n+ if \"type\" in attributes and attributes[ \"type\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"type\" ], ( str, unicode ) )\n self.__type = attributes[ \"type\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":26,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":48,"deletions":24,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Organization.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Organization.py","filename":"src/github/Organization.py","patch":"@@ -390,75 +390,75 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"avatar_url\", \"billing_email\", \"blog\", \"collaborators\", \"company\", \"created_at\", \"disk_usage\", \"email\", \"followers\", \"following\", \"gravatar_id\", \"html_url\", \"id\", \"location\", \"login\", \"name\", \"owned_private_repos\", \"plan\", \"private_gists\", \"public_gists\", \"public_repos\", \"total_private_repos\", \"type\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"avatar_url\" in attributes and attributes[ \"avatar_url\" ] is not None:\n+ if \"avatar_url\" in attributes and attributes[ \"avatar_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"avatar_url\" ], ( str, unicode ) )\n self.__avatar_url = attributes[ \"avatar_url\" ]\n- if \"billing_email\" in attributes and attributes[ \"billing_email\" ] is not None:\n+ if \"billing_email\" in attributes and attributes[ \"billing_email\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"billing_email\" ], ( str, unicode ) )\n self.__billing_email = attributes[ \"billing_email\" ]\n- if \"blog\" in attributes and attributes[ \"blog\" ] is not None:\n+ if \"blog\" in attributes and attributes[ \"blog\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"blog\" ], ( str, unicode ) )\n self.__blog = attributes[ \"blog\" ]\n- if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None:\n+ if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"collaborators\" ], int )\n self.__collaborators = attributes[ \"collaborators\" ]\n- if \"company\" in attributes and attributes[ \"company\" ] is not None:\n+ if \"company\" in attributes and attributes[ \"company\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"company\" ], ( str, unicode ) )\n self.__company = attributes[ \"company\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"disk_usage\" in attributes and attributes[ \"disk_usage\" ] is not None:\n+ if \"disk_usage\" in attributes and attributes[ \"disk_usage\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"disk_usage\" ], int )\n self.__disk_usage = attributes[ \"disk_usage\" ]\n- if \"email\" in attributes and attributes[ \"email\" ] is not None:\n+ if \"email\" in attributes and attributes[ \"email\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"email\" ], ( str, unicode ) )\n self.__email = attributes[ \"email\" ]\n- if \"followers\" in attributes and attributes[ \"followers\" ] is not None:\n+ if \"followers\" in attributes and attributes[ \"followers\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"followers\" ], int )\n self.__followers = attributes[ \"followers\" ]\n- if \"following\" in attributes and attributes[ \"following\" ] is not None:\n+ if \"following\" in attributes and attributes[ \"following\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"following\" ], int )\n self.__following = attributes[ \"following\" ]\n- if \"gravatar_id\" in attributes and attributes[ \"gravatar_id\" ] is not None:\n+ if \"gravatar_id\" in attributes and attributes[ \"gravatar_id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"gravatar_id\" ], ( str, unicode ) )\n self.__gravatar_id = attributes[ \"gravatar_id\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"location\" in attributes and attributes[ \"location\" ] is not None:\n+ if \"location\" in attributes and attributes[ \"location\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"location\" ], ( str, unicode ) )\n self.__location = attributes[ \"location\" ]\n- if \"login\" in attributes and attributes[ \"login\" ] is not None:\n+ if \"login\" in attributes and attributes[ \"login\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"login\" ], ( str, unicode ) )\n self.__login = attributes[ \"login\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]\n- if \"owned_private_repos\" in attributes and attributes[ \"owned_private_repos\" ] is not None:\n+ if \"owned_private_repos\" in attributes and attributes[ \"owned_private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"owned_private_repos\" ], int )\n self.__owned_private_repos = attributes[ \"owned_private_repos\" ]\n- if \"plan\" in attributes and attributes[ \"plan\" ] is not None:\n+ if \"plan\" in attributes and attributes[ \"plan\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"plan\" ], dict )\n self.__plan = Plan.Plan( self.__requester, attributes[ \"plan\" ], completion = LazyCompletion )\n- if \"private_gists\" in attributes and attributes[ \"private_gists\" ] is not None:\n+ if \"private_gists\" in attributes and attributes[ \"private_gists\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"private_gists\" ], int )\n self.__private_gists = attributes[ \"private_gists\" ]\n- if \"public_gists\" in attributes and attributes[ \"public_gists\" ] is not None:\n+ if \"public_gists\" in attributes and attributes[ \"public_gists\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public_gists\" ], int )\n self.__public_gists = attributes[ \"public_gists\" ]\n- if \"public_repos\" in attributes and attributes[ \"public_repos\" ] is not None:\n+ if \"public_repos\" in attributes and attributes[ \"public_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public_repos\" ], int )\n self.__public_repos = attributes[ \"public_repos\" ]\n- if \"total_private_repos\" in attributes and attributes[ \"total_private_repos\" ] is not None:\n+ if \"total_private_repos\" in attributes and attributes[ \"total_private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"total_private_repos\" ], int )\n self.__total_private_repos = attributes[ \"total_private_repos\" ]\n- if \"type\" in attributes and attributes[ \"type\" ] is not None:\n+ if \"type\" in attributes and attributes[ \"type\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"type\" ], ( str, unicode ) )\n self.__type = attributes[ \"type\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":24,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":6,"deletions":3,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Permissions.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Permissions.py","filename":"src/github/Permissions.py","patch":"@@ -32,12 +32,12 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"admin\", \"pull\", \"push\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"admin\" in attributes and attributes[ \"admin\" ] is not None:\n+ if \"admin\" in attributes and attributes[ \"admin\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"admin\" ], bool )\n self.__admin = attributes[ \"admin\" ]\n- if \"pull\" in attributes and attributes[ \"pull\" ] is not None:\n+ if \"pull\" in attributes and attributes[ \"pull\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"pull\" ], bool )\n self.__pull = attributes[ \"pull\" ]\n- if \"push\" in attributes and attributes[ \"push\" ] is not None:\n+ if \"push\" in attributes and attributes[ \"push\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"push\" ], bool )\n self.__push = attributes[ \"push\" ]","additions":3,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":8,"deletions":4,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Plan.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Plan.py","filename":"src/github/Plan.py","patch":"@@ -37,15 +37,15 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"collaborators\", \"name\", \"private_repos\", \"space\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None:\n+ if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"collaborators\" ], int )\n self.__collaborators = attributes[ \"collaborators\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]\n- if \"private_repos\" in attributes and attributes[ \"private_repos\" ] is not None:\n+ if \"private_repos\" in attributes and attributes[ \"private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"private_repos\" ], int )\n self.__private_repos = attributes[ \"private_repos\" ]\n- if \"space\" in attributes and attributes[ \"space\" ] is not None:\n+ if \"space\" in attributes and attributes[ \"space\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"space\" ], int )\n self.__space = attributes[ \"space\" ]","additions":4,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":52,"deletions":26,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/PullRequest.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/PullRequest.py","filename":"src/github/PullRequest.py","patch":"@@ -279,56 +279,56 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"additions\", \"base\", \"body\", \"changed_files\", \"closed_at\", \"comments\", \"commits\", \"created_at\", \"deletions\", \"diff_url\", \"head\", \"html_url\", \"id\", \"issue_url\", \"mergeable\", \"merged\", \"merged_at\", \"merged_by\", \"number\", \"patch_url\", \"review_comments\", \"state\", \"title\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"additions\" in attributes and attributes[ \"additions\" ] is not None:\n+ if \"additions\" in attributes and attributes[ \"additions\" ] is not None: # pragma no branch\n self.__additions = attributes[ \"additions\" ]\n- if \"base\" in attributes and attributes[ \"base\" ] is not None:\n+ if \"base\" in attributes and attributes[ \"base\" ] is not None: # pragma no branch\n self.__base = attributes[ \"base\" ]\n- if \"body\" in attributes and attributes[ \"body\" ] is not None:\n+ if \"body\" in attributes and attributes[ \"body\" ] is not None: # pragma no branch\n self.__body = attributes[ \"body\" ]\n- if \"changed_files\" in attributes and attributes[ \"changed_files\" ] is not None:\n+ if \"changed_files\" in attributes and attributes[ \"changed_files\" ] is not None: # pragma no branch\n self.__changed_files = attributes[ \"changed_files\" ]\n- if \"closed_at\" in attributes and attributes[ \"closed_at\" ] is not None:\n+ if \"closed_at\" in attributes and attributes[ \"closed_at\" ] is not None: # pragma no branch\n self.__closed_at = attributes[ \"closed_at\" ]\n- if \"comments\" in attributes and attributes[ \"comments\" ] is not None:\n+ if \"comments\" in attributes and attributes[ \"comments\" ] is not None: # pragma no branch\n self.__comments = attributes[ \"comments\" ]\n- if \"commits\" in attributes and attributes[ \"commits\" ] is not None:\n+ if \"commits\" in attributes and attributes[ \"commits\" ] is not None: # pragma no branch\n self.__commits = attributes[ \"commits\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None:\n+ if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None: # pragma no branch\n self.__deletions = attributes[ \"deletions\" ]\n- if \"diff_url\" in attributes and attributes[ \"diff_url\" ] is not None:\n+ if \"diff_url\" in attributes and attributes[ \"diff_url\" ] is not None: # pragma no branch\n self.__diff_url = attributes[ \"diff_url\" ]\n- if \"head\" in attributes and attributes[ \"head\" ] is not None:\n+ if \"head\" in attributes and attributes[ \"head\" ] is not None: # pragma no branch\n self.__head = attributes[ \"head\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"issue_url\" in attributes and attributes[ \"issue_url\" ] is not None:\n+ if \"issue_url\" in attributes and attributes[ \"issue_url\" ] is not None: # pragma no branch\n self.__issue_url = attributes[ \"issue_url\" ]\n- if \"mergeable\" in attributes and attributes[ \"mergeable\" ] is not None:\n+ if \"mergeable\" in attributes and attributes[ \"mergeable\" ] is not None: # pragma no branch\n self.__mergeable = attributes[ \"mergeable\" ]\n- if \"merged\" in attributes and attributes[ \"merged\" ] is not None:\n+ if \"merged\" in attributes and attributes[ \"merged\" ] is not None: # pragma no branch\n self.__merged = attributes[ \"merged\" ]\n- if \"merged_at\" in attributes and attributes[ \"merged_at\" ] is not None:\n+ if \"merged_at\" in attributes and attributes[ \"merged_at\" ] is not None: # pragma no branch\n self.__merged_at = attributes[ \"merged_at\" ]\n- if \"merged_by\" in attributes and attributes[ \"merged_by\" ] is not None:\n+ if \"merged_by\" in attributes and attributes[ \"merged_by\" ] is not None: # pragma no branch\n self.__merged_by = attributes[ \"merged_by\" ]\n- if \"number\" in attributes and attributes[ \"number\" ] is not None:\n+ if \"number\" in attributes and attributes[ \"number\" ] is not None: # pragma no branch\n self.__number = attributes[ \"number\" ]\n- if \"patch_url\" in attributes and attributes[ \"patch_url\" ] is not None:\n+ if \"patch_url\" in attributes and attributes[ \"patch_url\" ] is not None: # pragma no branch\n self.__patch_url = attributes[ \"patch_url\" ]\n- if \"review_comments\" in attributes and attributes[ \"review_comments\" ] is not None:\n+ if \"review_comments\" in attributes and attributes[ \"review_comments\" ] is not None: # pragma no branch\n self.__review_comments = attributes[ \"review_comments\" ]\n- if \"state\" in attributes and attributes[ \"state\" ] is not None:\n+ if \"state\" in attributes and attributes[ \"state\" ] is not None: # pragma no branch\n self.__state = attributes[ \"state\" ]\n- if \"title\" in attributes and attributes[ \"title\" ] is not None:\n+ if \"title\" in attributes and attributes[ \"title\" ] is not None: # pragma no branch\n self.__title = attributes[ \"title\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","additions":26,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":22,"deletions":11,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/PullRequestComment.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/PullRequestComment.py","filename":"src/github/PullRequestComment.py","patch":"@@ -121,26 +121,26 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"body\", \"commit_id\", \"created_at\", \"html_url\", \"id\", \"line\", \"path\", \"position\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"body\" in attributes and attributes[ \"body\" ] is not None:\n+ if \"body\" in attributes and attributes[ \"body\" ] is not None: # pragma no branch\n self.__body = attributes[ \"body\" ]\n- if \"commit_id\" in attributes and attributes[ \"commit_id\" ] is not None:\n+ if \"commit_id\" in attributes and attributes[ \"commit_id\" ] is not None: # pragma no branch\n self.__commit_id = attributes[ \"commit_id\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"line\" in attributes and attributes[ \"line\" ] is not None:\n+ if \"line\" in attributes and attributes[ \"line\" ] is not None: # pragma no branch\n self.__line = attributes[ \"line\" ]\n- if \"path\" in attributes and attributes[ \"path\" ] is not None:\n+ if \"path\" in attributes and attributes[ \"path\" ] is not None: # pragma no branch\n self.__path = attributes[ \"path\" ]\n- if \"position\" in attributes and attributes[ \"position\" ] is not None:\n+ if \"position\" in attributes and attributes[ \"position\" ] is not None: # pragma no branch\n self.__position = attributes[ \"position\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","additions":11,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":18,"deletions":9,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/PullRequestFile.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/PullRequestFile.py","filename":"src/github/PullRequestFile.py","patch":"@@ -62,21 +62,21 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"additions\", \"blob_url\", \"changes\", \"deletions\", \"filename\", \"patch\", \"raw_url\", \"sha\", \"status\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"additions\" in attributes and attributes[ \"additions\" ] is not None:\n+ if \"additions\" in attributes and attributes[ \"additions\" ] is not None: # pragma no branch\n self.__additions = attributes[ \"additions\" ]\n- if \"blob_url\" in attributes and attributes[ \"blob_url\" ] is not None:\n+ if \"blob_url\" in attributes and attributes[ \"blob_url\" ] is not None: # pragma no branch\n self.__blob_url = attributes[ \"blob_url\" ]\n- if \"changes\" in attributes and attributes[ \"changes\" ] is not None:\n+ if \"changes\" in attributes and attributes[ \"changes\" ] is not None: # pragma no branch\n self.__changes = attributes[ \"changes\" ]\n- if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None:\n+ if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None: # pragma no branch\n self.__deletions = attributes[ \"deletions\" ]\n- if \"filename\" in attributes and attributes[ \"filename\" ] is not None:\n+ if \"filename\" in attributes and attributes[ \"filename\" ] is not None: # pragma no branch\n self.__filename = attributes[ \"filename\" ]\n- if \"patch\" in attributes and attributes[ \"patch\" ] is not None:\n+ if \"patch\" in attributes and attributes[ \"patch\" ] is not None: # pragma no branch\n self.__patch = attributes[ \"patch\" ]\n- if \"raw_url\" in attributes and attributes[ \"raw_url\" ] is not None:\n+ if \"raw_url\" in attributes and attributes[ \"raw_url\" ] is not None: # pragma no branch\n self.__raw_url = attributes[ \"raw_url\" ]\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n self.__sha = attributes[ \"sha\" ]\n- if \"status\" in attributes and attributes[ \"status\" ] is not None:\n+ if \"status\" in attributes and attributes[ \"status\" ] is not None: # pragma no branch\n self.__status = attributes[ \"status\" ]","additions":9,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":62,"deletions":31,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Repository.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Repository.py","filename":"src/github/Repository.py","patch":"@@ -905,96 +905,96 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n 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\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"clone_url\" in attributes and attributes[ \"clone_url\" ] is not None:\n+ if \"clone_url\" in attributes and attributes[ \"clone_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"clone_url\" ], ( str, unicode ) )\n self.__clone_url = attributes[ \"clone_url\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"description\" in attributes and attributes[ \"description\" ] is not None:\n+ if \"description\" in attributes and attributes[ \"description\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"description\" ], ( str, unicode ) )\n self.__description = attributes[ \"description\" ]\n- if \"fork\" in attributes and attributes[ \"fork\" ] is not None:\n+ if \"fork\" in attributes and attributes[ \"fork\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"fork\" ], bool )\n self.__fork = attributes[ \"fork\" ]\n- if \"forks\" in attributes and attributes[ \"forks\" ] is not None:\n+ if \"forks\" in attributes and attributes[ \"forks\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"forks\" ], int )\n self.__forks = attributes[ \"forks\" ]\n- if \"full_name\" in attributes and attributes[ \"full_name\" ] is not None:\n+ if \"full_name\" in attributes and attributes[ \"full_name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"full_name\" ], ( str, unicode ) )\n self.__full_name = attributes[ \"full_name\" ]\n- if \"git_url\" in attributes and attributes[ \"git_url\" ] is not None:\n+ if \"git_url\" in attributes and attributes[ \"git_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"git_url\" ], ( str, unicode ) )\n self.__git_url = attributes[ \"git_url\" ]\n- if \"has_downloads\" in attributes and attributes[ \"has_downloads\" ] is not None:\n+ if \"has_downloads\" in attributes and attributes[ \"has_downloads\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"has_downloads\" ], bool )\n self.__has_downloads = attributes[ \"has_downloads\" ]\n- if \"has_issues\" in attributes and attributes[ \"has_issues\" ] is not None:\n+ if \"has_issues\" in attributes and attributes[ \"has_issues\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"has_issues\" ], bool )\n self.__has_issues = attributes[ \"has_issues\" ]\n- if \"has_wiki\" in attributes and attributes[ \"has_wiki\" ] is not None:\n+ if \"has_wiki\" in attributes and attributes[ \"has_wiki\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"has_wiki\" ], bool )\n self.__has_wiki = attributes[ \"has_wiki\" ]\n- if \"homepage\" in attributes and attributes[ \"homepage\" ] is not None:\n+ if \"homepage\" in attributes and attributes[ \"homepage\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"homepage\" ], ( str, unicode ) )\n self.__homepage = attributes[ \"homepage\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"language\" in attributes and attributes[ \"language\" ] is not None:\n+ if \"language\" in attributes and attributes[ \"language\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"language\" ], ( str, unicode ) )\n self.__language = attributes[ \"language\" ]\n- if \"master_branch\" in attributes and attributes[ \"master_branch\" ] is not None:\n+ if \"master_branch\" in attributes and attributes[ \"master_branch\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"master_branch\" ], ( str, unicode ) )\n self.__master_branch = attributes[ \"master_branch\" ]\n- if \"mirror_url\" in attributes and attributes[ \"mirror_url\" ] is not None:\n+ if \"mirror_url\" in attributes and attributes[ \"mirror_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"mirror_url\" ], ( str, unicode ) )\n self.__mirror_url = attributes[ \"mirror_url\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]\n- if \"open_issues\" in attributes and attributes[ \"open_issues\" ] is not None:\n+ if \"open_issues\" in attributes and attributes[ \"open_issues\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"open_issues\" ], int )\n self.__open_issues = attributes[ \"open_issues\" ]\n- if \"organization\" in attributes and attributes[ \"organization\" ] is not None:\n+ if \"organization\" in attributes and attributes[ \"organization\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"organization\" ], dict )\n self.__organization = Organization.Organization( self.__requester, attributes[ \"organization\" ], completion = LazyCompletion )\n- if \"owner\" in attributes and attributes[ \"owner\" ] is not None:\n+ if \"owner\" in attributes and attributes[ \"owner\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"owner\" ], dict )\n self.__owner = NamedUser.NamedUser( self.__requester, attributes[ \"owner\" ], completion = LazyCompletion )\n- if \"parent\" in attributes and attributes[ \"parent\" ] is not None:\n+ if \"parent\" in attributes and attributes[ \"parent\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"parent\" ], dict )\n self.__parent = Repository( self.__requester, attributes[ \"parent\" ], completion = LazyCompletion )\n- if \"permissions\" in attributes and attributes[ \"permissions\" ] is not None:\n+ if \"permissions\" in attributes and attributes[ \"permissions\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"permissions\" ], dict )\n self.__permissions = Permissions.Permissions( self.__requester, attributes[ \"permissions\" ], completion = LazyCompletion )\n- if \"private\" in attributes and attributes[ \"private\" ] is not None:\n+ if \"private\" in attributes and attributes[ \"private\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"private\" ], bool )\n self.__private = attributes[ \"private\" ]\n- if \"pushed_at\" in attributes and attributes[ \"pushed_at\" ] is not None:\n+ if \"pushed_at\" in attributes and attributes[ \"pushed_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"pushed_at\" ], ( str, unicode ) )\n self.__pushed_at = attributes[ \"pushed_at\" ]\n- if \"size\" in attributes and attributes[ \"size\" ] is not None:\n+ if \"size\" in attributes and attributes[ \"size\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"size\" ], int )\n self.__size = attributes[ \"size\" ]\n- if \"source\" in attributes and attributes[ \"source\" ] is not None:\n+ if \"source\" in attributes and attributes[ \"source\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"source\" ], dict )\n self.__source = Repository( self.__requester, attributes[ \"source\" ], completion = LazyCompletion )\n- if \"ssh_url\" in attributes and attributes[ \"ssh_url\" ] is not None:\n+ if \"ssh_url\" in attributes and attributes[ \"ssh_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"ssh_url\" ], ( str, unicode ) )\n self.__ssh_url = attributes[ \"ssh_url\" ]\n- if \"svn_url\" in attributes and attributes[ \"svn_url\" ] is not None:\n+ if \"svn_url\" in attributes and attributes[ \"svn_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"svn_url\" ], ( str, unicode ) )\n self.__svn_url = attributes[ \"svn_url\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"updated_at\" ], ( str, unicode ) )\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]\n- if \"watchers\" in attributes and attributes[ \"watchers\" ] is not None:\n+ if \"watchers\" in attributes and attributes[ \"watchers\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"watchers\" ], int )\n self.__watchers = attributes[ \"watchers\" ]","additions":31,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":10,"deletions":5,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/RepositoryKey.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/RepositoryKey.py","filename":"src/github/RepositoryKey.py","patch":"@@ -87,14 +87,14 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"id\", \"key\", \"title\", \"url\", \"verified\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"key\" in attributes and attributes[ \"key\" ] is not None:\n+ if \"key\" in attributes and attributes[ \"key\" ] is not None: # pragma no branch\n self.__key = attributes[ \"key\" ]\n- if \"title\" in attributes and attributes[ \"title\" ] is not None:\n+ if \"title\" in attributes and attributes[ \"title\" ] is not None: # pragma no branch\n self.__title = attributes[ \"title\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]\n- if \"verified\" in attributes and attributes[ \"verified\" ] is not None:\n+ if \"verified\" in attributes and attributes[ \"verified\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"verified\" ], bool )\n self.__verified = attributes[ \"verified\" ]","additions":5,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":8,"deletions":4,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Tag.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Tag.py","filename":"src/github/Tag.py","patch":"@@ -38,15 +38,15 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"commit\", \"name\", \"tarball_url\", \"zipball_url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"commit\" in attributes and attributes[ \"commit\" ] is not None:\n+ if \"commit\" in attributes and attributes[ \"commit\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"commit\" ], dict )\n self.__commit = Commit.Commit( self.__requester, attributes[ \"commit\" ], completion = LazyCompletion )\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]\n- if \"tarball_url\" in attributes and attributes[ \"tarball_url\" ] is not None:\n+ if \"tarball_url\" in attributes and attributes[ \"tarball_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"tarball_url\" ], ( str, unicode ) )\n self.__tarball_url = attributes[ \"tarball_url\" ]\n- if \"zipball_url\" in attributes and attributes[ \"zipball_url\" ] is not None:\n+ if \"zipball_url\" in attributes and attributes[ \"zipball_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"zipball_url\" ], ( str, unicode ) )\n self.__zipball_url = attributes[ \"zipball_url\" ]","additions":4,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":12,"deletions":6,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Team.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Team.py","filename":"src/github/Team.py","patch":"@@ -172,15 +172,15 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"id\", \"members_count\", \"name\", \"permission\", \"repos_count\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"members_count\" in attributes and attributes[ \"members_count\" ] is not None:\n+ if \"members_count\" in attributes and attributes[ \"members_count\" ] is not None: # pragma no branch\n self.__members_count = attributes[ \"members_count\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n self.__name = attributes[ \"name\" ]\n- if \"permission\" in attributes and attributes[ \"permission\" ] is not None:\n+ if \"permission\" in attributes and attributes[ \"permission\" ] is not None: # pragma no branch\n self.__permission = attributes[ \"permission\" ]\n- if \"repos_count\" in attributes and attributes[ \"repos_count\" ] is not None:\n+ if \"repos_count\" in attributes and attributes[ \"repos_count\" ] is not None: # pragma no branch\n self.__repos_count = attributes[ \"repos_count\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]","additions":6,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":10,"deletions":5,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/UserKey.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/UserKey.py","filename":"src/github/UserKey.py","patch":"@@ -87,14 +87,14 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"id\", \"key\", \"title\", \"url\", \"verified\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"key\" in attributes and attributes[ \"key\" ] is not None:\n+ if \"key\" in attributes and attributes[ \"key\" ] is not None: # pragma no branch\n self.__key = attributes[ \"key\" ]\n- if \"title\" in attributes and attributes[ \"title\" ] is not None:\n+ if \"title\" in attributes and attributes[ \"title\" ] is not None: # pragma no branch\n self.__title = attributes[ \"title\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]\n- if \"verified\" in attributes and attributes[ \"verified\" ] is not None:\n+ if \"verified\" in attributes and attributes[ \"verified\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"verified\" ], bool )\n self.__verified = attributes[ \"verified\" ]","additions":5,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":26,"deletions":1,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/Issue.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/Issue.py","filename":"test/Issue.py","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","additions":25,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":14,"deletions":7,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/IssueEvent.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/IssueEvent.py","filename":"test/IssueEvent.py","patch":"@@ -3,13 +3,13 @@\n class IssueEvent( Framework.TestCase ):\r\n def setUp( self ):\r\n Framework.TestCase.setUp( self )\r\n- self.event = self.g.get_user().get_repo( \"PyGithub\" ).get_issues_event( 15819975 )\r\n+ self.event = self.g.get_user().get_repo( \"PyGithub\" ).get_issues_event( 16348656 )\r\n \r\n def testAttributes( self ):\r\n self.assertEqual( self.event.actor.login, \"jacquev6\" )\r\n- self.assertEqual( self.event.commit_id, None )\r\n- self.assertEqual( self.event.created_at, \"2012-05-19T10:38:23Z\" )\r\n- self.assertEqual( self.event.event, \"subscribed\" )\r\n- self.assertEqual( self.event.id, 15819975 )\r\n- self.assertEqual( self.event.issue.number, 28 )\r\n- self.assertEqual( self.event.url, \"https://api.github.com/repos/jacquev6/PyGithub/issues/events/15819975\" )\r\n+ self.assertEqual( self.event.commit_id, \"ed866fc43833802ab553e5ff8581c81bb00dd433\" )\r\n+ self.assertEqual( self.event.created_at, \"2012-05-27T07:29:25Z\" )\r\n+ self.assertEqual( self.event.event, \"referenced\" )\r\n+ self.assertEqual( self.event.id, 16348656 )\r\n+ self.assertEqual( self.event.issue.number, 30 )\r\n+ self.assertEqual( self.event.url, \"https://api.github.com/repos/jacquev6/PyGithub/issues/events/16348656\" )\r","additions":7,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"added","changes":45,"deletions":0,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testAddAndRemoveLabels.txt","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testAddAndRemoveLabels.txt","filename":"test/ReplayData/Issue.testAddAndRemoveLabels.txt","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+","additions":45,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"added","changes":35,"deletions":0,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testDeleteAndSetLabels.txt","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testDeleteAndSetLabels.txt","filename":"test/ReplayData/Issue.testDeleteAndSetLabels.txt","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+","additions":35,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"added","changes":5,"deletions":0,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testGetLabels.txt","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testGetLabels.txt","filename":"test/ReplayData/Issue.testGetLabels.txt","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+","additions":5,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":14,"deletions":7,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/IssueEvent.setUp.txt","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/IssueEvent.setUp.txt","filename":"test/ReplayData/IssueEvent.setUp.txt","patch":"@@ -1,15 +1,15 @@\n GET /user {'Authorization': 'Basic login_and_password_removed'} null\n 200\n-[('status', '200 OK'), ('x-ratelimit-remaining', '4907'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"99c9bfb75395b749e9913a4729126fb5\"'), ('date', 'Sun, 27 May 2012 07:19:30 GMT'), ('content-type', 'application/json; charset=utf-8')]\n-{\"private_gists\":5,\"type\":\"User\",\"company\":\"Criteo\",\"location\":\"Paris, France\",\"hireable\":false,\"gravatar_id\":\"b68de5ae38616c296fa345d2b9df2225\",\"bio\":\"\",\"following\":24,\"blog\":\"http://vincent-jacques.net\",\"avatar_url\":\"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png\",\"total_private_repos\":5,\"followers\":13,\"owned_private_repos\":5,\"disk_usage\":16976,\"collaborators\":0,\"html_url\":\"https://github.com/jacquev6\",\"url\":\"https://api.github.com/users/jacquev6\",\"name\":\"Vincent Jacques\",\"login\":\"jacquev6\",\"public_repos\":11,\"public_gists\":3,\"email\":\"vincent@vincent-jacques.net\",\"id\":327146,\"plan\":{\"private_repos\":5,\"collaborators\":1,\"name\":\"micro\",\"space\":614400},\"created_at\":\"2010-07-09T06:10:06Z\"}\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4996'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"8974bb1628a3e3a6d3eb3b08c1b5a46b\"'), ('date', 'Sun, 27 May 2012 07:32:54 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+{\"type\":\"User\",\"bio\":\"\",\"disk_usage\":16976,\"total_private_repos\":5,\"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\",\"owned_private_repos\":5,\"collaborators\":0,\"plan\":{\"collaborators\":1,\"private_repos\":5,\"name\":\"micro\",\"space\":614400},\"company\":\"Criteo\",\"gravatar_id\":\"b68de5ae38616c296fa345d2b9df2225\",\"login\":\"jacquev6\",\"email\":\"vincent@vincent-jacques.net\",\"public_gists\":3,\"followers\":13,\"name\":\"Vincent Jacques\",\"created_at\":\"2010-07-09T06:10:06Z\",\"blog\":\"http://vincent-jacques.net\",\"location\":\"Paris, France\",\"hireable\":false,\"id\":327146,\"private_gists\":5,\"public_repos\":11,\"following\":24,\"html_url\":\"https://github.com/jacquev6\"}\n \n GET /repos/jacquev6/PyGithub {'Authorization': 'Basic login_and_password_removed'} null\n 200\n-[('status', '200 OK'), ('x-ratelimit-remaining', '4906'), ('content-length', '1129'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"4c20acf0b23f75bbf25106b1a04f65a5\"'), ('date', 'Sun, 27 May 2012 07:19:31 GMT'), ('content-type', 'application/json; charset=utf-8')]\n-{\"description\":\"Python library implementing the full Github API v3\",\"full_name\":\"jacquev6/PyGithub\",\"has_wiki\":false,\"has_issues\":true,\"updated_at\":\"2012-05-27T06:55:28Z\",\"forks\":3,\"mirror_url\":null,\"homepage\":\"http://vincent-jacques.net/PyGithub\",\"ssh_url\":\"git@github.com:jacquev6/PyGithub.git\",\"open_issues\":16,\"fork\":false,\"svn_url\":\"https://github.com/jacquev6/PyGithub\",\"pushed_at\":\"2012-05-27T06:00:28Z\",\"size\":308,\"html_url\":\"https://github.com/jacquev6/PyGithub\",\"private\":false,\"url\":\"https://api.github.com/repos/jacquev6/PyGithub\",\"clone_url\":\"https://github.com/jacquev6/PyGithub.git\",\"owner\":{\"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},\"name\":\"PyGithub\",\"has_downloads\":true,\"language\":\"Python\",\"watchers\":15,\"git_url\":\"git://github.com/jacquev6/PyGithub.git\",\"id\":3544490,\"permissions\":{\"admin\":true,\"pull\":true,\"push\":true},\"created_at\":\"2012-02-25T12:53:47Z\"}\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4995'), ('content-length', '1129'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"f1e4eb3993a364b66b68ec9db42405bd\"'), ('date', 'Sun, 27 May 2012 07:32:55 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+{\"clone_url\":\"https://github.com/jacquev6/PyGithub.git\",\"has_downloads\":true,\"watchers\":15,\"updated_at\":\"2012-05-27T07:29:24Z\",\"permissions\":{\"pull\":true,\"admin\":true,\"push\":true},\"homepage\":\"http://vincent-jacques.net/PyGithub\",\"url\":\"https://api.github.com/repos/jacquev6/PyGithub\",\"mirror_url\":null,\"has_wiki\":false,\"has_issues\":true,\"fork\":false,\"forks\":3,\"git_url\":\"git://github.com/jacquev6/PyGithub.git\",\"size\":308,\"private\":false,\"open_issues\":16,\"svn_url\":\"https://github.com/jacquev6/PyGithub\",\"owner\":{\"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},\"name\":\"PyGithub\",\"language\":\"Python\",\"description\":\"Python library implementing the full Github API v3\",\"ssh_url\":\"git@github.com:jacquev6/PyGithub.git\",\"pushed_at\":\"2012-05-27T07:29:24Z\",\"created_at\":\"2012-02-25T12:53:47Z\",\"id\":3544490,\"html_url\":\"https://github.com/jacquev6/PyGithub\",\"full_name\":\"jacquev6/PyGithub\"}\n \n-GET /repos/jacquev6/PyGithub/issues/events/15819975 {'Authorization': 'Basic login_and_password_removed'} null\n+GET /repos/jacquev6/PyGithub/issues/events/16348656 {'Authorization': 'Basic login_and_password_removed'} null\n 200\n-[('status', '200 OK'), ('x-ratelimit-remaining', '4905'), ('content-length', '2430'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"a3d244842d23f92f69a23e21626fad11\"'), ('date', 'Sun, 27 May 2012 07:19:31 GMT'), ('content-type', 'application/json; charset=utf-8')]\n-{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/issues/events/15819975\",\"issue\":{\"updated_at\":\"2012-05-26T14:59:33Z\",\"body\":\"Body edited by PyGithub\",\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/issues/28\",\"comments\":0,\"milestone\":{\"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/1\",\"number\":1,\"title\":\"Version 0.4\",\"due_on\":\"2012-03-13T07:00:00Z\",\"closed_issues\":3,\"open_issues\":0,\"created_at\":\"2012-03-08T12:22:10Z\",\"state\":\"closed\",\"description\":\"\",\"id\":93546},\"number\":28,\"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\":\"2012-05-26T14:59:33Z\",\"title\":\"Issue created by PyGithub\",\"labels\":[{\"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\"}],\"created_at\":\"2012-05-19T10:38:23Z\",\"state\":\"closed\",\"user\":{\"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},\"id\":4653757,\"pull_request\":{\"diff_url\":null,\"patch_url\":null,\"html_url\":null},\"html_url\":\"https://github.com/jacquev6/PyGithub/issues/28\"},\"commit_id\":null,\"created_at\":\"2012-05-19T10:38:23Z\",\"event\":\"subscribed\",\"id\":15819975,\"actor\":{\"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}}\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '1384'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"fefecab09e7355d4ef9875677c2631da\"'), ('date', 'Sun, 27 May 2012 07:32:56 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/issues/events/16348656\",\"issue\":{\"updated_at\":\"2012-05-27T07:27:51Z\",\"body\":\"Body created by PyGithub\",\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/issues/30\",\"comments\":0,\"milestone\":null,\"number\":30,\"assignee\":null,\"closed_at\":null,\"title\":\"Issue also created by PyGithub\",\"labels\":[{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Question\",\"name\":\"Question\",\"color\":\"02e10c\"}],\"created_at\":\"2012-05-27T05:40:15Z\",\"state\":\"open\",\"user\":{\"url\":\"https://api.github.com/users/jacquev6\",\"gravatar_id\":\"b68de5ae38616c296fa345d2b9df2225\",\"login\":\"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\"},\"id\":4769659,\"pull_request\":{\"patch_url\":null,\"diff_url\":null,\"html_url\":null},\"html_url\":\"https://github.com/jacquev6/PyGithub/issues/30\"},\"commit_id\":\"ed866fc43833802ab553e5ff8581c81bb00dd433\",\"created_at\":\"2012-05-27T07:29:25Z\",\"event\":\"referenced\",\"id\":16348656,\"actor\":{\"url\":\"https://api.github.com/users/jacquev6\",\"gravatar_id\":\"b68de5ae38616c296fa345d2b9df2225\",\"login\":\"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\"}}\n ","additions":7,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"}] +[{"status":"modified","changes":2,"deletions":1,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/codegen/templates/GithubObject.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/codegen/templates/GithubObject.py","filename":"codegen/templates/GithubObject.py","patch":"@@ -70,7 +70,7 @@ def __useAttributes( self, attributes ):\n \n # @toto No need to check if attribute is in attributes when attribute is mandatory\n {% for attribute in class.attributes|dictsort:\"name\" %}\n- if \"{{ attribute.name }}\" in attributes and attributes[ \"{{ attribute.name }}\" ] is not None:\n+ if \"{{ attribute.name }}\" in attributes and attributes[ \"{{ attribute.name }}\" ] is not None: # pragma no branch\n \n {% if attribute.type.cardinality == \"scalar\" %}\n {% if attribute.type.simple %}","additions":1,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":50,"deletions":25,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/AuthenticatedUser.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/AuthenticatedUser.py","filename":"src/github/AuthenticatedUser.py","patch":"@@ -568,78 +568,78 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"avatar_url\", \"bio\", \"blog\", \"collaborators\", \"company\", \"created_at\", \"disk_usage\", \"email\", \"followers\", \"following\", \"gravatar_id\", \"hireable\", \"html_url\", \"id\", \"location\", \"login\", \"name\", \"owned_private_repos\", \"plan\", \"private_gists\", \"public_gists\", \"public_repos\", \"total_private_repos\", \"type\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"avatar_url\" in attributes and attributes[ \"avatar_url\" ] is not None:\n+ if \"avatar_url\" in attributes and attributes[ \"avatar_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"avatar_url\" ], ( str, unicode ) )\n self.__avatar_url = attributes[ \"avatar_url\" ]\n- if \"bio\" in attributes and attributes[ \"bio\" ] is not None:\n+ if \"bio\" in attributes and attributes[ \"bio\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"bio\" ], ( str, unicode ) )\n self.__bio = attributes[ \"bio\" ]\n- if \"blog\" in attributes and attributes[ \"blog\" ] is not None:\n+ if \"blog\" in attributes and attributes[ \"blog\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"blog\" ], ( str, unicode ) )\n self.__blog = attributes[ \"blog\" ]\n- if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None:\n+ if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"collaborators\" ], int )\n self.__collaborators = attributes[ \"collaborators\" ]\n- if \"company\" in attributes and attributes[ \"company\" ] is not None:\n+ if \"company\" in attributes and attributes[ \"company\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"company\" ], ( str, unicode ) )\n self.__company = attributes[ \"company\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"disk_usage\" in attributes and attributes[ \"disk_usage\" ] is not None:\n+ if \"disk_usage\" in attributes and attributes[ \"disk_usage\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"disk_usage\" ], int )\n self.__disk_usage = attributes[ \"disk_usage\" ]\n- if \"email\" in attributes and attributes[ \"email\" ] is not None:\n+ if \"email\" in attributes and attributes[ \"email\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"email\" ], ( str, unicode ) )\n self.__email = attributes[ \"email\" ]\n- if \"followers\" in attributes and attributes[ \"followers\" ] is not None:\n+ if \"followers\" in attributes and attributes[ \"followers\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"followers\" ], int )\n self.__followers = attributes[ \"followers\" ]\n- if \"following\" in attributes and attributes[ \"following\" ] is not None:\n+ if \"following\" in attributes and attributes[ \"following\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"following\" ], int )\n self.__following = attributes[ \"following\" ]\n- if \"gravatar_id\" in attributes and attributes[ \"gravatar_id\" ] is not None:\n+ if \"gravatar_id\" in attributes and attributes[ \"gravatar_id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"gravatar_id\" ], ( str, unicode ) )\n self.__gravatar_id = attributes[ \"gravatar_id\" ]\n- if \"hireable\" in attributes and attributes[ \"hireable\" ] is not None:\n+ if \"hireable\" in attributes and attributes[ \"hireable\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"hireable\" ], bool )\n self.__hireable = attributes[ \"hireable\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"location\" in attributes and attributes[ \"location\" ] is not None:\n+ if \"location\" in attributes and attributes[ \"location\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"location\" ], ( str, unicode ) )\n self.__location = attributes[ \"location\" ]\n- if \"login\" in attributes and attributes[ \"login\" ] is not None:\n+ if \"login\" in attributes and attributes[ \"login\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"login\" ], ( str, unicode ) )\n self.__login = attributes[ \"login\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]\n- if \"owned_private_repos\" in attributes and attributes[ \"owned_private_repos\" ] is not None:\n+ if \"owned_private_repos\" in attributes and attributes[ \"owned_private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"owned_private_repos\" ], int )\n self.__owned_private_repos = attributes[ \"owned_private_repos\" ]\n- if \"plan\" in attributes and attributes[ \"plan\" ] is not None:\n+ if \"plan\" in attributes and attributes[ \"plan\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"plan\" ], dict )\n self.__plan = Plan.Plan( self.__requester, attributes[ \"plan\" ], completion = LazyCompletion )\n- if \"private_gists\" in attributes and attributes[ \"private_gists\" ] is not None:\n+ if \"private_gists\" in attributes and attributes[ \"private_gists\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"private_gists\" ], int )\n self.__private_gists = attributes[ \"private_gists\" ]\n- if \"public_gists\" in attributes and attributes[ \"public_gists\" ] is not None:\n+ if \"public_gists\" in attributes and attributes[ \"public_gists\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public_gists\" ], int )\n self.__public_gists = attributes[ \"public_gists\" ]\n- if \"public_repos\" in attributes and attributes[ \"public_repos\" ] is not None:\n+ if \"public_repos\" in attributes and attributes[ \"public_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public_repos\" ], int )\n self.__public_repos = attributes[ \"public_repos\" ]\n- if \"total_private_repos\" in attributes and attributes[ \"total_private_repos\" ] is not None:\n+ if \"total_private_repos\" in attributes and attributes[ \"total_private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"total_private_repos\" ], int )\n self.__total_private_repos = attributes[ \"total_private_repos\" ]\n- if \"type\" in attributes and attributes[ \"type\" ] is not None:\n+ if \"type\" in attributes and attributes[ \"type\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"type\" ], ( str, unicode ) )\n self.__type = attributes[ \"type\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":25,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":18,"deletions":9,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Authorization.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Authorization.py","filename":"src/github/Authorization.py","patch":"@@ -117,21 +117,21 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"app\", \"created_at\", \"id\", \"note\", \"note_url\", \"scopes\", \"token\", \"updated_at\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"app\" in attributes and attributes[ \"app\" ] is not None:\n+ if \"app\" in attributes and attributes[ \"app\" ] is not None: # pragma no branch\n self.__app = attributes[ \"app\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"note\" in attributes and attributes[ \"note\" ] is not None:\n+ if \"note\" in attributes and attributes[ \"note\" ] is not None: # pragma no branch\n self.__note = attributes[ \"note\" ]\n- if \"note_url\" in attributes and attributes[ \"note_url\" ] is not None:\n+ if \"note_url\" in attributes and attributes[ \"note_url\" ] is not None: # pragma no branch\n self.__note_url = attributes[ \"note_url\" ]\n- if \"scopes\" in attributes and attributes[ \"scopes\" ] is not None:\n+ if \"scopes\" in attributes and attributes[ \"scopes\" ] is not None: # pragma no branch\n self.__scopes = attributes[ \"scopes\" ]\n- if \"token\" in attributes and attributes[ \"token\" ] is not None:\n+ if \"token\" in attributes and attributes[ \"token\" ] is not None: # pragma no branch\n self.__token = attributes[ \"token\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]","additions":9,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":4,"deletions":2,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Branch.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Branch.py","filename":"src/github/Branch.py","patch":"@@ -28,9 +28,9 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"commit\", \"name\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"commit\" in attributes and attributes[ \"commit\" ] is not None:\n+ if \"commit\" in attributes and attributes[ \"commit\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"commit\" ], dict )\n self.__commit = Commit.Commit( self.__requester, attributes[ \"commit\" ], completion = LazyCompletion )\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]","additions":2,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":16,"deletions":8,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Commit.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Commit.py","filename":"src/github/Commit.py","patch":"@@ -120,33 +120,33 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"author\", \"commit\", \"committer\", \"files\", \"parents\", \"sha\", \"stats\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"author\" in attributes and attributes[ \"author\" ] is not None:\n+ if \"author\" in attributes and attributes[ \"author\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"author\" ], dict )\n self.__author = NamedUser.NamedUser( self.__requester, attributes[ \"author\" ], completion = LazyCompletion )\n- if \"commit\" in attributes and attributes[ \"commit\" ] is not None:\n+ if \"commit\" in attributes and attributes[ \"commit\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"commit\" ], dict )\n self.__commit = GitCommit.GitCommit( self.__requester, attributes[ \"commit\" ], completion = LazyCompletion )\n- if \"committer\" in attributes and attributes[ \"committer\" ] is not None:\n+ if \"committer\" in attributes and attributes[ \"committer\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"committer\" ], dict )\n self.__committer = NamedUser.NamedUser( self.__requester, attributes[ \"committer\" ], completion = LazyCompletion )\n- if \"files\" in attributes and attributes[ \"files\" ] is not None:\n+ if \"files\" in attributes and attributes[ \"files\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"files\" ], list ) and ( len( attributes[ \"files\" ] ) == 0 or isinstance( attributes[ \"files\" ][ 0 ], dict ) )\n self.__files = [\n CommitFile.CommitFile( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"files\" ]\n ]\n- if \"parents\" in attributes and attributes[ \"parents\" ] is not None:\n+ if \"parents\" in attributes and attributes[ \"parents\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"parents\" ], list ) and ( len( attributes[ \"parents\" ] ) == 0 or isinstance( attributes[ \"parents\" ][ 0 ], dict ) )\n self.__parents = [\n Commit( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"parents\" ]\n ]\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"stats\" in attributes and attributes[ \"stats\" ] is not None:\n+ if \"stats\" in attributes and attributes[ \"stats\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"stats\" ], dict )\n self.__stats = CommitStats.CommitStats( self.__requester, attributes[ \"stats\" ], completion = LazyCompletion )\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":8,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":22,"deletions":11,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/CommitComment.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/CommitComment.py","filename":"src/github/CommitComment.py","patch":"@@ -121,36 +121,36 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"body\", \"commit_id\", \"created_at\", \"html_url\", \"id\", \"line\", \"path\", \"position\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"body\" in attributes and attributes[ \"body\" ] is not None:\n+ if \"body\" in attributes and attributes[ \"body\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"body\" ], ( str, unicode ) )\n self.__body = attributes[ \"body\" ]\n- if \"commit_id\" in attributes and attributes[ \"commit_id\" ] is not None:\n+ if \"commit_id\" in attributes and attributes[ \"commit_id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"commit_id\" ], ( str, unicode ) )\n self.__commit_id = attributes[ \"commit_id\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"line\" in attributes and attributes[ \"line\" ] is not None:\n+ if \"line\" in attributes and attributes[ \"line\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"line\" ], int )\n self.__line = attributes[ \"line\" ]\n- if \"path\" in attributes and attributes[ \"path\" ] is not None:\n+ if \"path\" in attributes and attributes[ \"path\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"path\" ], ( str, unicode ) )\n self.__path = attributes[ \"path\" ]\n- if \"position\" in attributes and attributes[ \"position\" ] is not None:\n+ if \"position\" in attributes and attributes[ \"position\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"position\" ], int )\n self.__position = attributes[ \"position\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"updated_at\" ], ( str, unicode ) )\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","additions":11,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":18,"deletions":9,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/CommitFile.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/CommitFile.py","filename":"src/github/CommitFile.py","patch":"@@ -62,21 +62,21 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"additions\", \"blob_url\", \"changes\", \"deletions\", \"filename\", \"patch\", \"raw_url\", \"sha\", \"status\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"additions\" in attributes and attributes[ \"additions\" ] is not None:\n+ if \"additions\" in attributes and attributes[ \"additions\" ] is not None: # pragma no branch\n self.__additions = attributes[ \"additions\" ]\n- if \"blob_url\" in attributes and attributes[ \"blob_url\" ] is not None:\n+ if \"blob_url\" in attributes and attributes[ \"blob_url\" ] is not None: # pragma no branch\n self.__blob_url = attributes[ \"blob_url\" ]\n- if \"changes\" in attributes and attributes[ \"changes\" ] is not None:\n+ if \"changes\" in attributes and attributes[ \"changes\" ] is not None: # pragma no branch\n self.__changes = attributes[ \"changes\" ]\n- if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None:\n+ if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None: # pragma no branch\n self.__deletions = attributes[ \"deletions\" ]\n- if \"filename\" in attributes and attributes[ \"filename\" ] is not None:\n+ if \"filename\" in attributes and attributes[ \"filename\" ] is not None: # pragma no branch\n self.__filename = attributes[ \"filename\" ]\n- if \"patch\" in attributes and attributes[ \"patch\" ] is not None:\n+ if \"patch\" in attributes and attributes[ \"patch\" ] is not None: # pragma no branch\n self.__patch = attributes[ \"patch\" ]\n- if \"raw_url\" in attributes and attributes[ \"raw_url\" ] is not None:\n+ if \"raw_url\" in attributes and attributes[ \"raw_url\" ] is not None: # pragma no branch\n self.__raw_url = attributes[ \"raw_url\" ]\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n self.__sha = attributes[ \"sha\" ]\n- if \"status\" in attributes and attributes[ \"status\" ] is not None:\n+ if \"status\" in attributes and attributes[ \"status\" ] is not None: # pragma no branch\n self.__status = attributes[ \"status\" ]","additions":9,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":6,"deletions":3,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/CommitStats.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/CommitStats.py","filename":"src/github/CommitStats.py","patch":"@@ -32,12 +32,12 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"additions\", \"deletions\", \"total\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"additions\" in attributes and attributes[ \"additions\" ] is not None:\n+ if \"additions\" in attributes and attributes[ \"additions\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"additions\" ], int )\n self.__additions = attributes[ \"additions\" ]\n- if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None:\n+ if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"deletions\" ], int )\n self.__deletions = attributes[ \"deletions\" ]\n- if \"total\" in attributes and attributes[ \"total\" ] is not None:\n+ if \"total\" in attributes and attributes[ \"total\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"total\" ], int )\n self.__total = attributes[ \"total\" ]","additions":3,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":40,"deletions":20,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Download.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Download.py","filename":"src/github/Download.py","patch":"@@ -162,43 +162,43 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"accesskeyid\", \"acl\", \"bucket\", \"content_type\", \"created_at\", \"description\", \"download_count\", \"expirationdate\", \"html_url\", \"id\", \"mime_type\", \"name\", \"path\", \"policy\", \"prefix\", \"redirect\", \"s3_url\", \"signature\", \"size\", \"url\", \"x-amz-meta-content-disposition\" ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"accesskeyid\" in attributes and attributes[ \"accesskeyid\" ] is not None:\n+ if \"accesskeyid\" in attributes and attributes[ \"accesskeyid\" ] is not None: # pragma no branch\n self.__accesskeyid = attributes[ \"accesskeyid\" ]\n- if \"acl\" in attributes and attributes[ \"acl\" ] is not None:\n+ if \"acl\" in attributes and attributes[ \"acl\" ] is not None: # pragma no branch\n self.__acl = attributes[ \"acl\" ]\n- if \"bucket\" in attributes and attributes[ \"bucket\" ] is not None:\n+ if \"bucket\" in attributes and attributes[ \"bucket\" ] is not None: # pragma no branch\n self.__bucket = attributes[ \"bucket\" ]\n- if \"content_type\" in attributes and attributes[ \"content_type\" ] is not None:\n+ if \"content_type\" in attributes and attributes[ \"content_type\" ] is not None: # pragma no branch\n self.__content_type = attributes[ \"content_type\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"description\" in attributes and attributes[ \"description\" ] is not None:\n+ if \"description\" in attributes and attributes[ \"description\" ] is not None: # pragma no branch\n self.__description = attributes[ \"description\" ]\n- if \"download_count\" in attributes and attributes[ \"download_count\" ] is not None:\n+ if \"download_count\" in attributes and attributes[ \"download_count\" ] is not None: # pragma no branch\n self.__download_count = attributes[ \"download_count\" ]\n- if \"expirationdate\" in attributes and attributes[ \"expirationdate\" ] is not None:\n+ if \"expirationdate\" in attributes and attributes[ \"expirationdate\" ] is not None: # pragma no branch\n self.__expirationdate = attributes[ \"expirationdate\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"mime_type\" in attributes and attributes[ \"mime_type\" ] is not None:\n+ if \"mime_type\" in attributes and attributes[ \"mime_type\" ] is not None: # pragma no branch\n self.__mime_type = attributes[ \"mime_type\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n self.__name = attributes[ \"name\" ]\n- if \"path\" in attributes and attributes[ \"path\" ] is not None:\n+ if \"path\" in attributes and attributes[ \"path\" ] is not None: # pragma no branch\n self.__path = attributes[ \"path\" ]\n- if \"policy\" in attributes and attributes[ \"policy\" ] is not None:\n+ if \"policy\" in attributes and attributes[ \"policy\" ] is not None: # pragma no branch\n self.__policy = attributes[ \"policy\" ]\n- if \"prefix\" in attributes and attributes[ \"prefix\" ] is not None:\n+ if \"prefix\" in attributes and attributes[ \"prefix\" ] is not None: # pragma no branch\n self.__prefix = attributes[ \"prefix\" ]\n- if \"redirect\" in attributes and attributes[ \"redirect\" ] is not None:\n+ if \"redirect\" in attributes and attributes[ \"redirect\" ] is not None: # pragma no branch\n self.__redirect = attributes[ \"redirect\" ]\n- if \"s3_url\" in attributes and attributes[ \"s3_url\" ] is not None:\n+ if \"s3_url\" in attributes and attributes[ \"s3_url\" ] is not None: # pragma no branch\n self.__s3_url = attributes[ \"s3_url\" ]\n- if \"signature\" in attributes and attributes[ \"signature\" ] is not None:\n+ if \"signature\" in attributes and attributes[ \"signature\" ] is not None: # pragma no branch\n self.__signature = attributes[ \"signature\" ]\n- if \"size\" in attributes and attributes[ \"size\" ] is not None:\n+ if \"size\" in attributes and attributes[ \"size\" ] is not None: # pragma no branch\n self.__size = attributes[ \"size\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]","additions":20,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":16,"deletions":8,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Event.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Event.py","filename":"src/github/Event.py","patch":"@@ -60,22 +60,22 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"actor\", \"created_at\", \"id\", \"org\", \"payload\", \"public\", \"repo\", \"type\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"actor\" in attributes and attributes[ \"actor\" ] is not None:\n+ if \"actor\" in attributes and attributes[ \"actor\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"actor\" ], dict )\n self.__actor = NamedUser.NamedUser( self.__requester, attributes[ \"actor\" ], completion = LazyCompletion )\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"org\" in attributes and attributes[ \"org\" ] is not None:\n+ if \"org\" in attributes and attributes[ \"org\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"org\" ], dict )\n self.__org = Organization.Organization( self.__requester, attributes[ \"org\" ], completion = LazyCompletion )\n- if \"payload\" in attributes and attributes[ \"payload\" ] is not None:\n+ if \"payload\" in attributes and attributes[ \"payload\" ] is not None: # pragma no branch\n self.__payload = attributes[ \"payload\" ]\n- if \"public\" in attributes and attributes[ \"public\" ] is not None:\n+ if \"public\" in attributes and attributes[ \"public\" ] is not None: # pragma no branch\n self.__public = attributes[ \"public\" ]\n- if \"repo\" in attributes and attributes[ \"repo\" ] is not None:\n+ if \"repo\" in attributes and attributes[ \"repo\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"repo\" ], dict )\n self.__repo = Repository.Repository( self.__requester, attributes[ \"repo\" ], completion = LazyCompletion )\n- if \"type\" in attributes and attributes[ \"type\" ] is not None:\n+ if \"type\" in attributes and attributes[ \"type\" ] is not None: # pragma no branch\n self.__type = attributes[ \"type\" ]","additions":8,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":30,"deletions":15,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Gist.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Gist.py","filename":"src/github/Gist.py","patch":"@@ -220,53 +220,53 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"comments\", \"created_at\", \"description\", \"files\", \"fork_of\", \"forks\", \"git_pull_url\", \"git_push_url\", \"history\", \"html_url\", \"id\", \"public\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"comments\" in attributes and attributes[ \"comments\" ] is not None:\n+ if \"comments\" in attributes and attributes[ \"comments\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"comments\" ], int )\n self.__comments = attributes[ \"comments\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"description\" in attributes and attributes[ \"description\" ] is not None:\n+ if \"description\" in attributes and attributes[ \"description\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"description\" ], ( str, unicode ) )\n self.__description = attributes[ \"description\" ]\n- if \"files\" in attributes and attributes[ \"files\" ] is not None:\n+ if \"files\" in attributes and attributes[ \"files\" ] is not None: # pragma no branch\n self.__files = attributes[ \"files\" ]\n- if \"fork_of\" in attributes and attributes[ \"fork_of\" ] is not None:\n+ if \"fork_of\" in attributes and attributes[ \"fork_of\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"fork_of\" ], dict )\n self.__fork_of = Gist( self.__requester, attributes[ \"fork_of\" ], completion = LazyCompletion )\n- if \"forks\" in attributes and attributes[ \"forks\" ] is not None:\n+ if \"forks\" in attributes and attributes[ \"forks\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"forks\" ], list ) and ( len( attributes[ \"forks\" ] ) == 0 or isinstance( attributes[ \"forks\" ][ 0 ], dict ) )\n self.__forks = [\n Gist( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"forks\" ]\n ]\n- if \"git_pull_url\" in attributes and attributes[ \"git_pull_url\" ] is not None:\n+ if \"git_pull_url\" in attributes and attributes[ \"git_pull_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"git_pull_url\" ], ( str, unicode ) )\n self.__git_pull_url = attributes[ \"git_pull_url\" ]\n- if \"git_push_url\" in attributes and attributes[ \"git_push_url\" ] is not None:\n+ if \"git_push_url\" in attributes and attributes[ \"git_push_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"git_push_url\" ], ( str, unicode ) )\n self.__git_push_url = attributes[ \"git_push_url\" ]\n- if \"history\" in attributes and attributes[ \"history\" ] is not None:\n+ if \"history\" in attributes and attributes[ \"history\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"history\" ], list ) and ( len( attributes[ \"history\" ] ) == 0 or isinstance( attributes[ \"history\" ][ 0 ], dict ) )\n self.__history = [\n GistHistoryState.GistHistoryState( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"history\" ]\n ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], ( str, unicode ) )\n self.__id = attributes[ \"id\" ]\n- if \"public\" in attributes and attributes[ \"public\" ] is not None:\n+ if \"public\" in attributes and attributes[ \"public\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public\" ], bool )\n self.__public = attributes[ \"public\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"updated_at\" ], ( str, unicode ) )\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","additions":15,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":12,"deletions":6,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GistComment.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GistComment.py","filename":"src/github/GistComment.py","patch":"@@ -68,16 +68,16 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"body\", \"created_at\", \"id\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"body\" in attributes and attributes[ \"body\" ] is not None:\n+ if \"body\" in attributes and attributes[ \"body\" ] is not None: # pragma no branch\n self.__body = attributes[ \"body\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","additions":6,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":10,"deletions":5,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GistHistoryState.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GistHistoryState.py","filename":"src/github/GistHistoryState.py","patch":"@@ -44,18 +44,18 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"change_status\", \"committed_at\", \"url\", \"user\", \"version\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"change_status\" in attributes and attributes[ \"change_status\" ] is not None:\n+ if \"change_status\" in attributes and attributes[ \"change_status\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"change_status\" ], dict )\n self.__change_status = CommitStats.CommitStats( self.__requester, attributes[ \"change_status\" ], completion = LazyCompletion )\n- if \"committed_at\" in attributes and attributes[ \"committed_at\" ] is not None:\n+ if \"committed_at\" in attributes and attributes[ \"committed_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"committed_at\" ], ( str, unicode ) )\n self.__committed_at = attributes[ \"committed_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )\n- if \"version\" in attributes and attributes[ \"version\" ] is not None:\n+ if \"version\" in attributes and attributes[ \"version\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"version\" ], ( str, unicode ) )\n self.__version = attributes[ \"version\" ]","additions":5,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":6,"deletions":3,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitAuthor.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitAuthor.py","filename":"src/github/GitAuthor.py","patch":"@@ -32,12 +32,12 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"date\", \"email\", \"name\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"date\" in attributes and attributes[ \"date\" ] is not None:\n+ if \"date\" in attributes and attributes[ \"date\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"date\" ], ( str, unicode ) )\n self.__date = attributes[ \"date\" ]\n- if \"email\" in attributes and attributes[ \"email\" ] is not None:\n+ if \"email\" in attributes and attributes[ \"email\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"email\" ], ( str, unicode ) )\n self.__email = attributes[ \"email\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]","additions":3,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":10,"deletions":5,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitBlob.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitBlob.py","filename":"src/github/GitBlob.py","patch":"@@ -42,18 +42,18 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"content\", \"encoding\", \"sha\", \"size\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"content\" in attributes and attributes[ \"content\" ] is not None:\n+ if \"content\" in attributes and attributes[ \"content\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"content\" ], ( str, unicode ) )\n self.__content = attributes[ \"content\" ]\n- if \"encoding\" in attributes and attributes[ \"encoding\" ] is not None:\n+ if \"encoding\" in attributes and attributes[ \"encoding\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"encoding\" ], ( str, unicode ) )\n self.__encoding = attributes[ \"encoding\" ]\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"size\" in attributes and attributes[ \"size\" ] is not None:\n+ if \"size\" in attributes and attributes[ \"size\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"size\" ], int )\n self.__size = attributes[ \"size\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":5,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":14,"deletions":7,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitCommit.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitCommit.py","filename":"src/github/GitCommit.py","patch":"@@ -55,27 +55,27 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"author\", \"committer\", \"message\", \"parents\", \"sha\", \"tree\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"author\" in attributes and attributes[ \"author\" ] is not None:\n+ if \"author\" in attributes and attributes[ \"author\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"author\" ], dict )\n self.__author = GitAuthor.GitAuthor( self.__requester, attributes[ \"author\" ], completion = LazyCompletion )\n- if \"committer\" in attributes and attributes[ \"committer\" ] is not None:\n+ if \"committer\" in attributes and attributes[ \"committer\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"committer\" ], dict )\n self.__committer = GitAuthor.GitAuthor( self.__requester, attributes[ \"committer\" ], completion = LazyCompletion )\n- if \"message\" in attributes and attributes[ \"message\" ] is not None:\n+ if \"message\" in attributes and attributes[ \"message\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"message\" ], ( str, unicode ) )\n self.__message = attributes[ \"message\" ]\n- if \"parents\" in attributes and attributes[ \"parents\" ] is not None:\n+ if \"parents\" in attributes and attributes[ \"parents\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"parents\" ], list ) and ( len( attributes[ \"parents\" ] ) == 0 or isinstance( attributes[ \"parents\" ][ 0 ], dict ) )\n self.__parents = [\n GitCommit( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"parents\" ]\n ]\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"tree\" in attributes and attributes[ \"tree\" ] is not None:\n+ if \"tree\" in attributes and attributes[ \"tree\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"tree\" ], dict )\n self.__tree = GitTree.GitTree( self.__requester, attributes[ \"tree\" ], completion = LazyCompletion )\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":7,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":6,"deletions":3,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitObject.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitObject.py","filename":"src/github/GitObject.py","patch":"@@ -32,12 +32,12 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"sha\", \"type\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"type\" in attributes and attributes[ \"type\" ] is not None:\n+ if \"type\" in attributes and attributes[ \"type\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"type\" ], ( str, unicode ) )\n self.__type = attributes[ \"type\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":3,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":6,"deletions":3,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitRef.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitRef.py","filename":"src/github/GitRef.py","patch":"@@ -55,12 +55,12 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"object\", \"ref\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"object\" in attributes and attributes[ \"object\" ] is not None:\n+ if \"object\" in attributes and attributes[ \"object\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"object\" ], dict )\n self.__object = GitObject.GitObject( self.__requester, attributes[ \"object\" ], completion = LazyCompletion )\n- if \"ref\" in attributes and attributes[ \"ref\" ] is not None:\n+ if \"ref\" in attributes and attributes[ \"ref\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"ref\" ], ( str, unicode ) )\n self.__ref = attributes[ \"ref\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":3,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":12,"deletions":6,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitTag.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitTag.py","filename":"src/github/GitTag.py","patch":"@@ -49,21 +49,21 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"message\", \"object\", \"sha\", \"tag\", \"tagger\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"message\" in attributes and attributes[ \"message\" ] is not None:\n+ if \"message\" in attributes and attributes[ \"message\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"message\" ], ( str, unicode ) )\n self.__message = attributes[ \"message\" ]\n- if \"object\" in attributes and attributes[ \"object\" ] is not None:\n+ if \"object\" in attributes and attributes[ \"object\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"object\" ], dict )\n self.__object = GitObject.GitObject( self.__requester, attributes[ \"object\" ], completion = LazyCompletion )\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"tag\" in attributes and attributes[ \"tag\" ] is not None:\n+ if \"tag\" in attributes and attributes[ \"tag\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"tag\" ], ( str, unicode ) )\n self.__tag = attributes[ \"tag\" ]\n- if \"tagger\" in attributes and attributes[ \"tagger\" ] is not None:\n+ if \"tagger\" in attributes and attributes[ \"tagger\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"tagger\" ], dict )\n self.__tagger = GitAuthor.GitAuthor( self.__requester, attributes[ \"tagger\" ], completion = LazyCompletion )\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":6,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":6,"deletions":3,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitTree.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitTree.py","filename":"src/github/GitTree.py","patch":"@@ -33,15 +33,15 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"sha\", \"tree\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"tree\" in attributes and attributes[ \"tree\" ] is not None:\n+ if \"tree\" in attributes and attributes[ \"tree\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"tree\" ], list ) and ( len( attributes[ \"tree\" ] ) == 0 or isinstance( attributes[ \"tree\" ][ 0 ], dict ) )\n self.__tree = [\n GitTreeElement.GitTreeElement( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"tree\" ]\n ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":3,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":12,"deletions":6,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitTreeElement.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/GitTreeElement.py","filename":"src/github/GitTreeElement.py","patch":"@@ -47,21 +47,21 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"mode\", \"path\", \"sha\", \"size\", \"type\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"mode\" in attributes and attributes[ \"mode\" ] is not None:\n+ if \"mode\" in attributes and attributes[ \"mode\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"mode\" ], ( str, unicode ) )\n self.__mode = attributes[ \"mode\" ]\n- if \"path\" in attributes and attributes[ \"path\" ] is not None:\n+ if \"path\" in attributes and attributes[ \"path\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"path\" ], ( str, unicode ) )\n self.__path = attributes[ \"path\" ]\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"sha\" ], ( str, unicode ) )\n self.__sha = attributes[ \"sha\" ]\n- if \"size\" in attributes and attributes[ \"size\" ] is not None:\n+ if \"size\" in attributes and attributes[ \"size\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"size\" ], int )\n self.__size = attributes[ \"size\" ]\n- if \"type\" in attributes and attributes[ \"type\" ] is not None:\n+ if \"type\" in attributes and attributes[ \"type\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"type\" ], ( str, unicode ) )\n self.__type = attributes[ \"type\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":6,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":18,"deletions":9,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Hook.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Hook.py","filename":"src/github/Hook.py","patch":"@@ -99,21 +99,21 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"active\", \"config\", \"created_at\", \"events\", \"id\", \"last_response\", \"name\", \"updated_at\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"active\" in attributes and attributes[ \"active\" ] is not None:\n+ if \"active\" in attributes and attributes[ \"active\" ] is not None: # pragma no branch\n self.__active = attributes[ \"active\" ]\n- if \"config\" in attributes and attributes[ \"config\" ] is not None:\n+ if \"config\" in attributes and attributes[ \"config\" ] is not None: # pragma no branch\n self.__config = attributes[ \"config\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"events\" in attributes and attributes[ \"events\" ] is not None:\n+ if \"events\" in attributes and attributes[ \"events\" ] is not None: # pragma no branch\n self.__events = attributes[ \"events\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"last_response\" in attributes and attributes[ \"last_response\" ] is not None:\n+ if \"last_response\" in attributes and attributes[ \"last_response\" ] is not None: # pragma no branch\n self.__last_response = attributes[ \"last_response\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n self.__name = attributes[ \"name\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]","additions":9,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":53,"deletions":21,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Issue.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Issue.py","filename":"src/github/Issue.py","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\n@@ -257,59 +268,59 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"assignee\", \"body\", \"closed_at\", \"closed_by\", \"comments\", \"created_at\", \"html_url\", \"id\", \"labels\", \"milestone\", \"number\", \"pull_request\", \"repository\", \"state\", \"title\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"assignee\" in attributes and attributes[ \"assignee\" ] is not None:\n+ if \"assignee\" in attributes and attributes[ \"assignee\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"assignee\" ], dict )\n self.__assignee = NamedUser.NamedUser( self.__requester, attributes[ \"assignee\" ], completion = LazyCompletion )\n- if \"body\" in attributes and attributes[ \"body\" ] is not None:\n+ if \"body\" in attributes and attributes[ \"body\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"body\" ], ( str, unicode ) )\n self.__body = attributes[ \"body\" ]\n- if \"closed_at\" in attributes and attributes[ \"closed_at\" ] is not None:\n+ if \"closed_at\" in attributes and attributes[ \"closed_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"closed_at\" ], ( str, unicode ) )\n self.__closed_at = attributes[ \"closed_at\" ]\n- if \"closed_by\" in attributes and attributes[ \"closed_by\" ] is not None:\n+ if \"closed_by\" in attributes and attributes[ \"closed_by\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"closed_by\" ], dict )\n self.__closed_by = NamedUser.NamedUser( self.__requester, attributes[ \"closed_by\" ], completion = LazyCompletion )\n- if \"comments\" in attributes and attributes[ \"comments\" ] is not None:\n+ if \"comments\" in attributes and attributes[ \"comments\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"comments\" ], int )\n self.__comments = attributes[ \"comments\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"labels\" in attributes and attributes[ \"labels\" ] is not None:\n+ if \"labels\" in attributes and attributes[ \"labels\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"labels\" ], list ) and ( len( attributes[ \"labels\" ] ) == 0 or isinstance( attributes[ \"labels\" ][ 0 ], dict ) )\n self.__labels = [\n Label.Label( self.__requester, element, completion = LazyCompletion )\n for element in attributes[ \"labels\" ]\n ]\n- if \"milestone\" in attributes and attributes[ \"milestone\" ] is not None:\n+ if \"milestone\" in attributes and attributes[ \"milestone\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"milestone\" ], dict )\n self.__milestone = Milestone.Milestone( self.__requester, attributes[ \"milestone\" ], completion = LazyCompletion )\n- if \"number\" in attributes and attributes[ \"number\" ] is not None:\n+ if \"number\" in attributes and attributes[ \"number\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"number\" ], int )\n self.__number = attributes[ \"number\" ]\n- if \"pull_request\" in attributes and attributes[ \"pull_request\" ] is not None:\n+ if \"pull_request\" in attributes and attributes[ \"pull_request\" ] is not None: # pragma no branch\n self.__pull_request = attributes[ \"pull_request\" ]\n- if \"repository\" in attributes and attributes[ \"repository\" ] is not None:\n+ if \"repository\" in attributes and attributes[ \"repository\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"repository\" ], dict )\n self.__repository = Repository.Repository( self.__requester, attributes[ \"repository\" ], completion = LazyCompletion )\n- if \"state\" in attributes and attributes[ \"state\" ] is not None:\n+ if \"state\" in attributes and attributes[ \"state\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"state\" ], ( str, unicode ) )\n self.__state = attributes[ \"state\" ]\n- if \"title\" in attributes and attributes[ \"title\" ] is not None:\n+ if \"title\" in attributes and attributes[ \"title\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"title\" ], ( str, unicode ) )\n self.__title = attributes[ \"title\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"updated_at\" ], ( str, unicode ) )\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","additions":32,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":12,"deletions":6,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/IssueComment.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/IssueComment.py","filename":"src/github/IssueComment.py","patch":"@@ -68,16 +68,16 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"body\", \"created_at\", \"id\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"body\" in attributes and attributes[ \"body\" ] is not None:\n+ if \"body\" in attributes and attributes[ \"body\" ] is not None: # pragma no branch\n self.__body = attributes[ \"body\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","additions":6,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":14,"deletions":7,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/IssueEvent.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/IssueEvent.py","filename":"src/github/IssueEvent.py","patch":"@@ -78,24 +78,24 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"actor\", \"commit_id\", \"created_at\", \"event\", \"id\", \"issue\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"actor\" in attributes and attributes[ \"actor\" ] is not None:\n+ if \"actor\" in attributes and attributes[ \"actor\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"actor\" ], dict )\n self.__actor = NamedUser.NamedUser( self.__requester, attributes[ \"actor\" ], completion = LazyCompletion )\n- if \"commit_id\" in attributes and attributes[ \"commit_id\" ] is not None:\n+ if \"commit_id\" in attributes and attributes[ \"commit_id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"commit_id\" ], ( str, unicode ) )\n self.__commit_id = attributes[ \"commit_id\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"event\" in attributes and attributes[ \"event\" ] is not None:\n+ if \"event\" in attributes and attributes[ \"event\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"event\" ], ( str, unicode ) )\n self.__event = attributes[ \"event\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"issue\" in attributes and attributes[ \"issue\" ] is not None:\n+ if \"issue\" in attributes and attributes[ \"issue\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"issue\" ], dict )\n self.__issue = Issue.Issue( self.__requester, attributes[ \"issue\" ], completion = LazyCompletion )\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":7,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":13,"deletions":3,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Label.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Label.py","filename":"src/github/Label.py","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+ # @toto 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\n@@ -53,9 +60,9 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"color\", \"name\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"color\" in attributes and attributes[ \"color\" ] is not None:\n+ if \"color\" in attributes and attributes[ \"color\" ] is not None: # pragma no branch\n self.__color = attributes[ \"color\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n self.__name = attributes[ \"name\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]","additions":10,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":22,"deletions":11,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Milestone.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Milestone.py","filename":"src/github/Milestone.py","patch":"@@ -114,36 +114,36 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"closed_issues\", \"created_at\", \"creator\", \"description\", \"due_on\", \"id\", \"number\", \"open_issues\", \"state\", \"title\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"closed_issues\" in attributes and attributes[ \"closed_issues\" ] is not None:\n+ if \"closed_issues\" in attributes and attributes[ \"closed_issues\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"closed_issues\" ], int )\n self.__closed_issues = attributes[ \"closed_issues\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"creator\" in attributes and attributes[ \"creator\" ] is not None:\n+ if \"creator\" in attributes and attributes[ \"creator\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"creator\" ], dict )\n self.__creator = NamedUser.NamedUser( self.__requester, attributes[ \"creator\" ], completion = LazyCompletion )\n- if \"description\" in attributes and attributes[ \"description\" ] is not None:\n+ if \"description\" in attributes and attributes[ \"description\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"description\" ], ( str, unicode ) )\n self.__description = attributes[ \"description\" ]\n- if \"due_on\" in attributes and attributes[ \"due_on\" ] is not None:\n+ if \"due_on\" in attributes and attributes[ \"due_on\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"due_on\" ], ( str, unicode ) )\n self.__due_on = attributes[ \"due_on\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"number\" in attributes and attributes[ \"number\" ] is not None:\n+ if \"number\" in attributes and attributes[ \"number\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"number\" ], int )\n self.__number = attributes[ \"number\" ]\n- if \"open_issues\" in attributes and attributes[ \"open_issues\" ] is not None:\n+ if \"open_issues\" in attributes and attributes[ \"open_issues\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"open_issues\" ], int )\n self.__open_issues = attributes[ \"open_issues\" ]\n- if \"state\" in attributes and attributes[ \"state\" ] is not None:\n+ if \"state\" in attributes and attributes[ \"state\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"state\" ], ( str, unicode ) )\n self.__state = attributes[ \"state\" ]\n- if \"title\" in attributes and attributes[ \"title\" ] is not None:\n+ if \"title\" in attributes and attributes[ \"title\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"title\" ], ( str, unicode ) )\n self.__title = attributes[ \"title\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":11,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":52,"deletions":26,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/NamedUser.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/NamedUser.py","filename":"src/github/NamedUser.py","patch":"@@ -365,81 +365,81 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"avatar_url\", \"bio\", \"blog\", \"collaborators\", \"company\", \"contributions\", \"created_at\", \"disk_usage\", \"email\", \"followers\", \"following\", \"gravatar_id\", \"hireable\", \"html_url\", \"id\", \"location\", \"login\", \"name\", \"owned_private_repos\", \"plan\", \"private_gists\", \"public_gists\", \"public_repos\", \"total_private_repos\", \"type\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"avatar_url\" in attributes and attributes[ \"avatar_url\" ] is not None:\n+ if \"avatar_url\" in attributes and attributes[ \"avatar_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"avatar_url\" ], ( str, unicode ) )\n self.__avatar_url = attributes[ \"avatar_url\" ]\n- if \"bio\" in attributes and attributes[ \"bio\" ] is not None:\n+ if \"bio\" in attributes and attributes[ \"bio\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"bio\" ], ( str, unicode ) )\n self.__bio = attributes[ \"bio\" ]\n- if \"blog\" in attributes and attributes[ \"blog\" ] is not None:\n+ if \"blog\" in attributes and attributes[ \"blog\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"blog\" ], ( str, unicode ) )\n self.__blog = attributes[ \"blog\" ]\n- if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None:\n+ if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"collaborators\" ], int )\n self.__collaborators = attributes[ \"collaborators\" ]\n- if \"company\" in attributes and attributes[ \"company\" ] is not None:\n+ if \"company\" in attributes and attributes[ \"company\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"company\" ], ( str, unicode ) )\n self.__company = attributes[ \"company\" ]\n- if \"contributions\" in attributes and attributes[ \"contributions\" ] is not None:\n+ if \"contributions\" in attributes and attributes[ \"contributions\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"contributions\" ], int )\n self.__contributions = attributes[ \"contributions\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"disk_usage\" in attributes and attributes[ \"disk_usage\" ] is not None:\n+ if \"disk_usage\" in attributes and attributes[ \"disk_usage\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"disk_usage\" ], int )\n self.__disk_usage = attributes[ \"disk_usage\" ]\n- if \"email\" in attributes and attributes[ \"email\" ] is not None:\n+ if \"email\" in attributes and attributes[ \"email\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"email\" ], ( str, unicode ) )\n self.__email = attributes[ \"email\" ]\n- if \"followers\" in attributes and attributes[ \"followers\" ] is not None:\n+ if \"followers\" in attributes and attributes[ \"followers\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"followers\" ], int )\n self.__followers = attributes[ \"followers\" ]\n- if \"following\" in attributes and attributes[ \"following\" ] is not None:\n+ if \"following\" in attributes and attributes[ \"following\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"following\" ], int )\n self.__following = attributes[ \"following\" ]\n- if \"gravatar_id\" in attributes and attributes[ \"gravatar_id\" ] is not None:\n+ if \"gravatar_id\" in attributes and attributes[ \"gravatar_id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"gravatar_id\" ], ( str, unicode ) )\n self.__gravatar_id = attributes[ \"gravatar_id\" ]\n- if \"hireable\" in attributes and attributes[ \"hireable\" ] is not None:\n+ if \"hireable\" in attributes and attributes[ \"hireable\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"hireable\" ], bool )\n self.__hireable = attributes[ \"hireable\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"location\" in attributes and attributes[ \"location\" ] is not None:\n+ if \"location\" in attributes and attributes[ \"location\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"location\" ], ( str, unicode ) )\n self.__location = attributes[ \"location\" ]\n- if \"login\" in attributes and attributes[ \"login\" ] is not None:\n+ if \"login\" in attributes and attributes[ \"login\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"login\" ], ( str, unicode ) )\n self.__login = attributes[ \"login\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]\n- if \"owned_private_repos\" in attributes and attributes[ \"owned_private_repos\" ] is not None:\n+ if \"owned_private_repos\" in attributes and attributes[ \"owned_private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"owned_private_repos\" ], int )\n self.__owned_private_repos = attributes[ \"owned_private_repos\" ]\n- if \"plan\" in attributes and attributes[ \"plan\" ] is not None:\n+ if \"plan\" in attributes and attributes[ \"plan\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"plan\" ], dict )\n self.__plan = Plan.Plan( self.__requester, attributes[ \"plan\" ], completion = LazyCompletion )\n- if \"private_gists\" in attributes and attributes[ \"private_gists\" ] is not None:\n+ if \"private_gists\" in attributes and attributes[ \"private_gists\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"private_gists\" ], int )\n self.__private_gists = attributes[ \"private_gists\" ]\n- if \"public_gists\" in attributes and attributes[ \"public_gists\" ] is not None:\n+ if \"public_gists\" in attributes and attributes[ \"public_gists\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public_gists\" ], int )\n self.__public_gists = attributes[ \"public_gists\" ]\n- if \"public_repos\" in attributes and attributes[ \"public_repos\" ] is not None:\n+ if \"public_repos\" in attributes and attributes[ \"public_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public_repos\" ], int )\n self.__public_repos = attributes[ \"public_repos\" ]\n- if \"total_private_repos\" in attributes and attributes[ \"total_private_repos\" ] is not None:\n+ if \"total_private_repos\" in attributes and attributes[ \"total_private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"total_private_repos\" ], int )\n self.__total_private_repos = attributes[ \"total_private_repos\" ]\n- if \"type\" in attributes and attributes[ \"type\" ] is not None:\n+ if \"type\" in attributes and attributes[ \"type\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"type\" ], ( str, unicode ) )\n self.__type = attributes[ \"type\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":26,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":48,"deletions":24,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Organization.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Organization.py","filename":"src/github/Organization.py","patch":"@@ -390,75 +390,75 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"avatar_url\", \"billing_email\", \"blog\", \"collaborators\", \"company\", \"created_at\", \"disk_usage\", \"email\", \"followers\", \"following\", \"gravatar_id\", \"html_url\", \"id\", \"location\", \"login\", \"name\", \"owned_private_repos\", \"plan\", \"private_gists\", \"public_gists\", \"public_repos\", \"total_private_repos\", \"type\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"avatar_url\" in attributes and attributes[ \"avatar_url\" ] is not None:\n+ if \"avatar_url\" in attributes and attributes[ \"avatar_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"avatar_url\" ], ( str, unicode ) )\n self.__avatar_url = attributes[ \"avatar_url\" ]\n- if \"billing_email\" in attributes and attributes[ \"billing_email\" ] is not None:\n+ if \"billing_email\" in attributes and attributes[ \"billing_email\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"billing_email\" ], ( str, unicode ) )\n self.__billing_email = attributes[ \"billing_email\" ]\n- if \"blog\" in attributes and attributes[ \"blog\" ] is not None:\n+ if \"blog\" in attributes and attributes[ \"blog\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"blog\" ], ( str, unicode ) )\n self.__blog = attributes[ \"blog\" ]\n- if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None:\n+ if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"collaborators\" ], int )\n self.__collaborators = attributes[ \"collaborators\" ]\n- if \"company\" in attributes and attributes[ \"company\" ] is not None:\n+ if \"company\" in attributes and attributes[ \"company\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"company\" ], ( str, unicode ) )\n self.__company = attributes[ \"company\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"disk_usage\" in attributes and attributes[ \"disk_usage\" ] is not None:\n+ if \"disk_usage\" in attributes and attributes[ \"disk_usage\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"disk_usage\" ], int )\n self.__disk_usage = attributes[ \"disk_usage\" ]\n- if \"email\" in attributes and attributes[ \"email\" ] is not None:\n+ if \"email\" in attributes and attributes[ \"email\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"email\" ], ( str, unicode ) )\n self.__email = attributes[ \"email\" ]\n- if \"followers\" in attributes and attributes[ \"followers\" ] is not None:\n+ if \"followers\" in attributes and attributes[ \"followers\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"followers\" ], int )\n self.__followers = attributes[ \"followers\" ]\n- if \"following\" in attributes and attributes[ \"following\" ] is not None:\n+ if \"following\" in attributes and attributes[ \"following\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"following\" ], int )\n self.__following = attributes[ \"following\" ]\n- if \"gravatar_id\" in attributes and attributes[ \"gravatar_id\" ] is not None:\n+ if \"gravatar_id\" in attributes and attributes[ \"gravatar_id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"gravatar_id\" ], ( str, unicode ) )\n self.__gravatar_id = attributes[ \"gravatar_id\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"location\" in attributes and attributes[ \"location\" ] is not None:\n+ if \"location\" in attributes and attributes[ \"location\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"location\" ], ( str, unicode ) )\n self.__location = attributes[ \"location\" ]\n- if \"login\" in attributes and attributes[ \"login\" ] is not None:\n+ if \"login\" in attributes and attributes[ \"login\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"login\" ], ( str, unicode ) )\n self.__login = attributes[ \"login\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]\n- if \"owned_private_repos\" in attributes and attributes[ \"owned_private_repos\" ] is not None:\n+ if \"owned_private_repos\" in attributes and attributes[ \"owned_private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"owned_private_repos\" ], int )\n self.__owned_private_repos = attributes[ \"owned_private_repos\" ]\n- if \"plan\" in attributes and attributes[ \"plan\" ] is not None:\n+ if \"plan\" in attributes and attributes[ \"plan\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"plan\" ], dict )\n self.__plan = Plan.Plan( self.__requester, attributes[ \"plan\" ], completion = LazyCompletion )\n- if \"private_gists\" in attributes and attributes[ \"private_gists\" ] is not None:\n+ if \"private_gists\" in attributes and attributes[ \"private_gists\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"private_gists\" ], int )\n self.__private_gists = attributes[ \"private_gists\" ]\n- if \"public_gists\" in attributes and attributes[ \"public_gists\" ] is not None:\n+ if \"public_gists\" in attributes and attributes[ \"public_gists\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public_gists\" ], int )\n self.__public_gists = attributes[ \"public_gists\" ]\n- if \"public_repos\" in attributes and attributes[ \"public_repos\" ] is not None:\n+ if \"public_repos\" in attributes and attributes[ \"public_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"public_repos\" ], int )\n self.__public_repos = attributes[ \"public_repos\" ]\n- if \"total_private_repos\" in attributes and attributes[ \"total_private_repos\" ] is not None:\n+ if \"total_private_repos\" in attributes and attributes[ \"total_private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"total_private_repos\" ], int )\n self.__total_private_repos = attributes[ \"total_private_repos\" ]\n- if \"type\" in attributes and attributes[ \"type\" ] is not None:\n+ if \"type\" in attributes and attributes[ \"type\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"type\" ], ( str, unicode ) )\n self.__type = attributes[ \"type\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]","additions":24,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":6,"deletions":3,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Permissions.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Permissions.py","filename":"src/github/Permissions.py","patch":"@@ -32,12 +32,12 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"admin\", \"pull\", \"push\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"admin\" in attributes and attributes[ \"admin\" ] is not None:\n+ if \"admin\" in attributes and attributes[ \"admin\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"admin\" ], bool )\n self.__admin = attributes[ \"admin\" ]\n- if \"pull\" in attributes and attributes[ \"pull\" ] is not None:\n+ if \"pull\" in attributes and attributes[ \"pull\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"pull\" ], bool )\n self.__pull = attributes[ \"pull\" ]\n- if \"push\" in attributes and attributes[ \"push\" ] is not None:\n+ if \"push\" in attributes and attributes[ \"push\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"push\" ], bool )\n self.__push = attributes[ \"push\" ]","additions":3,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":8,"deletions":4,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Plan.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Plan.py","filename":"src/github/Plan.py","patch":"@@ -37,15 +37,15 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"collaborators\", \"name\", \"private_repos\", \"space\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None:\n+ if \"collaborators\" in attributes and attributes[ \"collaborators\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"collaborators\" ], int )\n self.__collaborators = attributes[ \"collaborators\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]\n- if \"private_repos\" in attributes and attributes[ \"private_repos\" ] is not None:\n+ if \"private_repos\" in attributes and attributes[ \"private_repos\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"private_repos\" ], int )\n self.__private_repos = attributes[ \"private_repos\" ]\n- if \"space\" in attributes and attributes[ \"space\" ] is not None:\n+ if \"space\" in attributes and attributes[ \"space\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"space\" ], int )\n self.__space = attributes[ \"space\" ]","additions":4,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":52,"deletions":26,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/PullRequest.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/PullRequest.py","filename":"src/github/PullRequest.py","patch":"@@ -279,56 +279,56 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"additions\", \"base\", \"body\", \"changed_files\", \"closed_at\", \"comments\", \"commits\", \"created_at\", \"deletions\", \"diff_url\", \"head\", \"html_url\", \"id\", \"issue_url\", \"mergeable\", \"merged\", \"merged_at\", \"merged_by\", \"number\", \"patch_url\", \"review_comments\", \"state\", \"title\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"additions\" in attributes and attributes[ \"additions\" ] is not None:\n+ if \"additions\" in attributes and attributes[ \"additions\" ] is not None: # pragma no branch\n self.__additions = attributes[ \"additions\" ]\n- if \"base\" in attributes and attributes[ \"base\" ] is not None:\n+ if \"base\" in attributes and attributes[ \"base\" ] is not None: # pragma no branch\n self.__base = attributes[ \"base\" ]\n- if \"body\" in attributes and attributes[ \"body\" ] is not None:\n+ if \"body\" in attributes and attributes[ \"body\" ] is not None: # pragma no branch\n self.__body = attributes[ \"body\" ]\n- if \"changed_files\" in attributes and attributes[ \"changed_files\" ] is not None:\n+ if \"changed_files\" in attributes and attributes[ \"changed_files\" ] is not None: # pragma no branch\n self.__changed_files = attributes[ \"changed_files\" ]\n- if \"closed_at\" in attributes and attributes[ \"closed_at\" ] is not None:\n+ if \"closed_at\" in attributes and attributes[ \"closed_at\" ] is not None: # pragma no branch\n self.__closed_at = attributes[ \"closed_at\" ]\n- if \"comments\" in attributes and attributes[ \"comments\" ] is not None:\n+ if \"comments\" in attributes and attributes[ \"comments\" ] is not None: # pragma no branch\n self.__comments = attributes[ \"comments\" ]\n- if \"commits\" in attributes and attributes[ \"commits\" ] is not None:\n+ if \"commits\" in attributes and attributes[ \"commits\" ] is not None: # pragma no branch\n self.__commits = attributes[ \"commits\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None:\n+ if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None: # pragma no branch\n self.__deletions = attributes[ \"deletions\" ]\n- if \"diff_url\" in attributes and attributes[ \"diff_url\" ] is not None:\n+ if \"diff_url\" in attributes and attributes[ \"diff_url\" ] is not None: # pragma no branch\n self.__diff_url = attributes[ \"diff_url\" ]\n- if \"head\" in attributes and attributes[ \"head\" ] is not None:\n+ if \"head\" in attributes and attributes[ \"head\" ] is not None: # pragma no branch\n self.__head = attributes[ \"head\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"issue_url\" in attributes and attributes[ \"issue_url\" ] is not None:\n+ if \"issue_url\" in attributes and attributes[ \"issue_url\" ] is not None: # pragma no branch\n self.__issue_url = attributes[ \"issue_url\" ]\n- if \"mergeable\" in attributes and attributes[ \"mergeable\" ] is not None:\n+ if \"mergeable\" in attributes and attributes[ \"mergeable\" ] is not None: # pragma no branch\n self.__mergeable = attributes[ \"mergeable\" ]\n- if \"merged\" in attributes and attributes[ \"merged\" ] is not None:\n+ if \"merged\" in attributes and attributes[ \"merged\" ] is not None: # pragma no branch\n self.__merged = attributes[ \"merged\" ]\n- if \"merged_at\" in attributes and attributes[ \"merged_at\" ] is not None:\n+ if \"merged_at\" in attributes and attributes[ \"merged_at\" ] is not None: # pragma no branch\n self.__merged_at = attributes[ \"merged_at\" ]\n- if \"merged_by\" in attributes and attributes[ \"merged_by\" ] is not None:\n+ if \"merged_by\" in attributes and attributes[ \"merged_by\" ] is not None: # pragma no branch\n self.__merged_by = attributes[ \"merged_by\" ]\n- if \"number\" in attributes and attributes[ \"number\" ] is not None:\n+ if \"number\" in attributes and attributes[ \"number\" ] is not None: # pragma no branch\n self.__number = attributes[ \"number\" ]\n- if \"patch_url\" in attributes and attributes[ \"patch_url\" ] is not None:\n+ if \"patch_url\" in attributes and attributes[ \"patch_url\" ] is not None: # pragma no branch\n self.__patch_url = attributes[ \"patch_url\" ]\n- if \"review_comments\" in attributes and attributes[ \"review_comments\" ] is not None:\n+ if \"review_comments\" in attributes and attributes[ \"review_comments\" ] is not None: # pragma no branch\n self.__review_comments = attributes[ \"review_comments\" ]\n- if \"state\" in attributes and attributes[ \"state\" ] is not None:\n+ if \"state\" in attributes and attributes[ \"state\" ] is not None: # pragma no branch\n self.__state = attributes[ \"state\" ]\n- if \"title\" in attributes and attributes[ \"title\" ] is not None:\n+ if \"title\" in attributes and attributes[ \"title\" ] is not None: # pragma no branch\n self.__title = attributes[ \"title\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","additions":26,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":22,"deletions":11,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/PullRequestComment.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/PullRequestComment.py","filename":"src/github/PullRequestComment.py","patch":"@@ -121,26 +121,26 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"body\", \"commit_id\", \"created_at\", \"html_url\", \"id\", \"line\", \"path\", \"position\", \"updated_at\", \"url\", \"user\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"body\" in attributes and attributes[ \"body\" ] is not None:\n+ if \"body\" in attributes and attributes[ \"body\" ] is not None: # pragma no branch\n self.__body = attributes[ \"body\" ]\n- if \"commit_id\" in attributes and attributes[ \"commit_id\" ] is not None:\n+ if \"commit_id\" in attributes and attributes[ \"commit_id\" ] is not None: # pragma no branch\n self.__commit_id = attributes[ \"commit_id\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n self.__created_at = attributes[ \"created_at\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"line\" in attributes and attributes[ \"line\" ] is not None:\n+ if \"line\" in attributes and attributes[ \"line\" ] is not None: # pragma no branch\n self.__line = attributes[ \"line\" ]\n- if \"path\" in attributes and attributes[ \"path\" ] is not None:\n+ if \"path\" in attributes and attributes[ \"path\" ] is not None: # pragma no branch\n self.__path = attributes[ \"path\" ]\n- if \"position\" in attributes and attributes[ \"position\" ] is not None:\n+ if \"position\" in attributes and attributes[ \"position\" ] is not None: # pragma no branch\n self.__position = attributes[ \"position\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]\n- if \"user\" in attributes and attributes[ \"user\" ] is not None:\n+ if \"user\" in attributes and attributes[ \"user\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"user\" ], dict )\n self.__user = NamedUser.NamedUser( self.__requester, attributes[ \"user\" ], completion = LazyCompletion )","additions":11,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":18,"deletions":9,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/PullRequestFile.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/PullRequestFile.py","filename":"src/github/PullRequestFile.py","patch":"@@ -62,21 +62,21 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"additions\", \"blob_url\", \"changes\", \"deletions\", \"filename\", \"patch\", \"raw_url\", \"sha\", \"status\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"additions\" in attributes and attributes[ \"additions\" ] is not None:\n+ if \"additions\" in attributes and attributes[ \"additions\" ] is not None: # pragma no branch\n self.__additions = attributes[ \"additions\" ]\n- if \"blob_url\" in attributes and attributes[ \"blob_url\" ] is not None:\n+ if \"blob_url\" in attributes and attributes[ \"blob_url\" ] is not None: # pragma no branch\n self.__blob_url = attributes[ \"blob_url\" ]\n- if \"changes\" in attributes and attributes[ \"changes\" ] is not None:\n+ if \"changes\" in attributes and attributes[ \"changes\" ] is not None: # pragma no branch\n self.__changes = attributes[ \"changes\" ]\n- if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None:\n+ if \"deletions\" in attributes and attributes[ \"deletions\" ] is not None: # pragma no branch\n self.__deletions = attributes[ \"deletions\" ]\n- if \"filename\" in attributes and attributes[ \"filename\" ] is not None:\n+ if \"filename\" in attributes and attributes[ \"filename\" ] is not None: # pragma no branch\n self.__filename = attributes[ \"filename\" ]\n- if \"patch\" in attributes and attributes[ \"patch\" ] is not None:\n+ if \"patch\" in attributes and attributes[ \"patch\" ] is not None: # pragma no branch\n self.__patch = attributes[ \"patch\" ]\n- if \"raw_url\" in attributes and attributes[ \"raw_url\" ] is not None:\n+ if \"raw_url\" in attributes and attributes[ \"raw_url\" ] is not None: # pragma no branch\n self.__raw_url = attributes[ \"raw_url\" ]\n- if \"sha\" in attributes and attributes[ \"sha\" ] is not None:\n+ if \"sha\" in attributes and attributes[ \"sha\" ] is not None: # pragma no branch\n self.__sha = attributes[ \"sha\" ]\n- if \"status\" in attributes and attributes[ \"status\" ] is not None:\n+ if \"status\" in attributes and attributes[ \"status\" ] is not None: # pragma no branch\n self.__status = attributes[ \"status\" ]","additions":9,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":62,"deletions":31,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Repository.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Repository.py","filename":"src/github/Repository.py","patch":"@@ -905,96 +905,96 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n 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\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"clone_url\" in attributes and attributes[ \"clone_url\" ] is not None:\n+ if \"clone_url\" in attributes and attributes[ \"clone_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"clone_url\" ], ( str, unicode ) )\n self.__clone_url = attributes[ \"clone_url\" ]\n- if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None:\n+ if \"created_at\" in attributes and attributes[ \"created_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"created_at\" ], ( str, unicode ) )\n self.__created_at = attributes[ \"created_at\" ]\n- if \"description\" in attributes and attributes[ \"description\" ] is not None:\n+ if \"description\" in attributes and attributes[ \"description\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"description\" ], ( str, unicode ) )\n self.__description = attributes[ \"description\" ]\n- if \"fork\" in attributes and attributes[ \"fork\" ] is not None:\n+ if \"fork\" in attributes and attributes[ \"fork\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"fork\" ], bool )\n self.__fork = attributes[ \"fork\" ]\n- if \"forks\" in attributes and attributes[ \"forks\" ] is not None:\n+ if \"forks\" in attributes and attributes[ \"forks\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"forks\" ], int )\n self.__forks = attributes[ \"forks\" ]\n- if \"full_name\" in attributes and attributes[ \"full_name\" ] is not None:\n+ if \"full_name\" in attributes and attributes[ \"full_name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"full_name\" ], ( str, unicode ) )\n self.__full_name = attributes[ \"full_name\" ]\n- if \"git_url\" in attributes and attributes[ \"git_url\" ] is not None:\n+ if \"git_url\" in attributes and attributes[ \"git_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"git_url\" ], ( str, unicode ) )\n self.__git_url = attributes[ \"git_url\" ]\n- if \"has_downloads\" in attributes and attributes[ \"has_downloads\" ] is not None:\n+ if \"has_downloads\" in attributes and attributes[ \"has_downloads\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"has_downloads\" ], bool )\n self.__has_downloads = attributes[ \"has_downloads\" ]\n- if \"has_issues\" in attributes and attributes[ \"has_issues\" ] is not None:\n+ if \"has_issues\" in attributes and attributes[ \"has_issues\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"has_issues\" ], bool )\n self.__has_issues = attributes[ \"has_issues\" ]\n- if \"has_wiki\" in attributes and attributes[ \"has_wiki\" ] is not None:\n+ if \"has_wiki\" in attributes and attributes[ \"has_wiki\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"has_wiki\" ], bool )\n self.__has_wiki = attributes[ \"has_wiki\" ]\n- if \"homepage\" in attributes and attributes[ \"homepage\" ] is not None:\n+ if \"homepage\" in attributes and attributes[ \"homepage\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"homepage\" ], ( str, unicode ) )\n self.__homepage = attributes[ \"homepage\" ]\n- if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None:\n+ if \"html_url\" in attributes and attributes[ \"html_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"html_url\" ], ( str, unicode ) )\n self.__html_url = attributes[ \"html_url\" ]\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"id\" ], int )\n self.__id = attributes[ \"id\" ]\n- if \"language\" in attributes and attributes[ \"language\" ] is not None:\n+ if \"language\" in attributes and attributes[ \"language\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"language\" ], ( str, unicode ) )\n self.__language = attributes[ \"language\" ]\n- if \"master_branch\" in attributes and attributes[ \"master_branch\" ] is not None:\n+ if \"master_branch\" in attributes and attributes[ \"master_branch\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"master_branch\" ], ( str, unicode ) )\n self.__master_branch = attributes[ \"master_branch\" ]\n- if \"mirror_url\" in attributes and attributes[ \"mirror_url\" ] is not None:\n+ if \"mirror_url\" in attributes and attributes[ \"mirror_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"mirror_url\" ], ( str, unicode ) )\n self.__mirror_url = attributes[ \"mirror_url\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]\n- if \"open_issues\" in attributes and attributes[ \"open_issues\" ] is not None:\n+ if \"open_issues\" in attributes and attributes[ \"open_issues\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"open_issues\" ], int )\n self.__open_issues = attributes[ \"open_issues\" ]\n- if \"organization\" in attributes and attributes[ \"organization\" ] is not None:\n+ if \"organization\" in attributes and attributes[ \"organization\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"organization\" ], dict )\n self.__organization = Organization.Organization( self.__requester, attributes[ \"organization\" ], completion = LazyCompletion )\n- if \"owner\" in attributes and attributes[ \"owner\" ] is not None:\n+ if \"owner\" in attributes and attributes[ \"owner\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"owner\" ], dict )\n self.__owner = NamedUser.NamedUser( self.__requester, attributes[ \"owner\" ], completion = LazyCompletion )\n- if \"parent\" in attributes and attributes[ \"parent\" ] is not None:\n+ if \"parent\" in attributes and attributes[ \"parent\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"parent\" ], dict )\n self.__parent = Repository( self.__requester, attributes[ \"parent\" ], completion = LazyCompletion )\n- if \"permissions\" in attributes and attributes[ \"permissions\" ] is not None:\n+ if \"permissions\" in attributes and attributes[ \"permissions\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"permissions\" ], dict )\n self.__permissions = Permissions.Permissions( self.__requester, attributes[ \"permissions\" ], completion = LazyCompletion )\n- if \"private\" in attributes and attributes[ \"private\" ] is not None:\n+ if \"private\" in attributes and attributes[ \"private\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"private\" ], bool )\n self.__private = attributes[ \"private\" ]\n- if \"pushed_at\" in attributes and attributes[ \"pushed_at\" ] is not None:\n+ if \"pushed_at\" in attributes and attributes[ \"pushed_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"pushed_at\" ], ( str, unicode ) )\n self.__pushed_at = attributes[ \"pushed_at\" ]\n- if \"size\" in attributes and attributes[ \"size\" ] is not None:\n+ if \"size\" in attributes and attributes[ \"size\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"size\" ], int )\n self.__size = attributes[ \"size\" ]\n- if \"source\" in attributes and attributes[ \"source\" ] is not None:\n+ if \"source\" in attributes and attributes[ \"source\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"source\" ], dict )\n self.__source = Repository( self.__requester, attributes[ \"source\" ], completion = LazyCompletion )\n- if \"ssh_url\" in attributes and attributes[ \"ssh_url\" ] is not None:\n+ if \"ssh_url\" in attributes and attributes[ \"ssh_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"ssh_url\" ], ( str, unicode ) )\n self.__ssh_url = attributes[ \"ssh_url\" ]\n- if \"svn_url\" in attributes and attributes[ \"svn_url\" ] is not None:\n+ if \"svn_url\" in attributes and attributes[ \"svn_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"svn_url\" ], ( str, unicode ) )\n self.__svn_url = attributes[ \"svn_url\" ]\n- if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None:\n+ if \"updated_at\" in attributes and attributes[ \"updated_at\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"updated_at\" ], ( str, unicode ) )\n self.__updated_at = attributes[ \"updated_at\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"url\" ], ( str, unicode ) )\n self.__url = attributes[ \"url\" ]\n- if \"watchers\" in attributes and attributes[ \"watchers\" ] is not None:\n+ if \"watchers\" in attributes and attributes[ \"watchers\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"watchers\" ], int )\n self.__watchers = attributes[ \"watchers\" ]","additions":31,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":10,"deletions":5,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/RepositoryKey.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/RepositoryKey.py","filename":"src/github/RepositoryKey.py","patch":"@@ -87,14 +87,14 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"id\", \"key\", \"title\", \"url\", \"verified\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"key\" in attributes and attributes[ \"key\" ] is not None:\n+ if \"key\" in attributes and attributes[ \"key\" ] is not None: # pragma no branch\n self.__key = attributes[ \"key\" ]\n- if \"title\" in attributes and attributes[ \"title\" ] is not None:\n+ if \"title\" in attributes and attributes[ \"title\" ] is not None: # pragma no branch\n self.__title = attributes[ \"title\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]\n- if \"verified\" in attributes and attributes[ \"verified\" ] is not None:\n+ if \"verified\" in attributes and attributes[ \"verified\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"verified\" ], bool )\n self.__verified = attributes[ \"verified\" ]","additions":5,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":8,"deletions":4,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Tag.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Tag.py","filename":"src/github/Tag.py","patch":"@@ -38,15 +38,15 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"commit\", \"name\", \"tarball_url\", \"zipball_url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"commit\" in attributes and attributes[ \"commit\" ] is not None:\n+ if \"commit\" in attributes and attributes[ \"commit\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"commit\" ], dict )\n self.__commit = Commit.Commit( self.__requester, attributes[ \"commit\" ], completion = LazyCompletion )\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"name\" ], ( str, unicode ) )\n self.__name = attributes[ \"name\" ]\n- if \"tarball_url\" in attributes and attributes[ \"tarball_url\" ] is not None:\n+ if \"tarball_url\" in attributes and attributes[ \"tarball_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"tarball_url\" ], ( str, unicode ) )\n self.__tarball_url = attributes[ \"tarball_url\" ]\n- if \"zipball_url\" in attributes and attributes[ \"zipball_url\" ] is not None:\n+ if \"zipball_url\" in attributes and attributes[ \"zipball_url\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"zipball_url\" ], ( str, unicode ) )\n self.__zipball_url = attributes[ \"zipball_url\" ]","additions":4,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":12,"deletions":6,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Team.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/Team.py","filename":"src/github/Team.py","patch":"@@ -172,15 +172,15 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"id\", \"members_count\", \"name\", \"permission\", \"repos_count\", \"url\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"members_count\" in attributes and attributes[ \"members_count\" ] is not None:\n+ if \"members_count\" in attributes and attributes[ \"members_count\" ] is not None: # pragma no branch\n self.__members_count = attributes[ \"members_count\" ]\n- if \"name\" in attributes and attributes[ \"name\" ] is not None:\n+ if \"name\" in attributes and attributes[ \"name\" ] is not None: # pragma no branch\n self.__name = attributes[ \"name\" ]\n- if \"permission\" in attributes and attributes[ \"permission\" ] is not None:\n+ if \"permission\" in attributes and attributes[ \"permission\" ] is not None: # pragma no branch\n self.__permission = attributes[ \"permission\" ]\n- if \"repos_count\" in attributes and attributes[ \"repos_count\" ] is not None:\n+ if \"repos_count\" in attributes and attributes[ \"repos_count\" ] is not None: # pragma no branch\n self.__repos_count = attributes[ \"repos_count\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]","additions":6,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":10,"deletions":5,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/UserKey.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/src/github/UserKey.py","filename":"src/github/UserKey.py","patch":"@@ -87,14 +87,14 @@ def __useAttributes( self, attributes ):\n for attribute in attributes:\n assert attribute in [ \"id\", \"key\", \"title\", \"url\", \"verified\", ], attribute\n # @toto No need to check if attribute is in attributes when attribute is mandatory\n- if \"id\" in attributes and attributes[ \"id\" ] is not None:\n+ if \"id\" in attributes and attributes[ \"id\" ] is not None: # pragma no branch\n self.__id = attributes[ \"id\" ]\n- if \"key\" in attributes and attributes[ \"key\" ] is not None:\n+ if \"key\" in attributes and attributes[ \"key\" ] is not None: # pragma no branch\n self.__key = attributes[ \"key\" ]\n- if \"title\" in attributes and attributes[ \"title\" ] is not None:\n+ if \"title\" in attributes and attributes[ \"title\" ] is not None: # pragma no branch\n self.__title = attributes[ \"title\" ]\n- if \"url\" in attributes and attributes[ \"url\" ] is not None:\n+ if \"url\" in attributes and attributes[ \"url\" ] is not None: # pragma no branch\n self.__url = attributes[ \"url\" ]\n- if \"verified\" in attributes and attributes[ \"verified\" ] is not None:\n+ if \"verified\" in attributes and attributes[ \"verified\" ] is not None: # pragma no branch\n assert isinstance( attributes[ \"verified\" ], bool )\n self.__verified = attributes[ \"verified\" ]","additions":5,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":26,"deletions":1,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/Issue.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/Issue.py","filename":"test/Issue.py","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","additions":25,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":14,"deletions":7,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/IssueEvent.py","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/IssueEvent.py","filename":"test/IssueEvent.py","patch":"@@ -3,13 +3,13 @@\n class IssueEvent( Framework.TestCase ):\r\n def setUp( self ):\r\n Framework.TestCase.setUp( self )\r\n- self.event = self.g.get_user().get_repo( \"PyGithub\" ).get_issues_event( 15819975 )\r\n+ self.event = self.g.get_user().get_repo( \"PyGithub\" ).get_issues_event( 16348656 )\r\n \r\n def testAttributes( self ):\r\n self.assertEqual( self.event.actor.login, \"jacquev6\" )\r\n- self.assertEqual( self.event.commit_id, None )\r\n- self.assertEqual( self.event.created_at, \"2012-05-19T10:38:23Z\" )\r\n- self.assertEqual( self.event.event, \"subscribed\" )\r\n- self.assertEqual( self.event.id, 15819975 )\r\n- self.assertEqual( self.event.issue.number, 28 )\r\n- self.assertEqual( self.event.url, \"https://api.github.com/repos/jacquev6/PyGithub/issues/events/15819975\" )\r\n+ self.assertEqual( self.event.commit_id, \"ed866fc43833802ab553e5ff8581c81bb00dd433\" )\r\n+ self.assertEqual( self.event.created_at, \"2012-05-27T07:29:25Z\" )\r\n+ self.assertEqual( self.event.event, \"referenced\" )\r\n+ self.assertEqual( self.event.id, 16348656 )\r\n+ self.assertEqual( self.event.issue.number, 30 )\r\n+ self.assertEqual( self.event.url, \"https://api.github.com/repos/jacquev6/PyGithub/issues/events/16348656\" )\r","additions":7,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"added","changes":45,"deletions":0,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testAddAndRemoveLabels.txt","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testAddAndRemoveLabels.txt","filename":"test/ReplayData/Issue.testAddAndRemoveLabels.txt","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+","additions":45,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"added","changes":35,"deletions":0,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testDeleteAndSetLabels.txt","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testDeleteAndSetLabels.txt","filename":"test/ReplayData/Issue.testDeleteAndSetLabels.txt","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+","additions":35,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"added","changes":5,"deletions":0,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testGetLabels.txt","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/Issue.testGetLabels.txt","filename":"test/ReplayData/Issue.testGetLabels.txt","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+","additions":5,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},{"status":"modified","changes":14,"deletions":7,"raw_url":"https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/IssueEvent.setUp.txt","blob_url":"https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/test/ReplayData/IssueEvent.setUp.txt","filename":"test/ReplayData/IssueEvent.setUp.txt","patch":"@@ -1,15 +1,15 @@\n GET /user {'Authorization': 'Basic login_and_password_removed'} null\n 200\n-[('status', '200 OK'), ('x-ratelimit-remaining', '4907'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"99c9bfb75395b749e9913a4729126fb5\"'), ('date', 'Sun, 27 May 2012 07:19:30 GMT'), ('content-type', 'application/json; charset=utf-8')]\n-{\"private_gists\":5,\"type\":\"User\",\"company\":\"Criteo\",\"location\":\"Paris, France\",\"hireable\":false,\"gravatar_id\":\"b68de5ae38616c296fa345d2b9df2225\",\"bio\":\"\",\"following\":24,\"blog\":\"http://vincent-jacques.net\",\"avatar_url\":\"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png\",\"total_private_repos\":5,\"followers\":13,\"owned_private_repos\":5,\"disk_usage\":16976,\"collaborators\":0,\"html_url\":\"https://github.com/jacquev6\",\"url\":\"https://api.github.com/users/jacquev6\",\"name\":\"Vincent Jacques\",\"login\":\"jacquev6\",\"public_repos\":11,\"public_gists\":3,\"email\":\"vincent@vincent-jacques.net\",\"id\":327146,\"plan\":{\"private_repos\":5,\"collaborators\":1,\"name\":\"micro\",\"space\":614400},\"created_at\":\"2010-07-09T06:10:06Z\"}\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4996'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"8974bb1628a3e3a6d3eb3b08c1b5a46b\"'), ('date', 'Sun, 27 May 2012 07:32:54 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+{\"type\":\"User\",\"bio\":\"\",\"disk_usage\":16976,\"total_private_repos\":5,\"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\",\"owned_private_repos\":5,\"collaborators\":0,\"plan\":{\"collaborators\":1,\"private_repos\":5,\"name\":\"micro\",\"space\":614400},\"company\":\"Criteo\",\"gravatar_id\":\"b68de5ae38616c296fa345d2b9df2225\",\"login\":\"jacquev6\",\"email\":\"vincent@vincent-jacques.net\",\"public_gists\":3,\"followers\":13,\"name\":\"Vincent Jacques\",\"created_at\":\"2010-07-09T06:10:06Z\",\"blog\":\"http://vincent-jacques.net\",\"location\":\"Paris, France\",\"hireable\":false,\"id\":327146,\"private_gists\":5,\"public_repos\":11,\"following\":24,\"html_url\":\"https://github.com/jacquev6\"}\n \n GET /repos/jacquev6/PyGithub {'Authorization': 'Basic login_and_password_removed'} null\n 200\n-[('status', '200 OK'), ('x-ratelimit-remaining', '4906'), ('content-length', '1129'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"4c20acf0b23f75bbf25106b1a04f65a5\"'), ('date', 'Sun, 27 May 2012 07:19:31 GMT'), ('content-type', 'application/json; charset=utf-8')]\n-{\"description\":\"Python library implementing the full Github API v3\",\"full_name\":\"jacquev6/PyGithub\",\"has_wiki\":false,\"has_issues\":true,\"updated_at\":\"2012-05-27T06:55:28Z\",\"forks\":3,\"mirror_url\":null,\"homepage\":\"http://vincent-jacques.net/PyGithub\",\"ssh_url\":\"git@github.com:jacquev6/PyGithub.git\",\"open_issues\":16,\"fork\":false,\"svn_url\":\"https://github.com/jacquev6/PyGithub\",\"pushed_at\":\"2012-05-27T06:00:28Z\",\"size\":308,\"html_url\":\"https://github.com/jacquev6/PyGithub\",\"private\":false,\"url\":\"https://api.github.com/repos/jacquev6/PyGithub\",\"clone_url\":\"https://github.com/jacquev6/PyGithub.git\",\"owner\":{\"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},\"name\":\"PyGithub\",\"has_downloads\":true,\"language\":\"Python\",\"watchers\":15,\"git_url\":\"git://github.com/jacquev6/PyGithub.git\",\"id\":3544490,\"permissions\":{\"admin\":true,\"pull\":true,\"push\":true},\"created_at\":\"2012-02-25T12:53:47Z\"}\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4995'), ('content-length', '1129'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"f1e4eb3993a364b66b68ec9db42405bd\"'), ('date', 'Sun, 27 May 2012 07:32:55 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+{\"clone_url\":\"https://github.com/jacquev6/PyGithub.git\",\"has_downloads\":true,\"watchers\":15,\"updated_at\":\"2012-05-27T07:29:24Z\",\"permissions\":{\"pull\":true,\"admin\":true,\"push\":true},\"homepage\":\"http://vincent-jacques.net/PyGithub\",\"url\":\"https://api.github.com/repos/jacquev6/PyGithub\",\"mirror_url\":null,\"has_wiki\":false,\"has_issues\":true,\"fork\":false,\"forks\":3,\"git_url\":\"git://github.com/jacquev6/PyGithub.git\",\"size\":308,\"private\":false,\"open_issues\":16,\"svn_url\":\"https://github.com/jacquev6/PyGithub\",\"owner\":{\"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},\"name\":\"PyGithub\",\"language\":\"Python\",\"description\":\"Python library implementing the full Github API v3\",\"ssh_url\":\"git@github.com:jacquev6/PyGithub.git\",\"pushed_at\":\"2012-05-27T07:29:24Z\",\"created_at\":\"2012-02-25T12:53:47Z\",\"id\":3544490,\"html_url\":\"https://github.com/jacquev6/PyGithub\",\"full_name\":\"jacquev6/PyGithub\"}\n \n-GET /repos/jacquev6/PyGithub/issues/events/15819975 {'Authorization': 'Basic login_and_password_removed'} null\n+GET /repos/jacquev6/PyGithub/issues/events/16348656 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} null\n 200\n-[('status', '200 OK'), ('x-ratelimit-remaining', '4905'), ('content-length', '2430'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"a3d244842d23f92f69a23e21626fad11\"'), ('date', 'Sun, 27 May 2012 07:19:31 GMT'), ('content-type', 'application/json; charset=utf-8')]\n-{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/issues/events/15819975\",\"issue\":{\"updated_at\":\"2012-05-26T14:59:33Z\",\"body\":\"Body edited by PyGithub\",\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/issues/28\",\"comments\":0,\"milestone\":{\"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/1\",\"number\":1,\"title\":\"Version 0.4\",\"due_on\":\"2012-03-13T07:00:00Z\",\"closed_issues\":3,\"open_issues\":0,\"created_at\":\"2012-03-08T12:22:10Z\",\"state\":\"closed\",\"description\":\"\",\"id\":93546},\"number\":28,\"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\":\"2012-05-26T14:59:33Z\",\"title\":\"Issue created by PyGithub\",\"labels\":[{\"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\"}],\"created_at\":\"2012-05-19T10:38:23Z\",\"state\":\"closed\",\"user\":{\"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},\"id\":4653757,\"pull_request\":{\"diff_url\":null,\"patch_url\":null,\"html_url\":null},\"html_url\":\"https://github.com/jacquev6/PyGithub/issues/28\"},\"commit_id\":null,\"created_at\":\"2012-05-19T10:38:23Z\",\"event\":\"subscribed\",\"id\":15819975,\"actor\":{\"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}}\n+[('status', '200 OK'), ('x-ratelimit-remaining', '4994'), ('content-length', '1384'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '\"fefecab09e7355d4ef9875677c2631da\"'), ('date', 'Sun, 27 May 2012 07:32:56 GMT'), ('content-type', 'application/json; charset=utf-8')]\n+{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/issues/events/16348656\",\"issue\":{\"updated_at\":\"2012-05-27T07:27:51Z\",\"body\":\"Body created by PyGithub\",\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/issues/30\",\"comments\":0,\"milestone\":null,\"number\":30,\"assignee\":null,\"closed_at\":null,\"title\":\"Issue also created by PyGithub\",\"labels\":[{\"url\":\"https://api.github.com/repos/jacquev6/PyGithub/labels/Question\",\"name\":\"Question\",\"color\":\"02e10c\"}],\"created_at\":\"2012-05-27T05:40:15Z\",\"state\":\"open\",\"user\":{\"url\":\"https://api.github.com/users/jacquev6\",\"gravatar_id\":\"b68de5ae38616c296fa345d2b9df2225\",\"login\":\"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\"},\"id\":4769659,\"pull_request\":{\"patch_url\":null,\"diff_url\":null,\"html_url\":null},\"html_url\":\"https://github.com/jacquev6/PyGithub/issues/30\"},\"commit_id\":\"ed866fc43833802ab553e5ff8581c81bb00dd433\",\"created_at\":\"2012-05-27T07:29:25Z\",\"event\":\"referenced\",\"id\":16348656,\"actor\":{\"url\":\"https://api.github.com/users/jacquev6\",\"gravatar_id\":\"b68de5ae38616c296fa345d2b9df2225\",\"login\":\"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\"}}\n ","additions":7,"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"}] diff --git a/test/ReplayData/RateLimiting.testRateLimiting.txt b/github/tests/ReplayData/RateLimiting.testRateLimiting.txt similarity index 100% rename from test/ReplayData/RateLimiting.testRateLimiting.txt rename to github/tests/ReplayData/RateLimiting.testRateLimiting.txt diff --git a/test/ReplayData/Repository.setUp.txt b/github/tests/ReplayData/Repository.setUp.txt similarity index 100% rename from test/ReplayData/Repository.setUp.txt rename to github/tests/ReplayData/Repository.setUp.txt diff --git a/test/ReplayData/Repository.testAssignees.txt b/github/tests/ReplayData/Repository.testAssignees.txt similarity index 100% rename from test/ReplayData/Repository.testAssignees.txt rename to github/tests/ReplayData/Repository.testAssignees.txt diff --git a/test/ReplayData/Repository.testCollaborators.txt b/github/tests/ReplayData/Repository.testCollaborators.txt similarity index 100% rename from test/ReplayData/Repository.testCollaborators.txt rename to github/tests/ReplayData/Repository.testCollaborators.txt diff --git a/test/ReplayData/Repository.testCompare.txt b/github/tests/ReplayData/Repository.testCompare.txt similarity index 100% rename from test/ReplayData/Repository.testCompare.txt rename to github/tests/ReplayData/Repository.testCompare.txt diff --git a/test/ReplayData/Repository.testCreateDownloadWithAllArguments.txt b/github/tests/ReplayData/Repository.testCreateDownloadWithAllArguments.txt similarity index 88% rename from test/ReplayData/Repository.testCreateDownloadWithAllArguments.txt rename to github/tests/ReplayData/Repository.testCreateDownloadWithAllArguments.txt index 38d224a9..7f529416 100644 --- a/test/ReplayData/Repository.testCreateDownloadWithAllArguments.txt +++ b/github/tests/ReplayData/Repository.testCreateDownloadWithAllArguments.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/downloads {'Authorization': 'Basic login_and_password_removed'} {"description": "Download created by PyGithub", "name": "Foobar.txt", "content_type": "text/richtext", "size": 1024} +https POST api.github.com None /repos/jacquev6/PyGithub/downloads {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"description": "Download created by PyGithub", "name": "Foobar.txt", "content_type": "text/richtext", "size": 1024} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4957'), ('content-length', '1172'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"dec219bef9e193a28a08c8f5643c0ac3"'), ('date', 'Tue, 22 May 2012 19:11:49 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/downloads/242556')] {"description":"Download created by PyGithub","acl":"public-read","accesskeyid":"1DWESVTPGHQVTX38V182","bucket":"github","content_type":"text/richtext","x-amz-meta-content-disposition":"attachment; filename=Foobar.txt","redirect":false,"expirationdate":"2112-05-22T19:11:49.000Z","policy":"ewogICAgJ2V4cGlyYXRpb24nOiAnMjExMi0wNS0yMlQxOToxMTo0OS4wMDBaJywKICAgICdjb25kaXRpb25zJzogWwogICAgICAgIHsnYnVja2V0JzogJ2dpdGh1Yid9LAogICAgICAgIHsna2V5JzogJ2Rvd25sb2Fkcy9qYWNxdWV2Ni9QeUdpdGh1Yi9Gb29iYXIudHh0J30sCiAgICAgICAgeydhY2wnOiAncHVibGljLXJlYWQnfSwKICAgICAgICB7J3N1Y2Nlc3NfYWN0aW9uX3N0YXR1cyc6ICcyMDEnfSwKICAgICAgICBbJ3N0YXJ0cy13aXRoJywgJyRGaWxlbmFtZScsICcnXSwKICAgICAgICBbJ3N0YXJ0cy13aXRoJywgJyRDb250ZW50LVR5cGUnLCAnJ10KICAgIF0KfQ==","s3_url":"https://github.s3.amazonaws.com/","html_url":"https://github.com/downloads/jacquev6/PyGithub/Foobar.txt","mime_type":"text/richtext","size":1024,"url":"https://api.github.com/repos/jacquev6/PyGithub/downloads/242556","download_count":0,"name":"Foobar.txt","prefix":"downloads/jacquev6/PyGithub","path":"downloads/jacquev6/PyGithub/Foobar.txt","id":242556,"signature":"8FCU/4rgT3ohXfE9N6HO7JgbuK4=","created_at":"2012-05-22T19:11:49Z"} diff --git a/test/ReplayData/Repository.testCreateDownloadWithMinimalArguments.txt b/github/tests/ReplayData/Repository.testCreateDownloadWithMinimalArguments.txt similarity index 92% rename from test/ReplayData/Repository.testCreateDownloadWithMinimalArguments.txt rename to github/tests/ReplayData/Repository.testCreateDownloadWithMinimalArguments.txt index 981cfc45..e981fc8a 100644 --- a/test/ReplayData/Repository.testCreateDownloadWithMinimalArguments.txt +++ b/github/tests/ReplayData/Repository.testCreateDownloadWithMinimalArguments.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/downloads {'Authorization': 'Basic login_and_password_removed'} {"name": "Foobar.txt", "size": 1024} +https POST api.github.com None /repos/jacquev6/PyGithub/downloads {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"name": "Foobar.txt", "size": 1024} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4954'), ('content-length', '1140'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"14a91323a46cfdfd53dfacffa96ab6a0"'), ('date', 'Tue, 22 May 2012 19:15:29 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/downloads/242562')] {"accesskeyid":"1DWESVTPGHQVTX38V182","bucket":"github","content_type":"text/plain","download_count":0,"redirect":false,"mime_type":"text/plain","prefix":"downloads/jacquev6/PyGithub","expirationdate":"2112-05-22T19:15:29.000Z","url":"https://api.github.com/repos/jacquev6/PyGithub/downloads/242562","x-amz-meta-content-disposition":"attachment; filename=Foobar.txt","acl":"public-read","s3_url":"https://github.s3.amazonaws.com/","policy":"ewogICAgJ2V4cGlyYXRpb24nOiAnMjExMi0wNS0yMlQxOToxNToyOS4wMDBaJywKICAgICdjb25kaXRpb25zJzogWwogICAgICAgIHsnYnVja2V0JzogJ2dpdGh1Yid9LAogICAgICAgIHsna2V5JzogJ2Rvd25sb2Fkcy9qYWNxdWV2Ni9QeUdpdGh1Yi9Gb29iYXIudHh0J30sCiAgICAgICAgeydhY2wnOiAncHVibGljLXJlYWQnfSwKICAgICAgICB7J3N1Y2Nlc3NfYWN0aW9uX3N0YXR1cyc6ICcyMDEnfSwKICAgICAgICBbJ3N0YXJ0cy13aXRoJywgJyRGaWxlbmFtZScsICcnXSwKICAgICAgICBbJ3N0YXJ0cy13aXRoJywgJyRDb250ZW50LVR5cGUnLCAnJ10KICAgIF0KfQ==","size":1024,"signature":"Z2VR9HhhJdWkmhyoSZF+TT6hqIs=","name":"Foobar.txt","path":"downloads/jacquev6/PyGithub/Foobar.txt","created_at":"2012-05-22T19:15:29Z","description":null,"html_url":"https://github.com/downloads/jacquev6/PyGithub/Foobar.txt","id":242562} diff --git a/test/ReplayData/Repository.testCreateGitBlob.txt b/github/tests/ReplayData/Repository.testCreateGitBlob.txt similarity index 81% rename from test/ReplayData/Repository.testCreateGitBlob.txt rename to github/tests/ReplayData/Repository.testCreateGitBlob.txt index 16850739..1fcaf00f 100644 --- a/test/ReplayData/Repository.testCreateGitBlob.txt +++ b/github/tests/ReplayData/Repository.testCreateGitBlob.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/git/blobs {'Authorization': 'Basic login_and_password_removed'} {"content": "Blob created by PyGithub", "encoding": "latin1"} +https POST api.github.com None /repos/jacquev6/PyGithub/git/blobs {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"content": "Blob created by PyGithub", "encoding": "latin1"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4997'), ('content-length', '156'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"f5cc2fa3ba4de95ac0eb8c2ca47350c0"'), ('date', 'Fri, 11 May 2012 11:43:09 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/git/blobs/5dd930f591cd5188e9ea7200e308ad355182a1d8')] {"url":"https://api.github.com/repos/jacquev6/PyGithub/git/blobs/5dd930f591cd5188e9ea7200e308ad355182a1d8","sha":"5dd930f591cd5188e9ea7200e308ad355182a1d8"} diff --git a/test/ReplayData/Repository.testCreateGitCommit.txt b/github/tests/ReplayData/Repository.testCreateGitCommit.txt similarity index 90% rename from test/ReplayData/Repository.testCreateGitCommit.txt rename to github/tests/ReplayData/Repository.testCreateGitCommit.txt index aa483291..4afdc13d 100644 --- a/test/ReplayData/Repository.testCreateGitCommit.txt +++ b/github/tests/ReplayData/Repository.testCreateGitCommit.txt @@ -3,7 +3,7 @@ https GET api.github.com None /repos/jacquev6/PyGithub/git/trees/107139a922f33ba [('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"}]} -https POST api.github.com None /repos/jacquev6/PyGithub/git/commits {'Authorization': 'Basic login_and_password_removed'} {"parents": [], "message": "Commit created by PyGithub", "tree": "107139a922f33bab6fbeb9f9eb8787e7f19e0528"} +https POST api.github.com None /repos/jacquev6/PyGithub/git/commits {'Content-Type': 'application/json', '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')] {"author":{"email":"github.com@vincent-jacques.net","name":"Vincent Jacques","date":"2012-05-26T22:50:59-07:00"},"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/0b820628236ab8bab3890860fc414fa757ca15f4","message":"Commit created by PyGithub","committer":{"email":"github.com@vincent-jacques.net","name":"Vincent Jacques","date":"2012-05-26T22:50:59-07:00"},"sha":"0b820628236ab8bab3890860fc414fa757ca15f4","parents":[],"tree":{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/107139a922f33bab6fbeb9f9eb8787e7f19e0528","sha":"107139a922f33bab6fbeb9f9eb8787e7f19e0528"}} diff --git a/test/ReplayData/Repository.testCreateGitCommitWithAllArguments.txt b/github/tests/ReplayData/Repository.testCreateGitCommitWithAllArguments.txt similarity index 82% rename from test/ReplayData/Repository.testCreateGitCommitWithAllArguments.txt rename to github/tests/ReplayData/Repository.testCreateGitCommitWithAllArguments.txt index 226001f5..66e149ca 100644 --- a/test/ReplayData/Repository.testCreateGitCommitWithAllArguments.txt +++ b/github/tests/ReplayData/Repository.testCreateGitCommitWithAllArguments.txt @@ -3,7 +3,7 @@ https GET api.github.com None /repos/jacquev6/PyGithub/git/trees/107139a922f33ba [('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"}]} -https POST api.github.com None /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"}} +https POST api.github.com None /repos/jacquev6/PyGithub/git/commits {'Content-Type': 'application/json', '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')] {"author":{"email":"j.doe@vincent-jacques.net","name":"John Doe","date":"2008-07-08T21:13:30-07:00"},"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/526946197ae9da59c6507cacd13ad6f1cfb686ea","message":"Commit created by PyGithub","committer":{"email":"j.doe@vincent-jacques.net","name":"John Doe","date":"2008-07-08T21:13:30-07:00"},"sha":"526946197ae9da59c6507cacd13ad6f1cfb686ea","parents":[],"tree":{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/107139a922f33bab6fbeb9f9eb8787e7f19e0528","sha":"107139a922f33bab6fbeb9f9eb8787e7f19e0528"}} diff --git a/test/ReplayData/Repository.testCreateGitCommitWithParents.txt b/github/tests/ReplayData/Repository.testCreateGitCommitWithParents.txt similarity index 94% rename from test/ReplayData/Repository.testCreateGitCommitWithParents.txt rename to github/tests/ReplayData/Repository.testCreateGitCommitWithParents.txt index 626bef18..ab5f8fc6 100644 --- a/test/ReplayData/Repository.testCreateGitCommitWithParents.txt +++ b/github/tests/ReplayData/Repository.testCreateGitCommitWithParents.txt @@ -13,7 +13,7 @@ https GET api.github.com None /repos/jacquev6/PyGithub/git/trees/fae707821159639 [('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"}]} -https POST api.github.com None /repos/jacquev6/PyGithub/git/commits {'Authorization': 'Basic login_and_password_removed'} {"parents": ["7248e66831d4ffe09ef1f30a1df59ec0a9331ece", "12d427464f8d91c8e981043a86ba8a2a9e7319ea"], "message": "Commit created by PyGithub", "tree": "fae707821159639589bf94f3fb0a7154ec5d441b"} +https POST api.github.com None /repos/jacquev6/PyGithub/git/commits {'Content-Type': 'application/json', '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')] {"committer":{"email":"github.com@vincent-jacques.net","date":"2012-06-01T11:39:31-07:00","name":"Vincent Jacques"},"message":"Commit created by PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/6adf9ea25ff8a8f2a42bcb1c09e42526339037cd","sha":"6adf9ea25ff8a8f2a42bcb1c09e42526339037cd","parents":[{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/7248e66831d4ffe09ef1f30a1df59ec0a9331ece","sha":"7248e66831d4ffe09ef1f30a1df59ec0a9331ece"},{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/12d427464f8d91c8e981043a86ba8a2a9e7319ea","sha":"12d427464f8d91c8e981043a86ba8a2a9e7319ea"}],"tree":{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/fae707821159639589bf94f3fb0a7154ec5d441b","sha":"fae707821159639589bf94f3fb0a7154ec5d441b"},"author":{"email":"github.com@vincent-jacques.net","date":"2012-06-01T11:39:31-07:00","name":"Vincent Jacques"}} diff --git a/test/ReplayData/Repository.testCreateGitRef.txt b/github/tests/ReplayData/Repository.testCreateGitRef.txt similarity index 81% rename from test/ReplayData/Repository.testCreateGitRef.txt rename to github/tests/ReplayData/Repository.testCreateGitRef.txt index 7dcf0c6c..389b67d2 100644 --- a/test/ReplayData/Repository.testCreateGitRef.txt +++ b/github/tests/ReplayData/Repository.testCreateGitRef.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/git/refs {'Authorization': 'Basic login_and_password_removed'} {"sha": "4303c5b90e2216d927155e9609436ccb8984c495", "ref": "refs/heads/BranchCreatedByPyGithub"} +https POST api.github.com None /repos/jacquev6/PyGithub/git/refs {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"sha": "4303c5b90e2216d927155e9609436ccb8984c495", "ref": "refs/heads/BranchCreatedByPyGithub"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4987'), ('content-length', '322'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"0302e489fc6bd534afa44cdbec1227e7"'), ('date', 'Thu, 10 May 2012 18:49:19 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/git/refs/heads/BranchCreatedByPyGithub')] {"object":{"type":"commit","sha":"4303c5b90e2216d927155e9609436ccb8984c495","url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495"},"ref":"refs/heads/BranchCreatedByPyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub/git/refs/heads/BranchCreatedByPyGithub"} diff --git a/test/ReplayData/Repository.testCreateGitTag.txt b/github/tests/ReplayData/Repository.testCreateGitTag.txt similarity index 81% rename from test/ReplayData/Repository.testCreateGitTag.txt rename to github/tests/ReplayData/Repository.testCreateGitTag.txt index 391c81b6..33cbe891 100644 --- a/test/ReplayData/Repository.testCreateGitTag.txt +++ b/github/tests/ReplayData/Repository.testCreateGitTag.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/git/tags {'Authorization': 'Basic login_and_password_removed'} {"message": "Tag created by PyGithub", "tag": "TaggedByPyGithub", "type": "commit", "object": "0b820628236ab8bab3890860fc414fa757ca15f4"} +https POST api.github.com None /repos/jacquev6/PyGithub/git/tags {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"message": "Tag created by PyGithub", "tag": "TaggedByPyGithub", "type": "commit", "object": "0b820628236ab8bab3890860fc414fa757ca15f4"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4925'), ('content-length', '512'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"9a9c1f293329ee4c63e8cfb08772e3a1"'), ('date', 'Sun, 27 May 2012 05:56:08 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/git/tags/5ba561eaa2b7ca9015662510157b15d8f3b0232a')] {"url":"https://api.github.com/repos/jacquev6/PyGithub/git/tags/5ba561eaa2b7ca9015662510157b15d8f3b0232a","message":"Tag created by PyGithub","tag":"TaggedByPyGithub","object":{"type":"commit","url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/0b820628236ab8bab3890860fc414fa757ca15f4","sha":"0b820628236ab8bab3890860fc414fa757ca15f4"},"tagger":{"email":"github.com@vincent-jacques.net","name":"Vincent Jacques","date":"2012-05-26T22:56:07-07:00"},"sha":"5ba561eaa2b7ca9015662510157b15d8f3b0232a"} diff --git a/test/ReplayData/Repository.testCreateGitTagWithAllArguments.txt b/github/tests/ReplayData/Repository.testCreateGitTagWithAllArguments.txt similarity index 74% rename from test/ReplayData/Repository.testCreateGitTagWithAllArguments.txt rename to github/tests/ReplayData/Repository.testCreateGitTagWithAllArguments.txt index b4c2028d..a6deecf0 100644 --- a/test/ReplayData/Repository.testCreateGitTagWithAllArguments.txt +++ b/github/tests/ReplayData/Repository.testCreateGitTagWithAllArguments.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/git/tags {'Authorization': 'Basic login_and_password_removed'} {"tagger": {"date": "2008-07-09T16:13:30+12:00", "name": "John Doe", "email": "j.doe@vincent-jacques.net"}, "message": "Tag also created by PyGithub", "tag": "TaggedByPyGithub2", "type": "commit", "object": "526946197ae9da59c6507cacd13ad6f1cfb686ea"} +https POST api.github.com None /repos/jacquev6/PyGithub/git/tags {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"tagger": {"date": "2008-07-09T16:13:30+12:00", "name": "John Doe", "email": "j.doe@vincent-jacques.net"}, "message": "Tag also created by PyGithub", "tag": "TaggedByPyGithub2", "type": "commit", "object": "526946197ae9da59c6507cacd13ad6f1cfb686ea"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4922'), ('content-length', '506'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"a7e5d9e4342e323fa513f880968b80f4"'), ('date', 'Sun, 27 May 2012 05:57:03 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/git/tags/f0e99a8335fbc84c53366c4a681118468f266625')] {"url":"https://api.github.com/repos/jacquev6/PyGithub/git/tags/f0e99a8335fbc84c53366c4a681118468f266625","message":"Tag also created by PyGithub","tag":"TaggedByPyGithub2","object":{"type":"commit","url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/526946197ae9da59c6507cacd13ad6f1cfb686ea","sha":"526946197ae9da59c6507cacd13ad6f1cfb686ea"},"tagger":{"email":"j.doe@vincent-jacques.net","name":"John Doe","date":"2008-07-08T21:13:30-07:00"},"sha":"f0e99a8335fbc84c53366c4a681118468f266625"} diff --git a/test/ReplayData/Repository.testCreateGitTree.txt b/github/tests/ReplayData/Repository.testCreateGitTree.txt similarity index 81% rename from test/ReplayData/Repository.testCreateGitTree.txt rename to github/tests/ReplayData/Repository.testCreateGitTree.txt index 69c4adfe..d1febca8 100644 --- a/test/ReplayData/Repository.testCreateGitTree.txt +++ b/github/tests/ReplayData/Repository.testCreateGitTree.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/git/trees {'Authorization': 'Basic login_and_password_removed'} {"tree": [{"content": "File created by PyGithub", "path": "Foobar.txt", "type": "blob", "mode": "100644"}]} +https POST api.github.com None /repos/jacquev6/PyGithub/git/trees {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"tree": [{"content": "File created by PyGithub", "path": "Foobar.txt", "type": "blob", "mode": "100644"}]} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4937'), ('content-length', '382'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"0446b5f676814b5801ab6744ef9b59f7"'), ('date', 'Sun, 27 May 2012 05:48:14 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/git/trees/41cf8c178c636a018d537cb20daae09391efd70b')] {"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/73a1c7f17aa0ad5d7cbb5a8ca033ce47d3d23197","size":24,"path":"Foobar.txt","sha":"73a1c7f17aa0ad5d7cbb5a8ca033ce47d3d23197","mode":"100644"}]} diff --git a/test/ReplayData/Repository.testCreateGitTreeWithBaseTree.txt b/github/tests/ReplayData/Repository.testCreateGitTreeWithBaseTree.txt similarity index 88% rename from test/ReplayData/Repository.testCreateGitTreeWithBaseTree.txt rename to github/tests/ReplayData/Repository.testCreateGitTreeWithBaseTree.txt index cb0e69e4..dcc55f7d 100644 --- a/test/ReplayData/Repository.testCreateGitTreeWithBaseTree.txt +++ b/github/tests/ReplayData/Repository.testCreateGitTreeWithBaseTree.txt @@ -3,7 +3,7 @@ https GET api.github.com None /repos/jacquev6/PyGithub/git/trees/41cf8c178c636a0 [('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"}]} -https POST api.github.com None /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"} +https POST api.github.com None /repos/jacquev6/PyGithub/git/trees {'Content-Type': 'application/json', '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')] {"tree":[{"type":"blob","sha":"92be1df4e473d2541c5c166ad145a39d0324de8b","url":"https://api.github.com/repos/jacquev6/PyGithub/git/blobs/92be1df4e473d2541c5c166ad145a39d0324de8b","size":29,"path":"Barbaz.txt","mode":"100644"},{"type":"blob","sha":"73a1c7f17aa0ad5d7cbb5a8ca033ce47d3d23197","url":"https://api.github.com/repos/jacquev6/PyGithub/git/blobs/73a1c7f17aa0ad5d7cbb5a8ca033ce47d3d23197","size":24,"path":"Foobar.txt","mode":"100644"}],"sha":"107139a922f33bab6fbeb9f9eb8787e7f19e0528","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/107139a922f33bab6fbeb9f9eb8787e7f19e0528"} diff --git a/test/ReplayData/Repository.testCreateGitTreeWithSha.txt b/github/tests/ReplayData/Repository.testCreateGitTreeWithSha.txt similarity index 80% rename from test/ReplayData/Repository.testCreateGitTreeWithSha.txt rename to github/tests/ReplayData/Repository.testCreateGitTreeWithSha.txt index cb02f1ca..06583904 100644 --- a/test/ReplayData/Repository.testCreateGitTreeWithSha.txt +++ b/github/tests/ReplayData/Repository.testCreateGitTreeWithSha.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/git/trees {'Authorization': 'Basic login_and_password_removed'} {"tree": [{"path": "Barbaz.txt", "type": "blob", "mode": "100644", "sha": "5dd930f591cd5188e9ea7200e308ad355182a1d8"}]} +https POST api.github.com None /repos/jacquev6/PyGithub/git/trees {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"tree": [{"path": "Barbaz.txt", "type": "blob", "mode": "100644", "sha": "5dd930f591cd5188e9ea7200e308ad355182a1d8"}]} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4997'), ('content-length', '381'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"f33782d7031ff19c5301bb52068533cf"'), ('date', 'Fri, 01 Jun 2012 17:51:04 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/git/trees/fae707821159639589bf94f3fb0a7154ec5d441b')] {"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"}]} diff --git a/test/ReplayData/Repository.testCreateHookWithAllParameters.txt b/github/tests/ReplayData/Repository.testCreateHookWithAllParameters.txt similarity index 80% rename from test/ReplayData/Repository.testCreateHookWithAllParameters.txt rename to github/tests/ReplayData/Repository.testCreateHookWithAllParameters.txt index 55de5ad5..cf44a174 100644 --- a/test/ReplayData/Repository.testCreateHookWithAllParameters.txt +++ b/github/tests/ReplayData/Repository.testCreateHookWithAllParameters.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/hooks {'Authorization': 'Basic login_and_password_removed'} {"active": false, "config": {"url": "http://foobar.com"}, "name": "web", "events": ["fork"]} +https POST api.github.com None /repos/jacquev6/PyGithub/hooks {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"active": false, "config": {"url": "http://foobar.com"}, "name": "web", "events": ["fork"]} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4997'), ('content-length', '298'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"c3b371e4de1a0ec350b3fcc0c458e0f9"'), ('date', 'Sat, 19 May 2012 06:01:45 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/hooks/257993')] {"updated_at":"2012-05-19T06:01:45Z","last_response":{"status":"unused","message":null,"code":null},"events":["fork"],"url":"https://api.github.com/repos/jacquev6/PyGithub/hooks/257993","active":true,"name":"web","config":{"url":"http://foobar.com"},"id":257993,"created_at":"2012-05-19T06:01:45Z"} diff --git a/test/ReplayData/Repository.testCreateHookWithMinimalParameters.txt b/github/tests/ReplayData/Repository.testCreateHookWithMinimalParameters.txt similarity index 84% rename from test/ReplayData/Repository.testCreateHookWithMinimalParameters.txt rename to github/tests/ReplayData/Repository.testCreateHookWithMinimalParameters.txt index c3c57001..31b9a132 100644 --- a/test/ReplayData/Repository.testCreateHookWithMinimalParameters.txt +++ b/github/tests/ReplayData/Repository.testCreateHookWithMinimalParameters.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/hooks {'Authorization': 'Basic login_and_password_removed'} {"config": {"url": "http://foobar.com"}, "name": "web"} +https POST api.github.com None /repos/jacquev6/PyGithub/hooks {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"config": {"url": "http://foobar.com"}, "name": "web"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4994'), ('content-length', '298'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"276d18854081948260c44cf645c54bd0"'), ('date', 'Sat, 19 May 2012 05:03:14 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/hooks/257967')] {"updated_at":"2012-05-19T05:03:14Z","url":"https://api.github.com/repos/jacquev6/PyGithub/hooks/257967","config":{"url":"http://foobar.com"},"last_response":{"status":"unused","message":null,"code":null},"active":true,"events":["push"],"name":"web","created_at":"2012-05-19T05:03:14Z","id":257967} diff --git a/test/ReplayData/Repository.testCreateIssue.txt b/github/tests/ReplayData/Repository.testCreateIssue.txt similarity index 90% rename from test/ReplayData/Repository.testCreateIssue.txt rename to github/tests/ReplayData/Repository.testCreateIssue.txt index 7cc9214c..1812b9e4 100644 --- a/test/ReplayData/Repository.testCreateIssue.txt +++ b/github/tests/ReplayData/Repository.testCreateIssue.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/issues {'Authorization': 'Basic login_and_password_removed'} {"title": "Issue created by PyGithub"} +https POST api.github.com None /repos/jacquev6/PyGithub/issues {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"title": "Issue created by PyGithub"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4935'), ('content-length', '748'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"26e2222fe8411843d3fd2b024d50c567"'), ('date', 'Sat, 19 May 2012 10:38:24 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/issues/28')] {"closed_by":null,"state":"open","user":{"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},"title":"Issue created by PyGithub","comments":0,"updated_at":"2012-05-19T10:38:23Z","pull_request":{"diff_url":null,"patch_url":null,"html_url":null},"closed_at":null,"body":null,"number":28,"milestone":null,"url":"https://api.github.com/repos/jacquev6/PyGithub/issues/28","assignee":null,"labels":[],"id":4653757,"html_url":"https://github.com/jacquev6/PyGithub/issues/28","created_at":"2012-05-19T10:38:23Z"} diff --git a/test/ReplayData/Repository.testCreateIssueWithAllArguments.txt b/github/tests/ReplayData/Repository.testCreateIssueWithAllArguments.txt similarity index 96% rename from test/ReplayData/Repository.testCreateIssueWithAllArguments.txt rename to github/tests/ReplayData/Repository.testCreateIssueWithAllArguments.txt index 79542403..4ea467c1 100644 --- a/test/ReplayData/Repository.testCreateIssueWithAllArguments.txt +++ b/github/tests/ReplayData/Repository.testCreateIssueWithAllArguments.txt @@ -13,7 +13,7 @@ https GET api.github.com None /repos/jacquev6/PyGithub/labels/Question {'Authori [('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"} -https POST api.github.com None /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"} +https POST api.github.com None /repos/jacquev6/PyGithub/issues {'Content-Type': 'application/json', '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')] {"updated_at":"2012-05-27T05:40:15Z","body":"Body created by PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub/issues/30","comments":0,"milestone":{"creator":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"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/milestones/2","number":2,"title":"Version 1.0: coherent public interface","due_on":"2012-06-04T07:00:00Z","open_issues":10,"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,"closed_issues":2},"number":30,"closed_by":null,"assignee":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"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"},"closed_at":null,"title":"Issue also created by PyGithub","labels":[{"url":"https://api.github.com/repos/jacquev6/PyGithub/labels/Question","name":"Question","color":"02e10c"}],"created_at":"2012-05-27T05:40:15Z","state":"open","user":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"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"},"id":4769659,"pull_request":{"patch_url":null,"diff_url":null,"html_url":null},"html_url":"https://github.com/jacquev6/PyGithub/issues/30"} diff --git a/test/ReplayData/Repository.testCreateKey.txt b/github/tests/ReplayData/Repository.testCreateKey.txt similarity index 59% rename from test/ReplayData/Repository.testCreateKey.txt rename to github/tests/ReplayData/Repository.testCreateKey.txt index bb612d89..460f12bb 100644 --- a/test/ReplayData/Repository.testCreateKey.txt +++ b/github/tests/ReplayData/Repository.testCreateKey.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/keys {'Authorization': 'Basic login_and_password_removed'} {"key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Mm0RjTNAYFfSCtUpO54usdseroUSIYg5KX4JoseTpqyiB/hqewjYLAdUq/tNIQzrkoEJWSyZrQt0ma7/YCyMYuNGd3DU6q6ZAyBeY3E9RyCiKjO3aTL2VKQGFvBVVmGdxGVSCITRphAcsKc/PF35/fg9XP9S0anMXcEFtdfMHz41SSw+XtE+Vc+6cX9FuI5qUfLGbkv8L1v3g4uw9VXlzq4GfTA+1S7D6mcoGHopAIXFlVr+2RfDKdSURMcB22z41fljO1MW4+zUS/4FyUTpL991es5fcwKXYoiE+x06VJeJJ1Krwx+DZj45uweV6cHXt2JwJEI9fWB6WyBlDejWw== vincent@IDEE", "title": "Key added through PyGithub"} +https POST api.github.com None /repos/jacquev6/PyGithub/keys {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Mm0RjTNAYFfSCtUpO54usdseroUSIYg5KX4JoseTpqyiB/hqewjYLAdUq/tNIQzrkoEJWSyZrQt0ma7/YCyMYuNGd3DU6q6ZAyBeY3E9RyCiKjO3aTL2VKQGFvBVVmGdxGVSCITRphAcsKc/PF35/fg9XP9S0anMXcEFtdfMHz41SSw+XtE+Vc+6cX9FuI5qUfLGbkv8L1v3g4uw9VXlzq4GfTA+1S7D6mcoGHopAIXFlVr+2RfDKdSURMcB22z41fljO1MW4+zUS/4FyUTpL991es5fcwKXYoiE+x06VJeJJ1Krwx+DZj45uweV6cHXt2JwJEI9fWB6WyBlDejWw== vincent@IDEE", "title": "Key added through PyGithub"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4955'), ('content-length', '505'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"0eb643b648f2ef29f38c2bcbce872e09"'), ('date', 'Sat, 26 May 2012 20:28:37 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/user/keys/2626761')] {"url":"https://api.github.com/user/keys/2626761","key":"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Mm0RjTNAYFfSCtUpO54usdseroUSIYg5KX4JoseTpqyiB/hqewjYLAdUq/tNIQzrkoEJWSyZrQt0ma7/YCyMYuNGd3DU6q6ZAyBeY3E9RyCiKjO3aTL2VKQGFvBVVmGdxGVSCITRphAcsKc/PF35/fg9XP9S0anMXcEFtdfMHz41SSw+XtE+Vc+6cX9FuI5qUfLGbkv8L1v3g4uw9VXlzq4GfTA+1S7D6mcoGHopAIXFlVr+2RfDKdSURMcB22z41fljO1MW4+zUS/4FyUTpL991es5fcwKXYoiE+x06VJeJJ1Krwx+DZj45uweV6cHXt2JwJEI9fWB6WyBlDejWw==","verified":true,"title":"Key added through PyGithub","id":2626761} diff --git a/test/ReplayData/Repository.testCreateLabel.txt b/github/tests/ReplayData/Repository.testCreateLabel.txt similarity index 80% rename from test/ReplayData/Repository.testCreateLabel.txt rename to github/tests/ReplayData/Repository.testCreateLabel.txt index a0b0d76a..20b80f6a 100644 --- a/test/ReplayData/Repository.testCreateLabel.txt +++ b/github/tests/ReplayData/Repository.testCreateLabel.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/labels {'Authorization': 'Basic login_and_password_removed'} {"color": "00ff00", "name": "Label with silly name % * + created by PyGithub"} +https POST api.github.com None /repos/jacquev6/PyGithub/labels {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"color": "00ff00", "name": "Label with silly name % * + created by PyGithub"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4969'), ('content-length', '191'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"92b623552b1bac3f019d03c920305acd"'), ('date', 'Sat, 19 May 2012 10:17:36 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/labels/Label+with+silly+name+%25+%2A+%2B+created+by+PyGithub')] {"url":"https://api.github.com/repos/jacquev6/PyGithub/labels/Label+with+silly+name+%25+%2A+%2B+created+by+PyGithub","name":"Label with silly name % * + created by PyGithub","color":"00ff00"} diff --git a/test/ReplayData/Repository.testCreateMilestone.txt b/github/tests/ReplayData/Repository.testCreateMilestone.txt similarity index 82% rename from test/ReplayData/Repository.testCreateMilestone.txt rename to github/tests/ReplayData/Repository.testCreateMilestone.txt index 373adef1..ac505a49 100644 --- a/test/ReplayData/Repository.testCreateMilestone.txt +++ b/github/tests/ReplayData/Repository.testCreateMilestone.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/milestones {'Authorization': 'Basic login_and_password_removed'} {"due_on": "2012-06-15", "state": "open", "description": "Description created by PyGithub", "title": "Milestone created by PyGithub"} +https POST api.github.com None /repos/jacquev6/PyGithub/milestones {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"due_on": "2012-06-15", "state": "open", "description": "Description created by PyGithub", "title": "Milestone created by PyGithub"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4958'), ('content-length', '604'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"bb5eb08c923020c102396cd0c9bfdbc5"'), ('date', 'Sat, 19 May 2012 10:24:13 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/milestones/5')] {"closed_issues":0,"url":"https://api.github.com/repos/jacquev6/PyGithub/milestones/5","due_on":"2012-06-15T07:00:00Z","creator":{"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","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146},"number":5,"open_issues":0,"title":"Milestone created by PyGithub","created_at":"2012-05-19T10:24:13Z","state":"open","description":"Description created by PyGithub","id":121463} diff --git a/test/ReplayData/Repository.testCreateMilestoneWithMinimalArguments.txt b/github/tests/ReplayData/Repository.testCreateMilestoneWithMinimalArguments.txt similarity index 87% rename from test/ReplayData/Repository.testCreateMilestoneWithMinimalArguments.txt rename to github/tests/ReplayData/Repository.testCreateMilestoneWithMinimalArguments.txt index 5271d8be..14d4007b 100644 --- a/test/ReplayData/Repository.testCreateMilestoneWithMinimalArguments.txt +++ b/github/tests/ReplayData/Repository.testCreateMilestoneWithMinimalArguments.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/milestones {'Authorization': 'Basic login_and_password_removed'} {"title": "Milestone also created by PyGithub"} +https POST api.github.com None /repos/jacquev6/PyGithub/milestones {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"title": "Milestone also created by PyGithub"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4940'), ('content-length', '562'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"575796ba6077c16fdc79f4d38885aa5f"'), ('date', 'Sun, 27 May 2012 05:41:34 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/milestones/6')] {"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},"closed_issues":0,"url":"https://api.github.com/repos/jacquev6/PyGithub/milestones/6","number":6,"title":"Milestone also created by PyGithub","due_on":null,"open_issues":0,"created_at":"2012-05-27T05:41:34Z","state":"open","description":null,"id":124480} diff --git a/test/ReplayData/Repository.testCreatePull.txt b/github/tests/ReplayData/Repository.testCreatePull.txt similarity index 95% rename from test/ReplayData/Repository.testCreatePull.txt rename to github/tests/ReplayData/Repository.testCreatePull.txt index 37f37b1e..00375304 100644 --- a/test/ReplayData/Repository.testCreatePull.txt +++ b/github/tests/ReplayData/Repository.testCreatePull.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/pulls {'Authorization': 'Basic login_and_password_removed'} {"body": "Body of the pull request", "head": "BeaverSoftware:master", "base": "topic/RewriteWithGeneratedCode", "title": "Pull request created by PyGithub"} +https POST api.github.com None /repos/jacquev6/PyGithub/pulls {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"body": "Body of the pull request", "head": "BeaverSoftware:master", "base": "topic/RewriteWithGeneratedCode", "title": "Pull request created by PyGithub"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4963'), ('content-length', '4486'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"1e069be7c3e3eb8b12afb1e1f5343dc9"'), ('date', 'Sun, 27 May 2012 09:25:37 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/pulls/31')] {"merged":false,"patch_url":"https://github.com/jacquev6/PyGithub/pull/31.patch","mergeable":null,"head":{"ref":"master","label":"BeaverSoftware:master","repo":{"clone_url":"https://github.com/BeaverSoftware/PyGithub.git","has_downloads":true,"watchers":1,"updated_at":"2012-05-27T09:09:17Z","homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/BeaverSoftware/PyGithub","mirror_url":null,"has_wiki":false,"has_issues":false,"fork":true,"forks":0,"size":176,"private":false,"open_issues":0,"svn_url":"https://github.com/BeaverSoftware/PyGithub","owner":{"url":"https://api.github.com/users/BeaverSoftware","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","login":"BeaverSoftware","id":1424031,"avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png"},"name":"PyGithub","language":"Python","description":"Python library implementing the full Github API v3","ssh_url":"git@github.com:BeaverSoftware/PyGithub.git","pushed_at":"2012-05-27T09:09:17Z","created_at":"2012-05-27T08:50:04Z","id":4460787,"git_url":"git://github.com/BeaverSoftware/PyGithub.git","html_url":"https://github.com/BeaverSoftware/PyGithub","full_name":"BeaverSoftware/PyGithub"},"user":{"url":"https://api.github.com/users/BeaverSoftware","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","login":"BeaverSoftware","id":1424031,"avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png"},"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},"updated_at":"2012-05-27T09:25:36Z","issue_url":"https://github.com/jacquev6/PyGithub/issues/31","body":"Body of the pull request","url":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31","comments":0,"base":{"ref":"topic/RewriteWithGeneratedCode","label":"jacquev6:topic/RewriteWithGeneratedCode","repo":{"clone_url":"https://github.com/jacquev6/PyGithub.git","has_downloads":true,"watchers":15,"updated_at":"2012-05-27T08:50:04Z","homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","mirror_url":null,"has_wiki":false,"has_issues":true,"fork":false,"forks":3,"size":308,"private":false,"open_issues":16,"svn_url":"https://github.com/jacquev6/PyGithub","owner":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"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"},"name":"PyGithub","language":"Python","description":"Python library implementing the full Github API v3","ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-27T07:29:24Z","created_at":"2012-02-25T12:53:47Z","id":3544490,"git_url":"git://github.com/jacquev6/PyGithub.git","html_url":"https://github.com/jacquev6/PyGithub","full_name":"jacquev6/PyGithub"},"user":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"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"},"sha":"ed866fc43833802ab553e5ff8581c81bb00dd433"},"number":31,"merged_by":null,"closed_at":null,"title":"Pull request created by PyGithub","deletions":384,"merged_at":null,"diff_url":"https://github.com/jacquev6/PyGithub/pull/31.diff","additions":511,"_links":{"self":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31"},"comments":{"href":"https://api.github.com/repos/jacquev6/PyGithub/issues/31/comments"},"issue":{"href":"https://api.github.com/repos/jacquev6/PyGithub/issues/31"},"html":{"href":"https://github.com/jacquev6/PyGithub/pull/31"},"review_comments":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31/comments"}},"created_at":"2012-05-27T09:25:36Z","user":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"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"},"state":"open","id":1436215,"review_comments":0,"commits":3,"changed_files":45,"html_url":"https://github.com/jacquev6/PyGithub/pull/31"} diff --git a/test/ReplayData/Repository.testCreatePullFromIssue.txt b/github/tests/ReplayData/Repository.testCreatePullFromIssue.txt similarity index 97% rename from test/ReplayData/Repository.testCreatePullFromIssue.txt rename to github/tests/ReplayData/Repository.testCreatePullFromIssue.txt index 9f242aee..8bcad9e9 100644 --- a/test/ReplayData/Repository.testCreatePullFromIssue.txt +++ b/github/tests/ReplayData/Repository.testCreatePullFromIssue.txt @@ -3,7 +3,7 @@ https GET api.github.com None /repos/jacquev6/PyGithub/issues/32 {'Authorization [('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}} -https POST api.github.com None /repos/jacquev6/PyGithub/pulls {'Authorization': 'Basic login_and_password_removed'} {"head": "BeaverSoftware:master", "base": "topic/RewriteWithGeneratedCode", "issue": 32} +https POST api.github.com None /repos/jacquev6/PyGithub/pulls {'Content-Type': 'application/json', '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')] {"merged":false,"patch_url":"https://github.com/jacquev6/PyGithub/pull/32.patch","mergeable":null,"head":{"ref":"master","label":"BeaverSoftware:master","repo":{"clone_url":"https://github.com/BeaverSoftware/PyGithub.git","has_downloads":true,"watchers":1,"updated_at":"2012-05-27T10:58:08Z","homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/BeaverSoftware/PyGithub","mirror_url":null,"has_wiki":false,"has_issues":false,"fork":true,"forks":0,"size":176,"private":false,"open_issues":0,"svn_url":"https://github.com/BeaverSoftware/PyGithub","owner":{"url":"https://api.github.com/users/BeaverSoftware","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","login":"BeaverSoftware","id":1424031,"avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png"},"name":"PyGithub","language":"Python","description":"Python library implementing the full Github API v3","ssh_url":"git@github.com:BeaverSoftware/PyGithub.git","pushed_at":"2012-05-27T10:58:08Z","created_at":"2012-05-27T08:50:04Z","id":4460787,"git_url":"git://github.com/BeaverSoftware/PyGithub.git","html_url":"https://github.com/BeaverSoftware/PyGithub","full_name":"BeaverSoftware/PyGithub"},"user":{"url":"https://api.github.com/users/BeaverSoftware","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","login":"BeaverSoftware","id":1424031,"avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png"},"sha":"aff8a573a19f0a42380e1c0cbbc63b6dc719f38e"},"updated_at":"2012-05-27T10:58:41Z","issue_url":"https://github.com/jacquev6/PyGithub/issues/32","body":"","url":"https://api.github.com/repos/jacquev6/PyGithub/pulls/32","comments":0,"base":{"ref":"topic/RewriteWithGeneratedCode","label":"jacquev6:topic/RewriteWithGeneratedCode","repo":{"clone_url":"https://github.com/jacquev6/PyGithub.git","has_downloads":true,"watchers":15,"updated_at":"2012-05-27T10:54:09Z","homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","mirror_url":null,"has_wiki":false,"has_issues":true,"fork":false,"forks":3,"size":188,"private":false,"open_issues":17,"svn_url":"https://github.com/jacquev6/PyGithub","owner":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"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"},"name":"PyGithub","language":"Python","description":"Python library implementing the full Github API v3","ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-27T10:54:09Z","created_at":"2012-02-25T12:53:47Z","id":3544490,"git_url":"git://github.com/jacquev6/PyGithub.git","html_url":"https://github.com/jacquev6/PyGithub","full_name":"jacquev6/PyGithub"},"user":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"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"},"sha":"7ec473e793c0b63092d938707632639a41fd4369"},"number":32,"merged_by":null,"closed_at":null,"title":"Creation of a pull request from an issue is not covered by integration tests","deletions":0,"merged_at":null,"diff_url":"https://github.com/jacquev6/PyGithub/pull/32.diff","additions":0,"_links":{"self":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/32"},"comments":{"href":"https://api.github.com/repos/jacquev6/PyGithub/issues/32/comments"},"issue":{"href":"https://api.github.com/repos/jacquev6/PyGithub/issues/32"},"html":{"href":"https://github.com/jacquev6/PyGithub/pull/32"},"review_comments":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/32/comments"}},"created_at":"2012-05-27T10:58:41Z","user":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"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"},"state":"open","id":1436310,"review_comments":0,"commits":1,"changed_files":0,"html_url":"https://github.com/jacquev6/PyGithub/pull/32"} diff --git a/test/ReplayData/Repository.testDelete.txt b/github/tests/ReplayData/Repository.testDelete.txt similarity index 100% rename from test/ReplayData/Repository.testDelete.txt rename to github/tests/ReplayData/Repository.testDelete.txt diff --git a/test/ReplayData/Repository.testEditWithAllArguments.txt b/github/tests/ReplayData/Repository.testEditWithAllArguments.txt similarity index 83% rename from test/ReplayData/Repository.testEditWithAllArguments.txt rename to github/tests/ReplayData/Repository.testEditWithAllArguments.txt index 9c0d0862..509906c3 100644 --- a/test/ReplayData/Repository.testEditWithAllArguments.txt +++ b/github/tests/ReplayData/Repository.testEditWithAllArguments.txt @@ -1,9 +1,9 @@ -https PATCH api.github.com None /repos/jacquev6/PyGithub {'Authorization': 'Basic login_and_password_removed'} {"has_wiki": false, "name": "PyGithub", "has_downloads": true, "has_issues": true, "homepage": "http://vincent-jacques.net/PyGithub", "public": true, "description": "Description edited by PyGithub"} +https PATCH api.github.com None /repos/jacquev6/PyGithub {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"has_wiki": false, "name": "PyGithub", "has_downloads": true, "has_issues": true, "homepage": "http://vincent-jacques.net/PyGithub", "public": true, "description": "Description edited by PyGithub"} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4953'), ('content-length', '1109'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"749313ec2d171323deb61f9f4c85e84f"'), ('date', 'Sat, 26 May 2012 11:22:13 GMT'), ('content-type', 'application/json; charset=utf-8')] {"clone_url":"https://github.com/jacquev6/PyGithub.git","has_downloads":true,"watchers":13,"updated_at":"2012-05-26T11:22:13Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","has_wiki":false,"has_issues":true,"fork":false,"forks":2,"size":412,"git_url":"git://github.com/jacquev6/PyGithub.git","private":false,"open_issues":16,"mirror_url":null,"svn_url":"https://github.com/jacquev6/PyGithub","owner":{"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},"name":"PyGithub","language":"Python","description":"Description edited by PyGithub","ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-26T10:01:38Z","created_at":"2012-02-25T12:53:47Z","id":3544490,"html_url":"https://github.com/jacquev6/PyGithub","full_name":"jacquev6/PyGithub"} -https PATCH api.github.com None /repos/jacquev6/PyGithub {'Authorization': 'Basic login_and_password_removed'} {"name": "PyGithub", "description": "Python library implementing the full Github API v3"} +https PATCH api.github.com None /repos/jacquev6/PyGithub {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"name": "PyGithub", "description": "Python library implementing the full Github API v3"} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4952'), ('content-length', '1129'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"c1328d95af7d85267acb5754968b2c0b"'), ('date', 'Sat, 26 May 2012 11:22:13 GMT'), ('content-type', 'application/json; charset=utf-8')] {"clone_url":"https://github.com/jacquev6/PyGithub.git","has_downloads":true,"watchers":13,"updated_at":"2012-05-26T11:22:13Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","mirror_url":null,"has_wiki":false,"has_issues":true,"fork":false,"forks":2,"size":412,"private":false,"open_issues":16,"svn_url":"https://github.com/jacquev6/PyGithub","owner":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"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"},"name":"PyGithub","language":"Python","description":"Python library implementing the full Github API v3","ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-26T10:01:38Z","created_at":"2012-02-25T12:53:47Z","id":3544490,"git_url":"git://github.com/jacquev6/PyGithub.git","html_url":"https://github.com/jacquev6/PyGithub","full_name":"jacquev6/PyGithub"} diff --git a/github/tests/ReplayData/Repository.testEditWithDefaultBranch.txt b/github/tests/ReplayData/Repository.testEditWithDefaultBranch.txt new file mode 100644 index 00000000..81524825 --- /dev/null +++ b/github/tests/ReplayData/Repository.testEditWithDefaultBranch.txt @@ -0,0 +1,5 @@ +https PATCH api.github.com None /repos/jacquev6/PyGithub {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"default_branch": "master", "name": "PyGithub"} +200 +[('status', '200 OK'), ('content-length', '1264'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-remaining', '4971'), ('server', 'nginx'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"4493662efd70c37f486a910d29ef99c1"'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Sat, 03 Nov 2012 08:41:07 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"master_branch":"master","watchers":97,"pushed_at":"2012-11-03T08:25:58Z","watchers_count":97,"forks":27,"svn_url":"https://github.com/jacquev6/PyGithub","description":"Python library implementing the full Github API v3","owner":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","login":"jacquev6","id":327146},"open_issues":11,"open_issues_count":11,"url":"https://api.github.com/repos/jacquev6/PyGithub","updated_at":"2012-11-03T08:41:07Z","permissions":{"push":true,"pull":true,"admin":true},"default_branch":"master","html_url":"https://github.com/jacquev6/PyGithub","clone_url":"https://github.com/jacquev6/PyGithub.git","language":"Python","has_downloads":true,"ssh_url":"git@github.com:jacquev6/PyGithub.git","size":256,"mirror_url":null,"fork":false,"full_name":"jacquev6/PyGithub","forks_count":27,"name":"PyGithub","created_at":"2012-02-25T12:53:47Z","git_url":"git://github.com/jacquev6/PyGithub.git","homepage":"http://vincent-jacques.net/PyGithub","has_issues":true,"private":false,"id":3544490,"network_count":27,"has_wiki":true} + diff --git a/test/ReplayData/Repository.testEditWithoutArguments.txt b/github/tests/ReplayData/Repository.testEditWithoutArguments.txt similarity index 89% rename from test/ReplayData/Repository.testEditWithoutArguments.txt rename to github/tests/ReplayData/Repository.testEditWithoutArguments.txt index 2c5a36db..6387b110 100644 --- a/test/ReplayData/Repository.testEditWithoutArguments.txt +++ b/github/tests/ReplayData/Repository.testEditWithoutArguments.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /repos/jacquev6/PyGithub {'Authorization': 'Basic login_and_password_removed'} {"name": "PyGithub"} +https PATCH api.github.com None /repos/jacquev6/PyGithub {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"name": "PyGithub"} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4956'), ('content-length', '1129'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"97977b426859a02f4d2a3fa4764b1a8e"'), ('date', 'Sat, 26 May 2012 11:21:43 GMT'), ('content-type', 'application/json; charset=utf-8')] {"description":"Python library implementing the full Github API v3","full_name":"jacquev6/PyGithub","has_wiki":false,"has_issues":true,"updated_at":"2012-05-26T10:01:38Z","forks":2,"mirror_url":null,"homepage":"http://vincent-jacques.net/PyGithub","ssh_url":"git@github.com:jacquev6/PyGithub.git","open_issues":16,"fork":false,"svn_url":"https://github.com/jacquev6/PyGithub","pushed_at":"2012-05-26T10:01:38Z","size":412,"html_url":"https://github.com/jacquev6/PyGithub","private":false,"url":"https://api.github.com/repos/jacquev6/PyGithub","clone_url":"https://github.com/jacquev6/PyGithub.git","owner":{"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},"name":"PyGithub","has_downloads":true,"language":"Python","watchers":13,"git_url":"git://github.com/jacquev6/PyGithub.git","id":3544490,"permissions":{"admin":true,"pull":true,"push":true},"created_at":"2012-02-25T12:53:47Z"} diff --git a/test/ReplayData/Repository.testGetArchiveLink.txt b/github/tests/ReplayData/Repository.testGetArchiveLink.txt similarity index 100% rename from test/ReplayData/Repository.testGetArchiveLink.txt rename to github/tests/ReplayData/Repository.testGetArchiveLink.txt diff --git a/test/ReplayData/Repository.testGetBranch.txt b/github/tests/ReplayData/Repository.testGetBranch.txt similarity index 100% rename from test/ReplayData/Repository.testGetBranch.txt rename to github/tests/ReplayData/Repository.testGetBranch.txt diff --git a/test/ReplayData/Repository.testGetComments.txt b/github/tests/ReplayData/Repository.testGetComments.txt similarity index 100% rename from test/ReplayData/Repository.testGetComments.txt rename to github/tests/ReplayData/Repository.testGetComments.txt diff --git a/test/ReplayData/Repository.testGetCommits.txt b/github/tests/ReplayData/Repository.testGetCommits.txt similarity index 100% rename from test/ReplayData/Repository.testGetCommits.txt rename to github/tests/ReplayData/Repository.testGetCommits.txt diff --git a/test/ReplayData/Repository.testGetCommitsWithArguments.txt b/github/tests/ReplayData/Repository.testGetCommitsWithArguments.txt similarity index 100% rename from test/ReplayData/Repository.testGetCommitsWithArguments.txt rename to github/tests/ReplayData/Repository.testGetCommitsWithArguments.txt diff --git a/test/ReplayData/Repository.testGetContents.txt b/github/tests/ReplayData/Repository.testGetContents.txt similarity index 100% rename from test/ReplayData/Repository.testGetContents.txt rename to github/tests/ReplayData/Repository.testGetContents.txt diff --git a/test/ReplayData/Repository.testGetContributors.txt b/github/tests/ReplayData/Repository.testGetContributors.txt similarity index 100% rename from test/ReplayData/Repository.testGetContributors.txt rename to github/tests/ReplayData/Repository.testGetContributors.txt diff --git a/test/ReplayData/Repository.testGetDownloads.txt b/github/tests/ReplayData/Repository.testGetDownloads.txt similarity index 100% rename from test/ReplayData/Repository.testGetDownloads.txt rename to github/tests/ReplayData/Repository.testGetDownloads.txt diff --git a/test/ReplayData/Repository.testGetEvents.txt b/github/tests/ReplayData/Repository.testGetEvents.txt similarity index 100% rename from test/ReplayData/Repository.testGetEvents.txt rename to github/tests/ReplayData/Repository.testGetEvents.txt diff --git a/test/ReplayData/Repository.testGetForks.txt b/github/tests/ReplayData/Repository.testGetForks.txt similarity index 100% rename from test/ReplayData/Repository.testGetForks.txt rename to github/tests/ReplayData/Repository.testGetForks.txt diff --git a/github/tests/ReplayData/Repository.testGetGitRef.txt b/github/tests/ReplayData/Repository.testGetGitRef.txt new file mode 100644 index 00000000..ffa15201 --- /dev/null +++ b/github/tests/ReplayData/Repository.testGetGitRef.txt @@ -0,0 +1,5 @@ +https GET api.github.com None /repos/jacquev6/PyGithub/git/refs/heads/master {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4987'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-limit', '5000'), ('vary', 'Accept, Authorization, Cookie'), ('content-length', '288'), ('server', 'nginx'), ('last-modified', 'Sun, 28 Oct 2012 01:48:38 GMT'), ('connection', 'keep-alive'), ('etag', '"d7478b9ae7e3c0de496ede43edd2fdfc"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Sun, 28 Oct 2012 08:58:25 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/refs/heads/master","object":{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/31110327ec45f3138e58ed247b2cf420fee481ec","type":"commit","sha":"31110327ec45f3138e58ed247b2cf420fee481ec"},"ref":"refs/heads/master"} + diff --git a/github/tests/ReplayData/Repository.testGetGitRefWithIssue102Reverted.txt b/github/tests/ReplayData/Repository.testGetGitRefWithIssue102Reverted.txt new file mode 100644 index 00000000..ffa15201 --- /dev/null +++ b/github/tests/ReplayData/Repository.testGetGitRefWithIssue102Reverted.txt @@ -0,0 +1,5 @@ +https GET api.github.com None /repos/jacquev6/PyGithub/git/refs/heads/master {'Authorization': 'Basic login_and_password_removed'} null +200 +[('status', '200 OK'), ('x-ratelimit-remaining', '4987'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-limit', '5000'), ('vary', 'Accept, Authorization, Cookie'), ('content-length', '288'), ('server', 'nginx'), ('last-modified', 'Sun, 28 Oct 2012 01:48:38 GMT'), ('connection', 'keep-alive'), ('etag', '"d7478b9ae7e3c0de496ede43edd2fdfc"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Sun, 28 Oct 2012 08:58:25 GMT'), ('content-type', 'application/json; charset=utf-8')] +{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/refs/heads/master","object":{"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/31110327ec45f3138e58ed247b2cf420fee481ec","type":"commit","sha":"31110327ec45f3138e58ed247b2cf420fee481ec"},"ref":"refs/heads/master"} + diff --git a/test/ReplayData/Repository.testGetGitRefs.txt b/github/tests/ReplayData/Repository.testGetGitRefs.txt similarity index 100% rename from test/ReplayData/Repository.testGetGitRefs.txt rename to github/tests/ReplayData/Repository.testGetGitRefs.txt diff --git a/test/ReplayData/Repository.testGetGitTreeWithRecursive.txt b/github/tests/ReplayData/Repository.testGetGitTreeWithRecursive.txt similarity index 100% rename from test/ReplayData/Repository.testGetGitTreeWithRecursive.txt rename to github/tests/ReplayData/Repository.testGetGitTreeWithRecursive.txt diff --git a/test/ReplayData/Repository.testGetHooks.txt b/github/tests/ReplayData/Repository.testGetHooks.txt similarity index 100% rename from test/ReplayData/Repository.testGetHooks.txt rename to github/tests/ReplayData/Repository.testGetHooks.txt diff --git a/test/ReplayData/Repository.testGetIssues.txt b/github/tests/ReplayData/Repository.testGetIssues.txt similarity index 100% rename from test/ReplayData/Repository.testGetIssues.txt rename to github/tests/ReplayData/Repository.testGetIssues.txt diff --git a/test/ReplayData/Repository.testGetIssuesEvents.txt b/github/tests/ReplayData/Repository.testGetIssuesEvents.txt similarity index 100% rename from test/ReplayData/Repository.testGetIssuesEvents.txt rename to github/tests/ReplayData/Repository.testGetIssuesEvents.txt diff --git a/test/ReplayData/Repository.testGetIssuesWithArguments.txt b/github/tests/ReplayData/Repository.testGetIssuesWithArguments.txt similarity index 100% rename from test/ReplayData/Repository.testGetIssuesWithArguments.txt rename to github/tests/ReplayData/Repository.testGetIssuesWithArguments.txt diff --git a/test/ReplayData/Repository.testGetIssuesWithWildcards.txt b/github/tests/ReplayData/Repository.testGetIssuesWithWildcards.txt similarity index 100% rename from test/ReplayData/Repository.testGetIssuesWithWildcards.txt rename to github/tests/ReplayData/Repository.testGetIssuesWithWildcards.txt diff --git a/test/ReplayData/Repository.testGetKeys.txt b/github/tests/ReplayData/Repository.testGetKeys.txt similarity index 100% rename from test/ReplayData/Repository.testGetKeys.txt rename to github/tests/ReplayData/Repository.testGetKeys.txt diff --git a/test/ReplayData/Repository.testGetLabel.txt b/github/tests/ReplayData/Repository.testGetLabel.txt similarity index 100% rename from test/ReplayData/Repository.testGetLabel.txt rename to github/tests/ReplayData/Repository.testGetLabel.txt diff --git a/test/ReplayData/Repository.testGetLabels.txt b/github/tests/ReplayData/Repository.testGetLabels.txt similarity index 100% rename from test/ReplayData/Repository.testGetLabels.txt rename to github/tests/ReplayData/Repository.testGetLabels.txt diff --git a/test/ReplayData/Repository.testGetLanguages.txt b/github/tests/ReplayData/Repository.testGetLanguages.txt similarity index 100% rename from test/ReplayData/Repository.testGetLanguages.txt rename to github/tests/ReplayData/Repository.testGetLanguages.txt diff --git a/test/ReplayData/Repository.testGetMilestones.txt b/github/tests/ReplayData/Repository.testGetMilestones.txt similarity index 100% rename from test/ReplayData/Repository.testGetMilestones.txt rename to github/tests/ReplayData/Repository.testGetMilestones.txt diff --git a/test/ReplayData/Repository.testGetMilestonesWithArguments.txt b/github/tests/ReplayData/Repository.testGetMilestonesWithArguments.txt similarity index 100% rename from test/ReplayData/Repository.testGetMilestonesWithArguments.txt rename to github/tests/ReplayData/Repository.testGetMilestonesWithArguments.txt diff --git a/test/ReplayData/Repository.testGetNetworkEvents.txt b/github/tests/ReplayData/Repository.testGetNetworkEvents.txt similarity index 100% rename from test/ReplayData/Repository.testGetNetworkEvents.txt rename to github/tests/ReplayData/Repository.testGetNetworkEvents.txt diff --git a/test/ReplayData/Repository.testGetPulls.txt b/github/tests/ReplayData/Repository.testGetPulls.txt similarity index 100% rename from test/ReplayData/Repository.testGetPulls.txt rename to github/tests/ReplayData/Repository.testGetPulls.txt diff --git a/test/ReplayData/Repository.testGetPullsWithArguments.txt b/github/tests/ReplayData/Repository.testGetPullsWithArguments.txt similarity index 100% rename from test/ReplayData/Repository.testGetPullsWithArguments.txt rename to github/tests/ReplayData/Repository.testGetPullsWithArguments.txt diff --git a/test/ReplayData/Repository.testGetStargazers.txt b/github/tests/ReplayData/Repository.testGetStargazers.txt similarity index 100% rename from test/ReplayData/Repository.testGetStargazers.txt rename to github/tests/ReplayData/Repository.testGetStargazers.txt diff --git a/test/ReplayData/Repository.testGetSubscribers.txt b/github/tests/ReplayData/Repository.testGetSubscribers.txt similarity index 100% rename from test/ReplayData/Repository.testGetSubscribers.txt rename to github/tests/ReplayData/Repository.testGetSubscribers.txt diff --git a/test/ReplayData/Repository.testGetTeams.txt b/github/tests/ReplayData/Repository.testGetTeams.txt similarity index 100% rename from test/ReplayData/Repository.testGetTeams.txt rename to github/tests/ReplayData/Repository.testGetTeams.txt diff --git a/test/ReplayData/Repository.testGetWatchers.txt b/github/tests/ReplayData/Repository.testGetWatchers.txt similarity index 100% rename from test/ReplayData/Repository.testGetWatchers.txt rename to github/tests/ReplayData/Repository.testGetWatchers.txt diff --git a/test/ReplayData/Repository.testLegacySearchIssues.txt b/github/tests/ReplayData/Repository.testLegacySearchIssues.txt similarity index 100% rename from test/ReplayData/Repository.testLegacySearchIssues.txt rename to github/tests/ReplayData/Repository.testLegacySearchIssues.txt diff --git a/test/ReplayData/Repository.testMergeWithConflict.txt b/github/tests/ReplayData/Repository.testMergeWithConflict.txt similarity index 77% rename from test/ReplayData/Repository.testMergeWithConflict.txt rename to github/tests/ReplayData/Repository.testMergeWithConflict.txt index 8ae52174..b4515e25 100644 --- a/test/ReplayData/Repository.testMergeWithConflict.txt +++ b/github/tests/ReplayData/Repository.testMergeWithConflict.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/merges {'Authorization': 'Basic login_and_password_removed'} {"head": "branchForHead", "base": "branchForBase"} +https POST api.github.com None /repos/jacquev6/PyGithub/merges {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"head": "branchForHead", "base": "branchForBase"} 409 [('status', '409 Conflict'), ('content-length', '28'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-remaining', '4980'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('cache-control', ''), ('date', 'Sat, 08 Sep 2012 12:29:28 GMT'), ('content-type', 'application/json; charset=utf-8')] {"message":"Merge conflict"} diff --git a/test/ReplayData/Repository.testMergeWithMessage.txt b/github/tests/ReplayData/Repository.testMergeWithMessage.txt similarity index 92% rename from test/ReplayData/Repository.testMergeWithMessage.txt rename to github/tests/ReplayData/Repository.testMergeWithMessage.txt index 9420c78c..ff0e02ca 100644 --- a/test/ReplayData/Repository.testMergeWithMessage.txt +++ b/github/tests/ReplayData/Repository.testMergeWithMessage.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/merges {'Authorization': 'Basic login_and_password_removed'} {"commit_message": "Commit message created by PyGithub", "head": "branchForHead", "base": "branchForBase"} +https POST api.github.com None /repos/jacquev6/PyGithub/merges {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"commit_message": "Commit message created by PyGithub", "head": "branchForHead", "base": "branchForBase"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4988'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('x-ratelimit-limit', '5000'), ('content-length', '1670'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('etag', '"f31a393604d4a8295a461319eb518495"'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/commits/231ab813ab5ccbdc102ee12e663c491794ccc32f'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Sat, 08 Sep 2012 12:21:08 GMT'), ('content-type', 'application/json; charset=utf-8')] {"sha":"231ab813ab5ccbdc102ee12e663c491794ccc32f","author":{"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","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-user-420.png","id":327146},"commit":{"message":"Commit message created by PyGithub","author":{"email":"vincent@vincent-jacques.net","name":"Vincent Jacques","date":"2012-09-08T05:21:08-07:00"},"comment_count":0,"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/231ab813ab5ccbdc102ee12e663c491794ccc32f","tree":{"sha":"97223b0c33ab29dd9aa038248dc982354f7d69a1","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/97223b0c33ab29dd9aa038248dc982354f7d69a1"},"committer":{"email":"vincent@vincent-jacques.net","name":"Vincent Jacques","date":"2012-09-08T05:21:08-07:00"}},"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/231ab813ab5ccbdc102ee12e663c491794ccc32f","parents":[{"sha":"3be2e82b400f3398c05b68f00a4427604e74c7c5","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/3be2e82b400f3398c05b68f00a4427604e74c7c5"},{"sha":"7a19732ca92cd80fd9da31fa590d67729d6b44df","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/7a19732ca92cd80fd9da31fa590d67729d6b44df"}],"committer":{"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","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-user-420.png","id":327146}} diff --git a/test/ReplayData/Repository.testMergeWithNothingToDo.txt b/github/tests/ReplayData/Repository.testMergeWithNothingToDo.txt similarity index 66% rename from test/ReplayData/Repository.testMergeWithNothingToDo.txt rename to github/tests/ReplayData/Repository.testMergeWithNothingToDo.txt index 977cae04..0f11312a 100644 --- a/test/ReplayData/Repository.testMergeWithNothingToDo.txt +++ b/github/tests/ReplayData/Repository.testMergeWithNothingToDo.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/merges {'Authorization': 'Basic login_and_password_removed'} {"commit_message": "Commit message created by PyGithub", "head": "branchForHead", "base": "branchForBase"} +https POST api.github.com None /repos/jacquev6/PyGithub/merges {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"commit_message": "Commit message created by PyGithub", "head": "branchForHead", "base": "branchForBase"} 204 [('status', '204 No Content'), ('x-ratelimit-remaining', '4985'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('cache-control', ''), ('date', 'Sat, 08 Sep 2012 12:22:53 GMT')] diff --git a/test/ReplayData/Repository.testMergeWithoutMessage.txt b/github/tests/ReplayData/Repository.testMergeWithoutMessage.txt similarity index 94% rename from test/ReplayData/Repository.testMergeWithoutMessage.txt rename to github/tests/ReplayData/Repository.testMergeWithoutMessage.txt index 94b604ec..64c0a548 100644 --- a/test/ReplayData/Repository.testMergeWithoutMessage.txt +++ b/github/tests/ReplayData/Repository.testMergeWithoutMessage.txt @@ -1,4 +1,4 @@ -https POST api.github.com None /repos/jacquev6/PyGithub/merges {'Authorization': 'Basic login_and_password_removed'} {"head": "branchForHead", "base": "branchForBase"} +https POST api.github.com None /repos/jacquev6/PyGithub/merges {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"head": "branchForHead", "base": "branchForBase"} 201 [('status', '201 Created'), ('x-ratelimit-remaining', '4991'), ('x-ratelimit-limit', '5000'), ('x-content-type-options', 'nosniff'), ('content-length', '1674'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('etag', '"9a4000ce96f4c4d47922c7c8896d894f"'), ('location', 'https://api.github.com/repos/jacquev6/PyGithub/commits/a01fa060858e3aced1fe4ad74798295376e76fd4'), ('cache-control', 'max-age=0, private, must-revalidate'), ('date', 'Sat, 08 Sep 2012 12:19:40 GMT'), ('x-github-media-type', 'github.beta; format=json'), ('content-type', 'application/json; charset=utf-8')] {"sha":"a01fa060858e3aced1fe4ad74798295376e76fd4","committer":{"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","url":"https://api.github.com/users/jacquev6","login":"jacquev6","id":327146},"author":{"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","url":"https://api.github.com/users/jacquev6","login":"jacquev6","id":327146},"parents":[{"sha":"3be2e82b400f3398c05b68f00a4427604e74c7c5","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/3be2e82b400f3398c05b68f00a4427604e74c7c5"},{"sha":"7a19732ca92cd80fd9da31fa590d67729d6b44df","url":"https://api.github.com/repos/jacquev6/PyGithub/commits/7a19732ca92cd80fd9da31fa590d67729d6b44df"}],"url":"https://api.github.com/repos/jacquev6/PyGithub/commits/a01fa060858e3aced1fe4ad74798295376e76fd4","commit":{"committer":{"email":"vincent@vincent-jacques.net","date":"2012-09-08T05:19:40-07:00","name":"Vincent Jacques"},"author":{"email":"vincent@vincent-jacques.net","date":"2012-09-08T05:19:40-07:00","name":"Vincent Jacques"},"message":"Merge branchForHead into branchForBase","tree":{"sha":"97223b0c33ab29dd9aa038248dc982354f7d69a1","url":"https://api.github.com/repos/jacquev6/PyGithub/git/trees/97223b0c33ab29dd9aa038248dc982354f7d69a1"},"url":"https://api.github.com/repos/jacquev6/PyGithub/git/commits/a01fa060858e3aced1fe4ad74798295376e76fd4","comment_count":0}} diff --git a/test/ReplayData/Repository.testSearchIssues.txt b/github/tests/ReplayData/Repository.testSearchIssues.txt similarity index 100% rename from test/ReplayData/Repository.testSearchIssues.txt rename to github/tests/ReplayData/Repository.testSearchIssues.txt diff --git a/test/ReplayData/RepositoryKey.setUp.txt b/github/tests/ReplayData/RepositoryKey.setUp.txt similarity index 100% rename from test/ReplayData/RepositoryKey.setUp.txt rename to github/tests/ReplayData/RepositoryKey.setUp.txt diff --git a/test/ReplayData/RepositoryKey.testDelete.txt b/github/tests/ReplayData/RepositoryKey.testDelete.txt similarity index 100% rename from test/ReplayData/RepositoryKey.testDelete.txt rename to github/tests/ReplayData/RepositoryKey.testDelete.txt diff --git a/test/ReplayData/RepositoryKey.testEdit.txt b/github/tests/ReplayData/RepositoryKey.testEdit.txt similarity index 62% rename from test/ReplayData/RepositoryKey.testEdit.txt rename to github/tests/ReplayData/RepositoryKey.testEdit.txt index e9332172..7794f464 100644 --- a/test/ReplayData/RepositoryKey.testEdit.txt +++ b/github/tests/ReplayData/RepositoryKey.testEdit.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /repos/jacquev6/PyGithub/keys/2626761 {'Authorization': 'Basic login_and_password_removed'} {"key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==", "title": "Title edited by PyGithub"} +https PATCH api.github.com None /repos/jacquev6/PyGithub/keys/2626761 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==", "title": "Title edited by PyGithub"} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4989'), ('content-length', '503'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"0e3fe92d1dde4f1bca0df384528bf1e2"'), ('date', 'Sun, 27 May 2012 11:06:26 GMT'), ('content-type', 'application/json; charset=utf-8')] {"url":"https://api.github.com/user/keys/2626761","verified":true,"key":"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==","title":"Title edited by PyGithub","id":2626761} diff --git a/test/ReplayData/RepositoryKey.testEditWithoutParameters.txt b/github/tests/ReplayData/RepositoryKey.testEditWithoutParameters.txt similarity index 90% rename from test/ReplayData/RepositoryKey.testEditWithoutParameters.txt rename to github/tests/ReplayData/RepositoryKey.testEditWithoutParameters.txt index 90e79296..86c9806a 100644 --- a/test/ReplayData/RepositoryKey.testEditWithoutParameters.txt +++ b/github/tests/ReplayData/RepositoryKey.testEditWithoutParameters.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /repos/jacquev6/PyGithub/keys/2626761 {'Authorization': 'Basic login_and_password_removed'} {} +https PATCH api.github.com None /repos/jacquev6/PyGithub/keys/2626761 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4985'), ('content-length', '503'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"ee6bf384c86aa3147ffa7fcde628072e"'), ('date', 'Sun, 27 May 2012 11:07:43 GMT'), ('content-type', 'application/json; charset=utf-8')] {"url":"https://api.github.com/user/keys/2626761","key":"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==","verified":true,"title":"Title edited by PyGithub","id":2626761} diff --git a/test/ReplayData/Tag.setUp.txt b/github/tests/ReplayData/Tag.setUp.txt similarity index 100% rename from test/ReplayData/Tag.setUp.txt rename to github/tests/ReplayData/Tag.setUp.txt diff --git a/test/ReplayData/Team.setUp.txt b/github/tests/ReplayData/Team.setUp.txt similarity index 100% rename from test/ReplayData/Team.setUp.txt rename to github/tests/ReplayData/Team.setUp.txt diff --git a/test/ReplayData/Team.testDelete.txt b/github/tests/ReplayData/Team.testDelete.txt similarity index 100% rename from test/ReplayData/Team.testDelete.txt rename to github/tests/ReplayData/Team.testDelete.txt diff --git a/test/ReplayData/Team.testEditWithAllArguments.txt b/github/tests/ReplayData/Team.testEditWithAllArguments.txt similarity index 70% rename from test/ReplayData/Team.testEditWithAllArguments.txt rename to github/tests/ReplayData/Team.testEditWithAllArguments.txt index a416132b..6a9946e8 100644 --- a/test/ReplayData/Team.testEditWithAllArguments.txt +++ b/github/tests/ReplayData/Team.testEditWithAllArguments.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /teams/189850 {'Authorization': 'Basic login_and_password_removed'} {"name": "Name edited twice by PyGithub", "permission": "admin"} +https PATCH api.github.com None /teams/189850 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"name": "Name edited twice by PyGithub", "permission": "admin"} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4949'), ('content-length', '151'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"8856425cedbdf3075576e823f39fc3d6"'), ('date', 'Sat, 26 May 2012 21:14:46 GMT'), ('content-type', 'application/json; charset=utf-8')] {"permission":"admin","members_count":0,"url":"https://api.github.com/teams/189850","repos_count":0,"name":"Name edited twice by PyGithub","id":189850} diff --git a/test/ReplayData/Team.testEditWithoutArguments.txt b/github/tests/ReplayData/Team.testEditWithoutArguments.txt similarity index 73% rename from test/ReplayData/Team.testEditWithoutArguments.txt rename to github/tests/ReplayData/Team.testEditWithoutArguments.txt index 413e5cd0..80d3d39f 100644 --- a/test/ReplayData/Team.testEditWithoutArguments.txt +++ b/github/tests/ReplayData/Team.testEditWithoutArguments.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /teams/189850 {'Authorization': 'Basic login_and_password_removed'} {"name": "Name edited by PyGithub"} +https PATCH api.github.com None /teams/189850 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"name": "Name edited by PyGithub"} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4952'), ('content-length', '144'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"843001aba6d35f27320c0788c9ff64b1"'), ('date', 'Sat, 26 May 2012 21:14:39 GMT'), ('content-type', 'application/json; charset=utf-8')] {"permission":"pull","members_count":0,"url":"https://api.github.com/teams/189850","repos_count":0,"name":"Name edited by PyGithub","id":189850} diff --git a/test/ReplayData/Team.testMembers.txt b/github/tests/ReplayData/Team.testMembers.txt similarity index 100% rename from test/ReplayData/Team.testMembers.txt rename to github/tests/ReplayData/Team.testMembers.txt diff --git a/test/ReplayData/Team.testRepos.txt b/github/tests/ReplayData/Team.testRepos.txt similarity index 100% rename from test/ReplayData/Team.testRepos.txt rename to github/tests/ReplayData/Team.testRepos.txt diff --git a/test/ReplayData/UserKey.setUp.txt b/github/tests/ReplayData/UserKey.setUp.txt similarity index 100% rename from test/ReplayData/UserKey.setUp.txt rename to github/tests/ReplayData/UserKey.setUp.txt diff --git a/test/ReplayData/UserKey.testDelete.txt b/github/tests/ReplayData/UserKey.testDelete.txt similarity index 100% rename from test/ReplayData/UserKey.testDelete.txt rename to github/tests/ReplayData/UserKey.testDelete.txt diff --git a/test/ReplayData/UserKey.testEditWithAllArguments.txt b/github/tests/ReplayData/UserKey.testEditWithAllArguments.txt similarity index 59% rename from test/ReplayData/UserKey.testEditWithAllArguments.txt rename to github/tests/ReplayData/UserKey.testEditWithAllArguments.txt index 61a50779..f8653d87 100644 --- a/test/ReplayData/UserKey.testEditWithAllArguments.txt +++ b/github/tests/ReplayData/UserKey.testEditWithAllArguments.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /user/keys/2626650 {'Authorization': 'Basic login_and_password_removed'} {"key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==", "title": "Title edited by PyGithub"} +https PATCH api.github.com None /user/keys/2626650 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {"key": "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==", "title": "Title edited by PyGithub"} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4979'), ('content-length', '503'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"b3e0d8e43865724d6f36f15753984816"'), ('date', 'Sat, 26 May 2012 19:57:25 GMT'), ('content-type', 'application/json; charset=utf-8')] {"url":"https://api.github.com/user/keys/2626650","verified":true,"key":"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==","title":"Title edited by PyGithub","id":2626650} diff --git a/test/ReplayData/UserKey.testEditWithoutArguments.txt b/github/tests/ReplayData/UserKey.testEditWithoutArguments.txt similarity index 85% rename from test/ReplayData/UserKey.testEditWithoutArguments.txt rename to github/tests/ReplayData/UserKey.testEditWithoutArguments.txt index 17f92822..d0a3a5de 100644 --- a/test/ReplayData/UserKey.testEditWithoutArguments.txt +++ b/github/tests/ReplayData/UserKey.testEditWithoutArguments.txt @@ -1,4 +1,4 @@ -https PATCH api.github.com None /user/keys/2626650 {'Authorization': 'Basic login_and_password_removed'} {} +https PATCH api.github.com None /user/keys/2626650 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed'} {} 200 [('status', '200 OK'), ('x-ratelimit-remaining', '4981'), ('content-length', '505'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"7261ec55c886d6bf42e48d5bf9544586"'), ('date', 'Sat, 26 May 2012 19:57:18 GMT'), ('content-type', 'application/json; charset=utf-8')] {"url":"https://api.github.com/user/keys/2626650","key":"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Mm0RjTNAYFfSCtUpO54usdseroUSIYg5KX4JoseTpqyiB/hqewjYLAdUq/tNIQzrkoEJWSyZrQt0ma7/YCyMYuNGd3DU6q6ZAyBeY3E9RyCiKjO3aTL2VKQGFvBVVmGdxGVSCITRphAcsKc/PF35/fg9XP9S0anMXcEFtdfMHz41SSw+XtE+Vc+6cX9FuI5qUfLGbkv8L1v3g4uw9VXlzq4GfTA+1S7D6mcoGHopAIXFlVr+2RfDKdSURMcB22z41fljO1MW4+zUS/4FyUTpL991es5fcwKXYoiE+x06VJeJJ1Krwx+DZj45uweV6cHXt2JwJEI9fWB6WyBlDejWw==","verified":true,"title":"Key added through PyGithub","id":2626650} diff --git a/github/tests/Repository.py b/github/tests/Repository.py new file mode 100644 index 00000000..578b6106 --- /dev/null +++ b/github/tests/Repository.py @@ -0,0 +1,426 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + +import github +import datetime + + +class Repository(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.repo = self.g.get_user().get_repo("PyGithub") + + def testAttributes(self): + self.assertEqual(self.repo.clone_url, "https://github.com/jacquev6/PyGithub.git") + self.assertEqual(self.repo.created_at, datetime.datetime(2012, 2, 25, 12, 53, 47)) + self.assertEqual(self.repo.description, "Python library implementing the full Github API v3") + self.assertEqual(self.repo.fork, False) + self.assertEqual(self.repo.forks, 3) + self.assertEqual(self.repo.full_name, "jacquev6/PyGithub") + self.assertEqual(self.repo.git_url, "git://github.com/jacquev6/PyGithub.git") + self.assertEqual(self.repo.has_downloads, True) + self.assertEqual(self.repo.has_issues, True) + self.assertEqual(self.repo.has_wiki, False) + self.assertEqual(self.repo.homepage, "http://vincent-jacques.net/PyGithub") + self.assertEqual(self.repo.html_url, "https://github.com/jacquev6/PyGithub") + self.assertEqual(self.repo.id, 3544490) + self.assertEqual(self.repo.language, "Python") + self.assertEqual(self.repo.master_branch, None) + self.assertEqual(self.repo.name, "PyGithub") + self.assertEqual(self.repo.open_issues, 16) + self.assertEqual(self.repo.organization, None) + self.assertEqual(self.repo.owner.login, "jacquev6") + self.assertEqual(self.repo.parent, None) + self.assertEqual(self.repo.permissions.admin, True) + self.assertEqual(self.repo.permissions.pull, True) + self.assertEqual(self.repo.permissions.push, True) + self.assertEqual(self.repo.private, False) + self.assertEqual(self.repo.pushed_at, datetime.datetime(2012, 5, 27, 6, 0, 28)) + self.assertEqual(self.repo.size, 308) + self.assertEqual(self.repo.source, None) + self.assertEqual(self.repo.ssh_url, "git@github.com:jacquev6/PyGithub.git") + self.assertEqual(self.repo.svn_url, "https://github.com/jacquev6/PyGithub") + self.assertEqual(self.repo.updated_at, datetime.datetime(2012, 5, 27, 6, 55, 28)) + self.assertEqual(self.repo.url, "https://api.github.com/repos/jacquev6/PyGithub") + self.assertEqual(self.repo.watchers, 15) + + def testEditWithoutArguments(self): + self.repo.edit("PyGithub") + + def testEditWithAllArguments(self): + self.repo.edit("PyGithub", "Description edited by PyGithub", "http://vincent-jacques.net/PyGithub", public=True, has_issues=True, has_wiki=False, has_downloads=True) + self.assertEqual(self.repo.description, "Description edited by PyGithub") + self.repo.edit("PyGithub", "Python library implementing the full Github API v3") + self.assertEqual(self.repo.description, "Python library implementing the full Github API v3") + + def testEditWithDefaultBranch(self): + self.assertEqual(self.repo.master_branch, None) + self.repo.edit("PyGithub", default_branch="master") + self.assertEqual(self.repo.master_branch, "master") + + def testDelete(self): + repo = self.g.get_user().get_repo("TestPyGithub") + repo.delete() + + def testGetContributors(self): + self.assertListKeyEqual(self.repo.get_contributors(), lambda c: (c.login, c.contributions), [("jacquev6", 355)]) + + def testCreateMilestone(self): + milestone = self.repo.create_milestone("Milestone created by PyGithub", state="open", description="Description created by PyGithub", due_on=datetime.date(2012, 6, 15)) + self.assertEqual(milestone.number, 5) + + def testCreateMilestoneWithMinimalArguments(self): + milestone = self.repo.create_milestone("Milestone also created by PyGithub") + self.assertEqual(milestone.number, 6) + + def testCreateIssue(self): + issue = self.repo.create_issue("Issue created by PyGithub") + self.assertEqual(issue.number, 28) + + def testCreateIssueWithAllArguments(self): + 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): + label = self.repo.create_label("Label with silly name % * + created by PyGithub", "00ff00") + self.assertEqual(label.color, "00ff00") + self.assertEqual(label.name, "Label with silly name % * + created by PyGithub") + self.assertEqual(label.url, "https://api.github.com/repos/jacquev6/PyGithub/labels/Label+with+silly+name+%25+%2A+%2B+created+by+PyGithub") + + def testGetLabel(self): + label = self.repo.get_label("Label with silly name % * + created by PyGithub") + self.assertEqual(label.color, "00ff00") + self.assertEqual(label.name, "Label with silly name % * + created by PyGithub") + self.assertEqual(label.url, "https://api.github.com/repos/jacquev6/PyGithub/labels/Label+with+silly+name+%25+%2A+%2B+created+by+PyGithub") + + def testCreateHookWithMinimalParameters(self): + hook = self.repo.create_hook("web", {"url": "http://foobar.com"}) + self.assertEqual(hook.id, 257967) + + def testCreateHookWithAllParameters(self): + hook = self.repo.create_hook("web", {"url": "http://foobar.com"}, ["fork"], False) + self.assertEqual(hook.active, True) # WTF + self.assertEqual(hook.id, 257993) + + def testCreateDownloadWithMinimalArguments(self): + download = self.repo.create_download("Foobar.txt", 1024) + self.assertEqual(download.id, 242562) + + def testCreateDownloadWithAllArguments(self): + download = self.repo.create_download("Foobar.txt", 1024, "Download created by PyGithub", "text/richtext") + self.assertEqual(download.accesskeyid, "1DWESVTPGHQVTX38V182") + self.assertEqual(download.acl, "public-read") + self.assertEqual(download.bucket, "github") + self.assertEqual(download.content_type, "text/richtext") + self.assertEqual(download.created_at, datetime.datetime(2012, 5, 22, 19, 11, 49)) + self.assertEqual(download.description, "Download created by PyGithub") + self.assertEqual(download.download_count, 0) + self.assertEqual(download.expirationdate, datetime.datetime(2112, 5, 22, 19, 11, 49)) + self.assertEqual(download.html_url, "https://github.com/downloads/jacquev6/PyGithub/Foobar.txt") + self.assertEqual(download.id, 242556) + self.assertEqual(download.mime_type, "text/richtext") + self.assertEqual(download.name, "Foobar.txt") + self.assertEqual(download.path, "downloads/jacquev6/PyGithub/Foobar.txt") + self.assertEqual(download.policy, "ewogICAgJ2V4cGlyYXRpb24nOiAnMjExMi0wNS0yMlQxOToxMTo0OS4wMDBaJywKICAgICdjb25kaXRpb25zJzogWwogICAgICAgIHsnYnVja2V0JzogJ2dpdGh1Yid9LAogICAgICAgIHsna2V5JzogJ2Rvd25sb2Fkcy9qYWNxdWV2Ni9QeUdpdGh1Yi9Gb29iYXIudHh0J30sCiAgICAgICAgeydhY2wnOiAncHVibGljLXJlYWQnfSwKICAgICAgICB7J3N1Y2Nlc3NfYWN0aW9uX3N0YXR1cyc6ICcyMDEnfSwKICAgICAgICBbJ3N0YXJ0cy13aXRoJywgJyRGaWxlbmFtZScsICcnXSwKICAgICAgICBbJ3N0YXJ0cy13aXRoJywgJyRDb250ZW50LVR5cGUnLCAnJ10KICAgIF0KfQ==") + self.assertEqual(download.prefix, "downloads/jacquev6/PyGithub") + self.assertEqual(download.redirect, False) + self.assertEqual(download.s3_url, "https://github.s3.amazonaws.com/") + self.assertEqual(download.signature, "8FCU/4rgT3ohXfE9N6HO7JgbuK4=") + self.assertEqual(download.size, 1024) + self.assertEqual(download.url, "https://api.github.com/repos/jacquev6/PyGithub/downloads/242556") + + def testCreateGitRef(self): + ref = self.repo.create_git_ref("refs/heads/BranchCreatedByPyGithub", "4303c5b90e2216d927155e9609436ccb8984c495") + self.assertEqual(ref.url, "https://api.github.com/repos/jacquev6/PyGithub/git/refs/heads/BranchCreatedByPyGithub") + + def testCreateGitBlob(self): + blob = self.repo.create_git_blob("Blob created by PyGithub", "latin1") + self.assertEqual(blob.sha, "5dd930f591cd5188e9ea7200e308ad355182a1d8") + + def testCreateGitTree(self): + tree = self.repo.create_git_tree( + [github.InputGitTreeElement( + "Foobar.txt", + "100644", + "blob", + content="File created by PyGithub" + )] + ) + 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", + "100644", + "blob", + content="File also created by PyGithub" + )], + base_tree + ) + self.assertEqual(tree.sha, "107139a922f33bab6fbeb9f9eb8787e7f19e0528") + + def testCreateGitTreeWithSha(self): + tree = self.repo.create_git_tree( + [github.InputGitTreeElement( + "Barbaz.txt", + "100644", + "blob", + sha="5dd930f591cd5188e9ea7200e308ad355182a1d8" + )] + ) + self.assertEqual(tree.sha, "fae707821159639589bf94f3fb0a7154ec5d441b") + + def testCreateGitCommit(self): + 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): + parents = [ + self.repo.get_git_commit("7248e66831d4ffe09ef1f30a1df59ec0a9331ece"), + self.repo.get_git_commit("12d427464f8d91c8e981043a86ba8a2a9e7319ea"), + ] + 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): + 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): + tag = self.repo.create_git_tag("TaggedByPyGithub", "Tag created by PyGithub", "0b820628236ab8bab3890860fc414fa757ca15f4", "commit") + self.assertEqual(tag.sha, "5ba561eaa2b7ca9015662510157b15d8f3b0232a") + + def testCreateGitTagWithAllArguments(self): + tag = self.repo.create_git_tag("TaggedByPyGithub2", "Tag also created by PyGithub", "526946197ae9da59c6507cacd13ad6f1cfb686ea", "commit", github.InputGitAuthor("John Doe", "j.doe@vincent-jacques.net", "2008-07-09T16:13:30+12:00")) + self.assertEqual(tag.sha, "f0e99a8335fbc84c53366c4a681118468f266625") + + def testCreateKey(self): + key = self.repo.create_key("Key added through PyGithub", "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Mm0RjTNAYFfSCtUpO54usdseroUSIYg5KX4JoseTpqyiB/hqewjYLAdUq/tNIQzrkoEJWSyZrQt0ma7/YCyMYuNGd3DU6q6ZAyBeY3E9RyCiKjO3aTL2VKQGFvBVVmGdxGVSCITRphAcsKc/PF35/fg9XP9S0anMXcEFtdfMHz41SSw+XtE+Vc+6cX9FuI5qUfLGbkv8L1v3g4uw9VXlzq4GfTA+1S7D6mcoGHopAIXFlVr+2RfDKdSURMcB22z41fljO1MW4+zUS/4FyUTpL991es5fcwKXYoiE+x06VJeJJ1Krwx+DZj45uweV6cHXt2JwJEI9fWB6WyBlDejWw== vincent@IDEE") + self.assertEqual(key.id, 2626761) + + def testCollaborators(self): + lyloa = self.g.get_user("Lyloa") + self.assertFalse(self.repo.has_in_collaborators(lyloa)) + self.repo.add_to_collaborators(lyloa) + self.assertTrue(self.repo.has_in_collaborators(lyloa)) + self.assertListKeyEqual(self.repo.get_collaborators(), lambda u: u.login, ["jacquev6", "Lyloa"]) + self.repo.remove_from_collaborators(lyloa) + self.assertFalse(self.repo.has_in_collaborators(lyloa)) + + def testCompare(self): + comparison = self.repo.compare("v0.6", "v0.7") + self.assertEqual(comparison.status, "ahead") + self.assertEqual(comparison.ahead_by, 4) + self.assertEqual(comparison.behind_by, 0) + self.assertEqual(comparison.diff_url, "https://github.com/jacquev6/PyGithub/compare/v0.6...v0.7.diff") + self.assertEqual(comparison.html_url, "https://github.com/jacquev6/PyGithub/compare/v0.6...v0.7") + self.assertEqual(comparison.url, "https://api.github.com/repos/jacquev6/PyGithub/compare/v0.6...v0.7") + self.assertEqual(comparison.patch_url, "https://github.com/jacquev6/PyGithub/compare/v0.6...v0.7.patch") + self.assertEqual(comparison.permalink_url, "https://github.com/jacquev6/PyGithub/compare/jacquev6:4303c5b...jacquev6:ecda065") + self.assertEqual(comparison.total_commits, 4) + self.assertListKeyEqual(comparison.files, lambda f: f.filename, ["ReferenceOfClasses.md", "github/Github.py", "github/Requester.py", "setup.py"]) + self.assertEqual(comparison.base_commit.sha, "4303c5b90e2216d927155e9609436ccb8984c495") + self.assertListKeyEqual(comparison.commits, lambda c: c.sha, ["5bb654d26dd014d36794acd1e6ecf3736f12aad7", "cb0313157bf904f2d364377d35d9397b269547a5", "0cec0d25e606c023a62a4fc7cdc815309ebf6d16", "ecda065e01876209d2bdf5fe4e91cee8ffaa9ff7"]) + + def testGetComments(self): + self.assertListKeyEqual( + self.repo.get_comments(), + lambda c: c.body, + [ + "probably a noob question: does this completion refer to autocompletion in IDE's/editors? \nI have observed that this is pretty erratic sometimes. I'm using PyDev+Eclipse.\nFor example, in the tutorial from the readme, `g.get_u` gets autocompleted correctly, but `g.get_user().get_r` (or any method or attribute applicable to NamedUsers/AuthenticatedUser, really) does not show autocompletion to `g.get_user().get_repo()`. Is that by design? It makes exploring the library/API a bit cumbersome. ", + "No, it has nothing to do with auto-completion in IDEs :D\n\nGithub API v3 sends only the main part of objects in reply to some requests. So, if the user wants an attribute that has not been received yet, I have to do another request to complete the object.\n\nYet, in version 1.0 (see the milesone), my library will be much more readable for IDEs and their auto-completion mechanisms, because I am giving up the meta-description that I used until 0.6, and I'm now generating much more traditional code, that you will be able to explore as if it was written manually.\n\nIf you want to take the time to open an issue about auto-completion in IDEs, I'll deal with it in milestone 1.0.\n\nThanks !", + "Ah, thanks for the clarification. :blush:\n\nI made issue #27 for the autocompletion. I already suspected something like this meta-description magic, since I tried to read some of the code and it was pretty arcane. I attributed that to my pythonic noobness, though. Thank you. ", + "Comment created by PyGithub" + ] + ) + + def testGetCommits(self): + self.assertListKeyBegin(self.repo.get_commits(), lambda c: c.sha, [u'ecda065e01876209d2bdf5fe4e91cee8ffaa9ff7', u'0cec0d25e606c023a62a4fc7cdc815309ebf6d16', u'cb0313157bf904f2d364377d35d9397b269547a5', u'5bb654d26dd014d36794acd1e6ecf3736f12aad7', u'4303c5b90e2216d927155e9609436ccb8984c495', u'2a7e80e6421c5d4d201d60619068dea6bae612cb', u'0af24499a98e85f8ab2191898e8b809e5cebd4c5', u'e5ae923a68a9ae295ce5aa20b1227253de60e918', u'2f64b625f7e2afc9bef61d0decb459e2ef65c550', u'590798d349cba7de6e83b43aa5d4f8b0a38e685d', u'e7dca9143a23b8e2045a4a910a4a329007b10086', u'ab3f9b422cb3043d35cf6002fc9c042f8ead8c2a', u'632d8b63c32a2b79e87eb3b93e1ad228724de4bd', u'64c6a1e975e61b9c1449bed016cd19f33ee4b1c5', u'99963536fc81db3b9986c761b9dd08de22089aa2', u'8d57522bbd15d1fb6b616fae795cd8721deb1c4d', u'1140a91f3e45d09bc15463724f178a7ebf8e3149', u'936f4a97f1a86392637ec002bbf89ff036a5062d', u'e10470481795506e2c232720e2a9ecf588c8b567', u'e456549e5265406f8090ae5145255c8ca9ea5e4e', u'a91131be42eb328ae030f584af500f56aa08424b', u'2469c6e1aeb7919126a8271f6980b555b167e8b0', u'a655d0424135befd3a0d53f3f7eff2d1c754854f', u'ce62e91268aa34dad0ba0dbee4769933e3a71e50', u'1c88ee221b7f995855a1fdfac7d0ba19db918739', u'bd1a5dff3c547c634b2d89f5847218820e343883', u'b226b5b4e2f44107dde674e7a5d3e88d4e3518df', u'25dbd4053e982402c7d92139f167dbe46008c932', u'a0cc821c1beada4aa9ca0d5218664c5372720936', u'c1440bdf20bfeb62684c6d1779448719dce9d2df', u'1095d304b7fab3818dcb4c42093c8c56d3ac05e4', u'bd39726f7cf86ea7ffb33b5718241fdab5fc8f53', u'1d2b27824d20612066d84be42d6691c66bb18ef4', u'6af2bfd0d46bc0eeb8c37b85c7b3003e0e4ae297', u'a475d685d8ae709095d09094ea0962ac182d33f0', u'a85de99ea5b5e7b38bd68e076d09c49207b8687e', u'd24cf209ddd1758188c5f35344f76df818d09a46', u'0909fec395bb1f97e2580d6a029cfc64b352aff9', u'6e421e9e85e12008758870bc046bc2c6120af72a', u'32ed0ebc377efbed5b482b3d49ff54bf1715d55a', u'8213df1d744f251aa8e52229643a9f6ce352f3c0', u'69cc298fd159f19eb204dd09f17d31dc4abc3d41', u'85eef756353e13efcb24c726320cd2617c2a7bd8', u'50ac55b25ceba555b84709839f80447552450697', u'767d75a580279e457f9bc52bc308a17ff8ea0509', u'75e72ffa3066693291f7da03070666e8f885097a', u'504047e218e6b34a3828ccc408431634f17b9504', u'960db1d5c9853e9f5fbbc9237c2c166ceef1f080', u'877dde23e140bbf038f9a2d8f0f07b4e3a965c61', u'1c95ddfa09ec0aa1f07ee9ad50a77be1dd74b55e', u'99564c1cab139d1e4678f5f83f60d26f1210db7e', u'231926207709ceaa61e87b64e34e17d85adecd9c', u'fb722625dddb9a32f75190723f7da12683b7c4b2', u'cab9d71603e127bdd1f600a759dccea1781fa1ab', u'e648e5aeb5edc1fbf83e9d37d2a3cb57c005019a', u'4a5cf98e7f959f1b5d9af484760c25cd27d9180d', u'5d1add448e0b0b1dadb8c6094a9e5e19b255f67e', u'0d9fc99a4b5d1ec6473c9c81c888917c132ffa65', u'b56aa09011378b014221f86dffb8304957a9e6bd', u'3e8169c0a98ce1e2c6a32ae1256ae0f735065df5', u'378558f6cac6183b4a7100c0ce5eaad1cfff6717', u'58b4396aa0e7cb72911b75cb035798143a06e0ee', u'a3be28756101370fbc689eec3a7825c4c385a6c9', u'3d6bd49ce229243fea4bb46a937622d0ec7d4d1c', u'58cb0dbdef9765e0e913c726f923a47315aaf80e', u'7b7ac20c6fa27f72a24483c73ab1bf4deffc89f0', u'97f308e67383368a2d15788cac28e126c8528bb2', u'fc33a6de4f0e08d7ff2de05935517ec3932d212e', u'cc6d0fc044eadf2e6fde5da699f61654c1e691f3', u'2dd71f3777b87f2ba61cb20d2c67f10401e3eb2c', u'366ca58ca004b9129f9d435db8204ce0f5bc57c3', u'0d3b3ffd1e5c143af8725fdee808101f626f683d', u'157f9c13275738b6b39b8d7a874f5f0aee47cb18']) + + def testGetCommitsWithArguments(self): + self.assertListKeyEqual(self.repo.get_commits("topic/RewriteWithGeneratedCode", "codegen/GenerateCode.py"), lambda c: c.sha, ["de386d5dc9cf103c90c4128eeca0e6abdd382065", "5b44982f6111bff2454243869df2e1c3086ccbba", "d6835ff949141957a733c8ddfa147026515ae493", "075d3d961d4614a2a0835d5583248adfc0687a7d", "8956796e7f462a49f499eac52fab901cdb59abdb", "283da5e7de6a4a3b6aaae7045909d70b643ad380", "d631e83b7901b0a0b6061b361130700a79505319"]) + + def testGetDownloads(self): + self.assertListKeyEqual(self.repo.get_downloads(), lambda d: d.id, [245143]) + + def testGetEvents(self): + self.assertListKeyBegin(self.repo.get_events(), lambda e: e.type, ["DownloadEvent", "DownloadEvent", "PushEvent", "IssuesEvent", "MemberEvent", "MemberEvent"]) + + def testGetForks(self): + self.assertListKeyEqual(self.repo.get_forks(), lambda r: r.owner.login, ["abersager"]) + + def testGetGitRefs(self): + self.assertListKeyEqual(self.repo.get_git_refs(), lambda r: r.ref, ["refs/heads/develop", "refs/heads/master", "refs/heads/topic/DependencyGraph", "refs/heads/topic/RewriteWithGeneratedCode", "refs/tags/v0.1", "refs/tags/v0.2", "refs/tags/v0.3", "refs/tags/v0.4", "refs/tags/v0.5", "refs/tags/v0.6", "refs/tags/v0.7"]) + + def testGetGitRef(self): + self.assertTrue(self.g.FIX_REPO_GET_GIT_REF) + self.assertEqual(self.repo.get_git_ref("heads/master").object.sha, "31110327ec45f3138e58ed247b2cf420fee481ec") + + def testGetGitRefWithIssue102Reverted(self): + self.g.FIX_REPO_GET_GIT_REF = False + self.assertFalse(self.g.FIX_REPO_GET_GIT_REF) + self.assertEqual(self.repo.get_git_ref("refs/heads/master").object.sha, "31110327ec45f3138e58ed247b2cf420fee481ec") + self.g.FIX_REPO_GET_GIT_REF = True + self.assertTrue(self.g.FIX_REPO_GET_GIT_REF) + + def testGetGitTreeWithRecursive(self): + tree = self.repo.get_git_tree("f492784d8ca837779650d1fb406a1a3587a764ad", True) + self.assertEqual(len(tree.tree), 90) + self.assertEqual(tree.tree[50].path, "github/GithubObjects/Gist.py") + + def testGetHooks(self): + self.assertListKeyEqual(self.repo.get_hooks(), lambda h: h.id, [257993]) + + def testGetIssues(self): + 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): + 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=datetime.datetime(2012, 5, 28, 23, 0, 0)), lambda i: i.id, [4793216, 4793162, 4793106, 3624556, 3619973, 3527266]) + self.assertListKeyEqual(self.repo.get_issues(mentioned=otherUser), lambda i: i.id, [4793162]) + + def testGetIssuesWithWildcards(self): + self.assertListKeyEqual(self.repo.get_issues(milestone="*"), lambda i: i.id, [4809786, 4793216, 4789817, 4452000, 3628022, 3624595, 3619973, 3527231]) + self.assertListKeyEqual(self.repo.get_issues(milestone="none"), lambda i: i.id, [4823331, 4809803, 4809778, 4793106, 3643837, 3527245]) + self.assertListKeyEqual(self.repo.get_issues(assignee="*"), lambda i: i.id, [4823331, 4809803, 4809786, 4809778, 4793216, 4793106, 4789817, 4452000, 3643837, 3628022, 3624595, 3527245, 3527231]) + self.assertListKeyEqual(self.repo.get_issues(assignee="none"), lambda i: i.id, [3619973]) + + def testGetKeys(self): + self.assertListKeyEqual(self.repo.get_keys(), lambda k: k.title, ["Key added through PyGithub"]) + + def testGetLabels(self): + self.assertListKeyEqual(self.repo.get_labels(), lambda l: l.name, ["Refactoring", "Public interface", "Functionalities", "Project management", "Bug", "Question"]) + + def testGetLanguages(self): + self.assertEqual(self.repo.get_languages(), {"Python": 127266, "Shell": 673}) + + def testGetMilestones(self): + self.assertListKeyEqual(self.repo.get_milestones(), lambda m: m.id, [93547]) + + def testGetMilestonesWithArguments(self): + self.assertListKeyEqual(self.repo.get_milestones("closed", "due_date", "asc"), lambda m: m.id, [93546, 95354, 108652, 124045]) + + def testGetIssuesEvents(self): + self.assertListKeyBegin(self.repo.get_issues_events(), lambda e: e.event, ["assigned", "subscribed", "closed", "assigned", "closed"]) + + def testGetNetworkEvents(self): + self.assertListKeyBegin(self.repo.get_network_events(), lambda e: e.type, ["DownloadEvent", "DownloadEvent", "PushEvent", "IssuesEvent", "MemberEvent"]) + + def testGetTeams(self): + repo = self.g.get_organization("BeaverSoftware").get_repo("FatherBeaver") + self.assertListKeyEqual(repo.get_teams(), lambda t: t.name, ["Members"]) + + def testGetWatchers(self): + self.assertListKeyEqual(self.repo.get_watchers(), lambda u: u.login, ["Stals", "att14", "jardon-u", "huxley", "mikofski", "L42y", "fanzeyi", "abersager", "waylan", "adericbourg", "tallforasmurf", "pvicente", "roskakori", "michaelpedersen", "BeaverSoftware"]) + + def testGetStargazers(self): + self.assertListKeyEqual(self.repo.get_stargazers(), lambda u: u.login, ["Stals", "att14", "jardon-u", "huxley", "mikofski", "L42y", "fanzeyi", "abersager", "waylan", "adericbourg", "tallforasmurf", "pvicente", "roskakori", "michaelpedersen", "stefanfoulis", "equus12", "JuRogn", "joshmoore", "jsilter", "dasapich", "ritratt", "hcilab", "vxnick", "pmuilu", "herlo", "malexw", "ahmetvurgun", "PengGu", "cosmin", "Swop", "kennethreitz", "bryandyck", "jason2506", "zsiciarz", "waawal", "gregorynicholas", "sente", "richmiller55", "thouis", "mazubieta", "michaelhood", "engie", "jtriley", "oangeor", "coryking", "noddi", "alejo8591", "omab", "Carreau", "bilderbuchi", "schwa", "rlerallut", "PengHub", "zoek1", "xobb1t", "notgary", "hattya", "ZebtinRis", "aaronhall", "youngsterxyf", "ailling", "gregwjacobs", "n0rmrx", "awylie", "firstthumb", "joshbrand", "berndca"]) + + def testGetSubscribers(self): + self.assertListKeyEqual(self.repo.get_subscribers(), lambda u: u.login, ["jacquev6", "equus12", "bilderbuchi", "hcilab", "hattya", "firstthumb", "gregwjacobs", "sagarsane", "liang456", "berndca", "Lyloa"]) + + def testCreatePull(self): + pull = self.repo.create_pull("Pull request created by PyGithub", "Body of the pull request", "topic/RewriteWithGeneratedCode", "BeaverSoftware:master") + self.assertEqual(pull.id, 1436215) + + def testCreatePullFromIssue(self): + issue = self.repo.get_issue(32) + pull = self.repo.create_pull(issue, "topic/RewriteWithGeneratedCode", "BeaverSoftware:master") + self.assertEqual(pull.id, 1436310) + + def testGetPulls(self): + self.assertListKeyEqual(self.repo.get_pulls(), lambda p: p.id, [1436310]) + + def testGetPullsWithArguments(self): + self.assertListKeyEqual(self.repo.get_pulls("closed"), lambda p: p.id, [1448168, 1436310, 1436215]) + + def testLegacySearchIssues(self): + issues = self.repo.legacy_search_issues("open", "search") + self.assertListKeyEqual(issues, lambda i: i.title, ["Support new Search API"]) + + # Attributes retrieved from legacy API without lazy completion call + self.assertEqual(issues[0].number, 49) + self.assertEqual(issues[0].created_at, datetime.datetime(2012, 6, 21, 12, 27, 38)) + self.assertEqual(issues[0].comments, 4) + self.assertEqual(issues[0].body[: 20], "New API ported from ") + self.assertEqual(issues[0].title, "Support new Search API") + self.assertEqual(issues[0].updated_at, datetime.datetime(2012, 6, 28, 21, 13, 25)) + self.assertEqual(issues[0].user.login, "kukuts") + self.assertEqual(issues[0].user.url, "/users/kukuts") + self.assertListKeyEqual(issues[0].labels, lambda l: l.name, ["Functionalities", "RequestedByUser"]) + self.assertEqual(issues[0].state, "open") + + def testAssignees(self): + lyloa = self.g.get_user("Lyloa") + jacquev6 = self.g.get_user("jacquev6") + self.assertTrue(self.repo.has_in_assignees(jacquev6)) + self.assertFalse(self.repo.has_in_assignees(lyloa)) + self.repo.add_to_collaborators(lyloa) + self.assertTrue(self.repo.has_in_assignees(lyloa)) + self.assertListKeyEqual(self.repo.get_assignees(), lambda u: u.login, ["jacquev6", "Lyloa"]) + self.repo.remove_from_collaborators(lyloa) + self.assertFalse(self.repo.has_in_assignees(lyloa)) + + def testGetContents(self): + self.assertEqual(len(self.repo.get_readme().content), 10212) + self.assertEqual(len(self.repo.get_contents("doc/ReferenceOfClasses.md").content), 38121) + + def testGetArchiveLink(self): + self.assertEqual(self.repo.get_archive_link("tarball"), "https://nodeload.github.com/jacquev6/PyGithub/tarball/master") + self.assertEqual(self.repo.get_archive_link("zipball"), "https://nodeload.github.com/jacquev6/PyGithub/zipball/master") + self.assertEqual(self.repo.get_archive_link("zipball", "master"), "https://nodeload.github.com/jacquev6/PyGithub/zipball/master") + self.assertEqual(self.repo.get_archive_link("tarball", "develop"), "https://nodeload.github.com/jacquev6/PyGithub/tarball/develop") + + def testGetBranch(self): + branch = self.repo.get_branch("develop") + self.assertEqual(branch.commit.sha, "03058a36164d2a7d946db205f25538434fa27d94") + + def testMergeWithoutMessage(self): + commit = self.repo.merge("branchForBase", "branchForHead") + self.assertEqual(commit.commit.message, "Merge branchForHead into branchForBase") + + def testMergeWithMessage(self): + commit = self.repo.merge("branchForBase", "branchForHead", "Commit message created by PyGithub") + self.assertEqual(commit.commit.message, "Commit message created by PyGithub") + + def testMergeWithNothingToDo(self): + commit = self.repo.merge("branchForBase", "branchForHead", "Commit message created by PyGithub") + self.assertEqual(commit, None) + + def testMergeWithConflict(self): + raised = False + try: + commit = self.repo.merge("branchForBase", "branchForHead") + except github.GithubException, exception: + raised = True + self.assertEqual(exception.status, 409) + self.assertEqual(exception.data, {"message": "Merge conflict"}) + self.assertTrue(raised) diff --git a/github/tests/RepositoryKey.py b/github/tests/RepositoryKey.py new file mode 100644 index 00000000..1072d71a --- /dev/null +++ b/github/tests/RepositoryKey.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + + +class RepositoryKey(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.key = self.g.get_user().get_repo("PyGithub").get_key(2626761) + + def testAttributes(self): + self.assertEqual(self.key.id, 2626761) + self.assertEqual(self.key.key, "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Mm0RjTNAYFfSCtUpO54usdseroUSIYg5KX4JoseTpqyiB/hqewjYLAdUq/tNIQzrkoEJWSyZrQt0ma7/YCyMYuNGd3DU6q6ZAyBeY3E9RyCiKjO3aTL2VKQGFvBVVmGdxGVSCITRphAcsKc/PF35/fg9XP9S0anMXcEFtdfMHz41SSw+XtE+Vc+6cX9FuI5qUfLGbkv8L1v3g4uw9VXlzq4GfTA+1S7D6mcoGHopAIXFlVr+2RfDKdSURMcB22z41fljO1MW4+zUS/4FyUTpL991es5fcwKXYoiE+x06VJeJJ1Krwx+DZj45uweV6cHXt2JwJEI9fWB6WyBlDejWw==") + self.assertEqual(self.key.title, "Key added through PyGithub") + self.assertEqual(self.key.url, "https://api.github.com/user/keys/2626761") + self.assertEqual(self.key.verified, True) + + def testEdit(self): + self.key.edit("Title edited by PyGithub", "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==") + self.assertEqual(self.key.key, "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==") + self.assertEqual(self.key.title, "Title edited by PyGithub") + + def testEditWithoutParameters(self): + self.key.edit() + + def testDelete(self): + self.key.delete() diff --git a/test/Authentication.py b/github/tests/Tag.py similarity index 58% rename from test/Authentication.py rename to github/tests/Tag.py index 1414bb79..86ecf627 100644 --- a/test/Authentication.py +++ b/github/tests/Tag.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -12,17 +14,15 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . import Framework -import github -class Authentication( Framework.BasicTestCase ): - def testNoAuthentication( self ): - g = github.Github() - self.assertEqual( g.get_user( "jacquev6" ).name, "Vincent Jacques" ) - def testBasicAuthentication( self ): - g = github.Github( self.login, self.password ) - self.assertEqual( g.get_user( "jacquev6" ).name, "Vincent Jacques" ) +class Tag(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.tag = self.g.get_user().get_repo("PyGithub").get_tags()[0] - def testOAuthAuthentication( self ): - g = github.Github( self.oauth_token ) - self.assertEqual( g.get_user( "jacquev6" ).name, "Vincent Jacques" ) + def testAttributes(self): + self.assertEqual(self.tag.commit.sha, "636e6112deb72277b3bffcc3303cd7e8a7431a5d") + self.assertEqual(self.tag.name, "v0.3") + self.assertEqual(self.tag.tarball_url, "https://github.com/jacquev6/PyGithub/tarball/v0.3") + self.assertEqual(self.tag.zipball_url, "https://github.com/jacquev6/PyGithub/zipball/v0.3") diff --git a/github/tests/Team.py b/github/tests/Team.py new file mode 100644 index 00000000..dae05bae --- /dev/null +++ b/github/tests/Team.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + + +class Team(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.org = self.g.get_organization("BeaverSoftware") + self.team = self.org.get_team(189850) + + def testAttributes(self): + self.assertEqual(self.team.id, 189850) + self.assertEqual(self.team.members_count, 0) + self.assertEqual(self.team.name, "Team created by PyGithub") + self.assertEqual(self.team.permission, "pull") + self.assertEqual(self.team.repos_count, 0) + self.assertEqual(self.team.url, "https://api.github.com/teams/189850") + + def testMembers(self): + user = self.g.get_user("jacquev6") + self.assertListKeyEqual(self.team.get_members(), None, []) + self.assertFalse(self.team.has_in_members(user)) + self.team.add_to_members(user) + self.assertListKeyEqual(self.team.get_members(), lambda u: u.login, ["jacquev6"]) + self.assertTrue(self.team.has_in_members(user)) + self.team.remove_from_members(user) + self.assertListKeyEqual(self.team.get_members(), None, []) + self.assertFalse(self.team.has_in_members(user)) + + def testRepos(self): + repo = self.org.get_repo("FatherBeaver") + self.assertListKeyEqual(self.team.get_repos(), None, []) + self.assertFalse(self.team.has_in_repos(repo)) + self.team.add_to_repos(repo) + self.assertListKeyEqual(self.team.get_repos(), lambda r: r.name, ["FatherBeaver"]) + self.assertTrue(self.team.has_in_repos(repo)) + self.team.remove_from_repos(repo) + self.assertListKeyEqual(self.team.get_repos(), None, []) + self.assertFalse(self.team.has_in_repos(repo)) + + def testEditWithoutArguments(self): + self.team.edit("Name edited by PyGithub") + self.assertEqual(self.team.name, "Name edited by PyGithub") + + def testEditWithAllArguments(self): + self.team.edit("Name edited twice by PyGithub", "admin") + self.assertEqual(self.team.name, "Name edited twice by PyGithub") + self.assertEqual(self.team.permission, "admin") + + def testDelete(self): + self.team.delete() diff --git a/github/tests/UserKey.py b/github/tests/UserKey.py new file mode 100644 index 00000000..14a59240 --- /dev/null +++ b/github/tests/UserKey.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import Framework + + +class UserKey(Framework.TestCase): + def setUp(self): + Framework.TestCase.setUp(self) + self.key = self.g.get_user().get_key(2626650) + + def testAttributes(self): + self.assertEqual(self.key.id, 2626650) + self.assertEqual(self.key.key, "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Mm0RjTNAYFfSCtUpO54usdseroUSIYg5KX4JoseTpqyiB/hqewjYLAdUq/tNIQzrkoEJWSyZrQt0ma7/YCyMYuNGd3DU6q6ZAyBeY3E9RyCiKjO3aTL2VKQGFvBVVmGdxGVSCITRphAcsKc/PF35/fg9XP9S0anMXcEFtdfMHz41SSw+XtE+Vc+6cX9FuI5qUfLGbkv8L1v3g4uw9VXlzq4GfTA+1S7D6mcoGHopAIXFlVr+2RfDKdSURMcB22z41fljO1MW4+zUS/4FyUTpL991es5fcwKXYoiE+x06VJeJJ1Krwx+DZj45uweV6cHXt2JwJEI9fWB6WyBlDejWw==") + self.assertEqual(self.key.title, "Key added through PyGithub") + self.assertEqual(self.key.url, "https://api.github.com/user/keys/2626650") + self.assertEqual(self.key.verified, True) + + def testEditWithoutArguments(self): + self.key.edit() + + def testEditWithAllArguments(self): + self.key.edit("Title edited by PyGithub", "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==") + self.assertEqual(self.key.key, "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==") + self.assertEqual(self.key.title, "Title edited by PyGithub") + + def testDelete(self): + self.key.delete() diff --git a/github/tests/__init__.py b/github/tests/__init__.py new file mode 100644 index 00000000..b203fa76 --- /dev/null +++ b/github/tests/__init__.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . diff --git a/github/tests/__main__.py b/github/tests/__main__.py new file mode 100644 index 00000000..22ed9fc6 --- /dev/null +++ b/github/tests/__main__.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- + +# Copyright 2012 Vincent Jacques +# vincent@vincent-jacques.net + +# This file is part of PyGithub. http://vincent-jacques.net/PyGithub + +# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . + +import sys +import unittest + +import github.tests.Framework +import github.tests.AllTests + + +def main(argv): + if "--record" in argv: + github.tests.Framework.activateRecordMode() + argv = [arg for arg in argv if arg != "--record"] + + unittest.main(module=github.tests.AllTests, argv=argv) + + +if __name__ == "__main__": + main(sys.argv) diff --git a/publish.sh b/publish.sh index e48b99c1..e95d06ac 100755 --- a/publish.sh +++ b/publish.sh @@ -1,11 +1,18 @@ #!/bin/sh +# -*- coding: utf-8 -*- -./run_tests.sh +pep8 --ignore=E501 github *.py # pip install pep8 -previousVersion=$( grep 'version =' setup.py | sed 's/.*version = \"\(.*\)\".*/\1/' ) +python -3 setup.py test --quiet +python3 setup.py test --quiet + +coverage run --branch "--include=build/lib.linux-x86_64-2.7/github/*.py" "--omit=build/lib.linux-x86_64-2.7/github/tests/*.py" setup.py test --quiet +coverage report --show-missing + +previousVersion=$( grep 'version=' setup.py | sed 's/.*version=\"\(.*\)\".*/\1/' ) echo "Next version number? (previous: '$previousVersion')" read version -sed -i -b "s/version = .*/version = \"$version\",/" setup.py +sed -i -b "s/version=.*/version=\"$version\",/" setup.py git add setup.py git log v$previousVersion.. --oneline @@ -24,5 +31,5 @@ cp -r *.md doc COPYING* github python setup.py sdist upload rm -rf github/*.md github/doc github/COPYING* -git push origin master master:develop +git push github master master:develop git push --tags diff --git a/python25-requirements.txt b/python25-requirements.txt new file mode 100644 index 00000000..7693e645 --- /dev/null +++ b/python25-requirements.txt @@ -0,0 +1 @@ +simplejson diff --git a/run_tests.sh b/run_tests.sh deleted file mode 100755 index 38ad3b7e..00000000 --- a/run_tests.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -rm -f $(find . -name "*.pyc") - -cd test - -coverage erase -coverage run --branch IntegrationTest.py - -echo "==============================" -echo "|| Coverage (shall be 100%) ||" -echo "==============================" - -coverage report -m --include=../github/* - -coverage html --include=../github/* diff --git a/setup.py b/setup.py index cb64cbd1..e2743eab 100755 --- a/setup.py +++ b/setup.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- # Copyright 2012 Vincent Jacques # vincent@vincent-jacques.net @@ -13,17 +14,18 @@ # You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . -from distutils.core import setup +import setuptools import textwrap -setup( - name = "PyGithub", - version = "1.7", - description = "Use the full Github API v3", - author = "Vincent Jacques", - author_email = "vincent@vincent-jacques.net", - url = "http://vincent-jacques.net/PyGithub", - long_description = textwrap.dedent( """\ + +setuptools.setup( + name="PyGithub", + version="1.9.1", + description="Use the full Github API v3", + author="Vincent Jacques", + author_email="vincent@vincent-jacques.net", + url="http://vincent-jacques.net/PyGithub", + long_description=textwrap.dedent("""\ Tutorial ======== @@ -50,20 +52,24 @@ setup( Reference documentation ======================= - See http://vincent-jacques.net/PyGithub""" ), - packages = [ + See http://vincent-jacques.net/PyGithub"""), + packages=[ "github", + "github.tests", ], - package_data = { - "github": [ "ReadMe.md", "COPYING*", "doc/*.md" ] + package_data={ + "github": ["ReadMe.md", "COPYING*", "doc/*.md", "tests/ReplayData/*.txt"] }, - classifiers = [ + classifiers=[ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)", "Operating System :: OS Independent", "Programming Language :: Python", + "Programming Language :: Python :: 3", "Topic :: Software Development", ], + test_suite="github.tests.AllTests", + use_2to3=True ) diff --git a/test/AuthenticatedUser.py b/test/AuthenticatedUser.py deleted file mode 100644 index 295e0d6f..00000000 --- a/test/AuthenticatedUser.py +++ /dev/null @@ -1,175 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -import github -import datetime - -class AuthenticatedUser( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.user = self.g.get_user() - - def testAttributes( self ): - self.assertEqual( self.user.avatar_url, "https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png" ) - self.assertEqual( self.user.bio, "" ) - self.assertEqual( self.user.blog, "http://vincent-jacques.net" ) - self.assertEqual( self.user.collaborators, 0 ) - self.assertEqual( self.user.company, "Criteo" ) - self.assertEqual( self.user.created_at, datetime.datetime( 2010, 7, 9, 6, 10, 6 ) ) - self.assertEqual( self.user.disk_usage, 16692 ) - self.assertEqual( self.user.email, "vincent@vincent-jacques.net" ) - self.assertEqual( self.user.followers, 13 ) - self.assertEqual( self.user.following, 24 ) - self.assertEqual( self.user.gravatar_id, "b68de5ae38616c296fa345d2b9df2225" ) - self.assertEqual( self.user.hireable, False ) - self.assertEqual( self.user.html_url, "https://github.com/jacquev6" ) - self.assertEqual( self.user.id, 327146 ) - self.assertEqual( self.user.location, "Paris, France" ) - self.assertEqual( self.user.login, "jacquev6" ) - self.assertEqual( self.user.name, "Vincent Jacques" ) - self.assertEqual( self.user.owned_private_repos, 5 ) - self.assertEqual( self.user.plan.name, "micro" ) - self.assertEqual( self.user.plan.collaborators, 1 ) - self.assertEqual( self.user.plan.space, 614400 ) - self.assertEqual( self.user.plan.private_repos, 5 ) - self.assertEqual( self.user.private_gists, 5 ) - self.assertEqual( self.user.public_gists, 1 ) - self.assertEqual( self.user.public_repos, 10 ) - self.assertEqual( self.user.total_private_repos, 5 ) - self.assertEqual( self.user.type, "User" ) - self.assertEqual( self.user.url, "https://api.github.com/users/jacquev6" ) - - def testEditWithoutArguments( self ): - self.user.edit() - - def testEditWithAllArguments( self ): - self.user.edit( "Name edited by PyGithub", "Email edited by PyGithub", "Blog edited by PyGithub", "Company edited by PyGithub", "Location edited by PyGithub", True, "Bio edited by PyGithub" ) - self.assertEqual( self.user.name, "Name edited by PyGithub" ) - self.assertEqual( self.user.email, "Email edited by PyGithub" ) - self.assertEqual( self.user.blog, "Blog edited by PyGithub" ) - self.assertEqual( self.user.company, "Company edited by PyGithub" ) - self.assertEqual( self.user.location, "Location edited by PyGithub" ) - self.assertEqual( self.user.hireable, True ) - self.assertEqual( self.user.bio, "Bio edited by PyGithub" ) - - def testEmails( self ): - self.assertEqual( self.user.get_emails(), [ "vincent@vincent-jacques.net", "github.com@vincent-jacques.net" ] ) - self.user.add_to_emails( "1@foobar.com", "2@foobar.com" ) - self.assertEqual( self.user.get_emails(), [ "vincent@vincent-jacques.net", "1@foobar.com", "2@foobar.com", "github.com@vincent-jacques.net" ] ) - self.user.remove_from_emails( "1@foobar.com", "2@foobar.com" ) - self.assertEqual( self.user.get_emails(), [ "vincent@vincent-jacques.net", "github.com@vincent-jacques.net" ] ) - - def testFollowing( self ): - nvie = self.g.get_user( "nvie" ) - self.assertListKeyEqual( self.user.get_following(), lambda u: u.login, [ "schacon", "jamis", "chad", "unclebob", "dabrahams", "jnorthrup", "brugidou", "regisb", "walidk", "tanzilli", "fjardon", "r3c", "sdanzan", "vineus", "cjuniet", "gturri", "ant9000", "asquini", "claudyus", "jardon-u", "s-bernard", "kamaradclimber", "Lyloa", "nvie" ] ) - self.assertEqual( self.user.has_in_following( nvie ), True ) - self.user.remove_from_following( nvie ) - self.assertEqual( self.user.has_in_following( nvie ), False ) - self.user.add_to_following( nvie ) - self.assertEqual( self.user.has_in_following( nvie ), True ) - self.assertListKeyEqual( self.user.get_followers(), lambda u: u.login, [ "jnorthrup", "brugidou", "regisb", "walidk", "afzalkhan", "sdanzan", "vineus", "gturri", "fjardon", "cjuniet", "jardon-u", "kamaradclimber", "L42y" ] ) - - def testWatching( self ): - gitflow = self.g.get_user( "nvie" ).get_repo( "gitflow" ) - self.assertListKeyEqual( self.user.get_watched(), lambda r: r.name, [ "git", "boost.php", "capistrano", "boost.perl", "git-subtree", "git-hg", "homebrew", "celtic_knot", "twisted-intro", "markup", "hub", "gitflow", "murder", "boto", "agit", "d3", "pygit2", "git-pulls", "django_mathlatex", "scrumblr", "developer.github.com", "python-github3", "PlantUML", "bootstrap", "drawnby", "django-socketio", "django-realtime", "playground", "BozoCrack", "FatherBeaver", "PyGithub", "django", "django", "TestPyGithub" ] ) - self.assertEqual( self.user.has_in_watched( gitflow ), True ) - self.user.remove_from_watched( gitflow ) - self.assertEqual( self.user.has_in_watched( gitflow ), False ) - self.user.add_to_watched( gitflow ) - self.assertEqual( self.user.has_in_watched( gitflow ), True ) - - def testStarring( self ): - gitflow = self.g.get_user( "nvie" ).get_repo( "gitflow" ) - self.assertListKeyEqual( self.user.get_starred(), lambda r: r.name, [ "git", "boost.php", "capistrano", "boost.perl", "git-subtree", "git-hg", "homebrew", "celtic_knot", "twisted-intro", "markup", "hub", "gitflow", "murder", "boto", "agit", "d3", "pygit2", "git-pulls", "django_mathlatex", "scrumblr", "developer.github.com", "python-github3", "PlantUML", "bootstrap", "drawnby", "django-socketio", "django-realtime", "playground", "BozoCrack", "FatherBeaver", "amaunet", "django", "django", "moviePlanning", "folly" ] ) - self.assertEqual( self.user.has_in_starred( gitflow ), True ) - self.user.remove_from_starred( gitflow ) - self.assertEqual( self.user.has_in_starred( gitflow ), False ) - self.user.add_to_starred( gitflow ) - self.assertEqual( self.user.has_in_starred( gitflow ), True ) - - def testSubscriptions( self ): - gitflow = self.g.get_user( "nvie" ).get_repo( "gitflow" ) - self.assertListKeyEqual( self.user.get_subscriptions(), lambda r: r.name, [ "gitflow", "ViDE", "Boost.HierarchicalEnum", "QuadProgMm", "DrawSyntax", "DrawTurksHead", "PrivateStuff", "vincent-jacques.net", "Hacking", "C4Planner", "developer.github.com", "PyGithub", "PyGithub", "django", "CinePlanning", "PyGithub", "PyGithub", "PyGithub", "IpMap", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub" ] ) - self.assertEqual( self.user.has_in_subscriptions( gitflow ), True ) - self.user.remove_from_subscriptions( gitflow ) - self.assertEqual( self.user.has_in_subscriptions( gitflow ), False ) - self.user.add_to_subscriptions( gitflow ) - self.assertEqual( self.user.has_in_subscriptions( gitflow ), True ) - - def testGetAuthorizations( self ): - self.assertListKeyEqual( self.user.get_authorizations(), lambda a: a.id, [ 372294 ] ) - - def testCreateRepository( self ): - repo = self.user.create_repo( "TestPyGithub" ) - self.assertEqual( repo.url, "https://api.github.com/repos/jacquev6/TestPyGithub" ) - - def testCreateRepositoryWithAllArguments( self ): - repo = self.user.create_repo( "TestPyGithub", "Repo created by PyGithub", "http://foobar.com", private = False, has_issues = False, has_wiki = False, has_downloads = False ) - self.assertEqual( repo.url, "https://api.github.com/repos/jacquev6/TestPyGithub" ) - - def testCreateAuthorizationWithoutArguments( self ): - authorization = self.user.create_authorization() - self.assertEqual( authorization.id, 372259 ) - - def testCreateAuthorizationWithAllArguments( self ): - authorization = self.user.create_authorization( [ "repo" ], "Note created by PyGithub", "http://vincent-jacques.net/PyGithub" ) - self.assertEqual( authorization.id, 372294 ) - - def testCreateGist( self ): - gist = self.user.create_gist( True, { "foobar.txt": github.InputFileContent( "File created by PyGithub" ) }, "Gist created by PyGithub" ) - self.assertEqual( gist.description, "Gist created by PyGithub" ) - self.assertEqual( gist.files.keys(), [ "foobar.txt" ] ) - self.assertEqual( gist.files[ "foobar.txt" ].content, "File created by PyGithub" ) - - def testCreateGistWithoutDescription( self ): - gist = self.user.create_gist( True, { "foobar.txt": github.InputFileContent( "File created by PyGithub" ) } ) - self.assertEqual( gist.description, None ) - self.assertEqual( gist.files.keys(), [ "foobar.txt" ] ) - self.assertEqual( gist.files[ "foobar.txt" ].content, "File created by PyGithub" ) - - def testCreateKey( self ): - key = self.user.create_key( "Key added through PyGithub", "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Mm0RjTNAYFfSCtUpO54usdseroUSIYg5KX4JoseTpqyiB/hqewjYLAdUq/tNIQzrkoEJWSyZrQt0ma7/YCyMYuNGd3DU6q6ZAyBeY3E9RyCiKjO3aTL2VKQGFvBVVmGdxGVSCITRphAcsKc/PF35/fg9XP9S0anMXcEFtdfMHz41SSw+XtE+Vc+6cX9FuI5qUfLGbkv8L1v3g4uw9VXlzq4GfTA+1S7D6mcoGHopAIXFlVr+2RfDKdSURMcB22z41fljO1MW4+zUS/4FyUTpL991es5fcwKXYoiE+x06VJeJJ1Krwx+DZj45uweV6cHXt2JwJEI9fWB6WyBlDejWw== vincent@IDEE" ) - self.assertEqual( key.id, 2626650 ) - - def testGetEvents( self ): - self.assertListKeyBegin( self.user.get_events(), lambda e: e.type, [ "PushEvent", "IssuesEvent", "IssueCommentEvent", "PushEvent" ] ) - - def testGetOrganizationEvents( self ): - self.assertListKeyBegin( self.user.get_organization_events( self.g.get_organization( "BeaverSoftware" ) ), lambda e: e.type, [ "CreateEvent", "CreateEvent", "PushEvent", "PushEvent" ] ) - - def testGetGists( self ): - self.assertListKeyEqual( self.user.get_gists(), lambda g: g.id, [ "2793505", "2793179", "11cb445f8197e17d303d", "1942384", "dcb7de17e8a52b74541d" ] ) - - def testGetStarredGists( self ): - self.assertListKeyEqual( self.user.get_starred_gists(), lambda g: g.id, [ "1942384", "dcb7de17e8a52b74541d" ] ) - - def testGetIssues( self ): - self.assertListKeyEqual( self.user.get_issues(), lambda i: ( i.id, i.repository.name ), [ ( 4639931, "PyGithub" ), ( 4452000, "PyGithub" ), ( 4356743, "PyGithub" ), ( 3716033, "PyGithub" ), ( 3715946, "PyGithub" ), ( 3643837, "PyGithub" ), ( 3628022, "PyGithub" ), ( 3624595, "PyGithub" ), ( 3624570, "PyGithub" ), ( 3624561, "PyGithub" ), ( 3624556, "PyGithub" ), ( 3619973, "PyGithub" ), ( 3527266, "PyGithub" ), ( 3527245, "PyGithub" ), ( 3527231, "PyGithub" ) ] ) - - def testGetKeys( self ): - self.assertListKeyEqual( self.user.get_keys(), lambda k: k.title, [ "vincent@home", "vincent@gandi", "vincent@aws", "vincent@macbook" ] ) - - def testGetOrgs( self ): - self.assertListKeyEqual( self.user.get_orgs(), lambda o: o.login, [ "BeaverSoftware" ] ) - - def testGetRepos( self ): - self.assertListKeyEqual( self.user.get_repos(), lambda r: r.name, [ "TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE" ] ) - - def testGetReposWithArguments( self ): - self.assertListKeyEqual( self.user.get_repos( "public", "full_name", "desc" ), lambda r: r.name, [ "ViDE", "QuadProgMm", "PyGithub", "DrawTurksHead", "DrawSyntax", "django", "developer.github.com", "C4Planner", "Boost.HierarchicalEnum", "acme-public-website" ] ) - - def testCreateFork( self ): - repo = self.user.create_fork( self.g.get_user( "nvie" ).get_repo( "gitflow" ) ) - self.assertEqual( repo.source.full_name, "nvie/gitflow" ) diff --git a/test/Authorization.py b/test/Authorization.py deleted file mode 100644 index 524abfd1..00000000 --- a/test/Authorization.py +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -import datetime - -class Authorization( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.authorization = self.g.get_user().get_authorization( 372259 ) - - def testAttributes( self ): - self.assertEqual( self.authorization.app.url, "http://developer.github.com/v3/oauth/#oauth-authorizations-api" ) - self.assertEqual( self.authorization.app.name, "GitHub API" ) - self.assertEqual( self.authorization.created_at, datetime.datetime( 2012, 5, 22, 18, 3, 17 ) ) - self.assertEqual( self.authorization.id, 372259 ) - self.assertEqual( self.authorization.note, None ) - self.assertEqual( self.authorization.note_url, None ) - self.assertEqual( self.authorization.scopes, [] ) - self.assertEqual( self.authorization.token, "82459c4500086f8f0cc67d2936c17d1e27ad1c33" ) - self.assertEqual( self.authorization.updated_at, datetime.datetime( 2012, 5, 22, 18, 3, 17 ) ) - self.assertEqual( self.authorization.url, "https://api.github.com/authorizations/372259" ) - - def testEdit( self ): - self.authorization.edit() - self.assertEqual( self.authorization.scopes, [] ) - self.authorization.edit( scopes = [ "user" ] ) - self.assertEqual( self.authorization.scopes, [ "user" ] ) - self.authorization.edit( add_scopes = [ "repo" ] ) - self.assertEqual( self.authorization.scopes, [ "user", "repo" ] ) - self.authorization.edit( remove_scopes = [ "repo" ] ) - self.assertEqual( self.authorization.scopes, [ "user" ] ) - self.assertEqual( self.authorization.note, None ) - self.assertEqual( self.authorization.note_url, None ) - self.authorization.edit( note = "Note created by PyGithub", note_url = "http://vincent-jacques.net/PyGithub" ) - self.assertEqual( self.authorization.note, "Note created by PyGithub" ) - self.assertEqual( self.authorization.note_url, "http://vincent-jacques.net/PyGithub" ) - - def testDelete( self ): - self.authorization.delete() diff --git a/test/Commit.py b/test/Commit.py deleted file mode 100644 index ddf04752..00000000 --- a/test/Commit.py +++ /dev/null @@ -1,80 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -class Commit( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.commit = self.g.get_user().get_repo( "PyGithub" ).get_commit( "1292bf0e22c796e91cc3d6e24b544aece8c21f2a" ) - self.commit.author.login # to force lazy completion - - def testAttributes( self ): - self.assertEqual( self.commit.author.login, "jacquev6" ) - self.assertEqual( self.commit.commit.url, "https://api.github.com/repos/jacquev6/PyGithub/git/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a" ) - self.assertEqual( self.commit.committer.login, "jacquev6" ) - self.assertEqual( len( self.commit.files ), 1 ) - self.assertEqual( self.commit.files[ 0 ].additions, 0 ) - self.assertEqual( self.commit.files[ 0 ].blob_url, "https://github.com/jacquev6/PyGithub/blob/1292bf0e22c796e91cc3d6e24b544aece8c21f2a/github/GithubObjects/GitAuthor.py" ) - self.assertEqual( self.commit.files[ 0 ].changes, 20 ) - self.assertEqual( self.commit.files[ 0 ].deletions, 20 ) - self.assertEqual( self.commit.files[ 0 ].filename, "github/GithubObjects/GitAuthor.py" ) - self.assertTrue( isinstance( self.commit.files[ 0 ].patch, ( str, unicode ) ) ) - self.assertEqual( self.commit.files[ 0 ].raw_url, "https://github.com/jacquev6/PyGithub/raw/1292bf0e22c796e91cc3d6e24b544aece8c21f2a/github/GithubObjects/GitAuthor.py" ) - self.assertEqual( self.commit.files[ 0 ].sha, "1292bf0e22c796e91cc3d6e24b544aece8c21f2a" ) - self.assertEqual( self.commit.files[ 0 ].status, "modified" ) - self.assertEqual( len( self.commit.parents ), 1 ) - self.assertEqual( self.commit.parents[ 0 ].sha, "b46ed0dfde5ad02d3b91eb54a41c5ed960710eae" ) - self.assertEqual( self.commit.sha, "1292bf0e22c796e91cc3d6e24b544aece8c21f2a" ) - self.assertEqual( self.commit.stats.deletions, 20 ) - self.assertEqual( self.commit.stats.additions, 0 ) - self.assertEqual( self.commit.stats.total, 20 ) - self.assertEqual( self.commit.url, "https://api.github.com/repos/jacquev6/PyGithub/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a" ) - - def testGetComments( self ): - self.assertListKeyEqual( self.commit.get_comments(), lambda c: c.id, [ 1347033, 1347083, 1347397, 1349654 ] ) - - def testCreateComment( self ): - comment = self.commit.create_comment( "Comment created by PyGithub" ) - self.assertEqual( comment.id, 1361949 ) - self.assertEqual( comment.line, None ) - self.assertEqual( comment.path, None ) - self.assertEqual( comment.position, None ) - - def testCreateCommentOnFileLine( self ): - comment = self.commit.create_comment( "Comment created by PyGithub", path = "codegen/templates/GithubObject.MethodBody.UseResult.py", line = 26 ) - self.assertEqual( comment.id, 1362000 ) - self.assertEqual( comment.line, 26 ) - self.assertEqual( comment.path, "codegen/templates/GithubObject.MethodBody.UseResult.py" ) - self.assertEqual( comment.position, None ) - - def testCreateCommentOnFilePosition( self ): - comment = self.commit.create_comment( "Comment also created by PyGithub", path = "codegen/templates/GithubObject.MethodBody.UseResult.py", position = 3 ) - self.assertEqual( comment.id, 1362001 ) - self.assertEqual( comment.line, None ) - self.assertEqual( comment.path, "codegen/templates/GithubObject.MethodBody.UseResult.py" ) - self.assertEqual( comment.position, 3 ) - - def testCreateStatusWithoutOptionalParameters( self ): - status = self.commit.create_status( "pending" ) - self.assertEqual( status.id, 277031 ) - self.assertEqual( status.state, "pending" ) - self.assertEqual( status.target_url, None ) - self.assertEqual( status.description, None ) - - def testCreateStatusWithAllParameters( self ): - status = self.commit.create_status( "success", "https://github.com/jacquev6/PyGithub/issues/67", "Status successfuly created by PyGithub" ) - self.assertEqual( status.id, 277040 ) - self.assertEqual( status.state, "success" ) - self.assertEqual( status.target_url, "https://github.com/jacquev6/PyGithub/issues/67" ) - self.assertEqual( status.description, "Status successfuly created by PyGithub" ) diff --git a/test/CommitComment.py b/test/CommitComment.py deleted file mode 100644 index 423f6152..00000000 --- a/test/CommitComment.py +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -import datetime - -class CommitComment( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.comment = self.g.get_user().get_repo( "PyGithub" ).get_comment( 1361949 ) - - def testAttributes( self ): - self.assertEqual( self.comment.body, "Comment created by PyGithub" ) - self.assertEqual( self.comment.commit_id, "6945921c529be14c3a8f566dd1e483674516d46d" ) - self.assertEqual( self.comment.created_at, datetime.datetime( 2012, 5, 22, 18, 40, 18 ) ) - self.assertEqual( self.comment.html_url, "https://github.com/jacquev6/PyGithub/commit/6945921c529be14c3a8f566dd1e483674516d46d#commitcomment-1361949" ) - self.assertEqual( self.comment.id, 1361949 ) - self.assertEqual( self.comment.line, None ) - self.assertEqual( self.comment.path, None ) - self.assertEqual( self.comment.position, None ) - self.assertEqual( self.comment.updated_at, datetime.datetime( 2012, 5, 22, 18, 40, 18 ) ) - self.assertEqual( self.comment.url, "https://api.github.com/repos/jacquev6/PyGithub/comments/1361949" ) - self.assertEqual( self.comment.user.login, "jacquev6" ) - - def testEdit( self ): - self.comment.edit( "Comment edited by PyGithub" ) - - def testDelete( self ): - self.comment.delete() diff --git a/test/CommitStatus.py b/test/CommitStatus.py deleted file mode 100644 index 30e5eb22..00000000 --- a/test/CommitStatus.py +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -import github -import datetime - -class CommitStatus( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.statuses = list( self.g.get_user().get_repo( "PyGithub" ).get_commit( "1292bf0e22c796e91cc3d6e24b544aece8c21f2a" ).get_statuses() ) - - def testAttributes( self ): - self.assertEqual( self.statuses[ 0 ].created_at, datetime.datetime( 2012, 9, 8, 11, 30, 56 ) ) - self.assertEqual( self.statuses[ 0 ].updated_at, datetime.datetime( 2012, 9, 8, 11, 30, 56 ) ) - self.assertEqual( self.statuses[ 0 ].creator.login, "jacquev6" ) - self.assertEqual( self.statuses[ 0 ].description, "Status successfuly created by PyGithub" ) - self.assertEqual( self.statuses[ 1 ].description, None ) - self.assertEqual( self.statuses[ 0 ].id, 277040 ) - self.assertEqual( self.statuses[ 0 ].state, "success" ) - self.assertEqual( self.statuses[ 1 ].state, "pending" ) - self.assertEqual( self.statuses[ 0 ].target_url, "https://github.com/jacquev6/PyGithub/issues/67" ) - self.assertEqual( self.statuses[ 1 ].target_url, None ) diff --git a/test/Download.py b/test/Download.py deleted file mode 100644 index ba80fb36..00000000 --- a/test/Download.py +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -import datetime - -class Download( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.download = self.g.get_user().get_repo( "PyGithub" ).get_download( 242550 ) - - def testAttributes( self ): - self.assertEqual( self.download.accesskeyid, None ) - self.assertEqual( self.download.acl, None ) - self.assertEqual( self.download.bucket, None ) - self.assertEqual( self.download.content_type, "text/plain" ) - self.assertEqual( self.download.created_at, datetime.datetime( 2012, 5, 22, 18, 58, 32 ) ) - self.assertEqual( self.download.description, None ) - self.assertEqual( self.download.download_count, 0 ) - self.assertEqual( self.download.expirationdate, None ) - self.assertEqual( self.download.html_url, "https://github.com/downloads/jacquev6/PyGithub/Foobar.txt" ) - self.assertEqual( self.download.id, 242550 ) - self.assertEqual( self.download.mime_type, None ) - self.assertEqual( self.download.name, "Foobar.txt" ) - self.assertEqual( self.download.path, None ) - self.assertEqual( self.download.policy, None ) - self.assertEqual( self.download.prefix, None ) - self.assertEqual( self.download.redirect, None ) - self.assertEqual( self.download.s3_url, None ) - self.assertEqual( self.download.signature, None ) - self.assertEqual( self.download.size, 1024 ) - self.assertEqual( self.download.url, "https://api.github.com/repos/jacquev6/PyGithub/downloads/242550" ) - - def testDelete( self ): - self.download.delete() diff --git a/test/Enterprise.py b/test/Enterprise.py deleted file mode 100644 index 9058c608..00000000 --- a/test/Enterprise.py +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import github - -import Framework - -# Replay data for this test case is forged, because I don't have access to a real Github Enterprise install -class Enterprise( Framework.BasicTestCase ): - def testHttps( self ): - g = github.Github( self.login, self.password, base_url = "https://my.enterprise.com" ) - self.assertListKeyEqual( g.get_user().get_repos(), lambda r: r.name, [ "TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE" ] ) - - def testHttp( self ): - g = github.Github( self.login, self.password, base_url = "http://my.enterprise.com" ) - self.assertListKeyEqual( g.get_user().get_repos(), lambda r: r.name, [ "TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE" ] ) - - def testLongUrl( self ): - g = github.Github( self.login, self.password, base_url = "http://my.enterprise.com/path/to/github" ) - repos = g.get_user().get_repos() - self.assertListKeyEqual( repos, lambda r: r.name, [ "TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE" ] ) - self.assertEqual( repos[ 0 ].owner.name, "Vincent Jacques" ) - - def testSpecificPort( self ): - g = github.Github( self.login, self.password, base_url = "http://my.enterprise.com:8080" ) - self.assertListKeyEqual( g.get_user().get_repos(), lambda r: r.name, [ "TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE" ] ) diff --git a/test/Event.py b/test/Event.py deleted file mode 100644 index fa17c2a3..00000000 --- a/test/Event.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -import datetime - -class Event( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.event = self.g.get_user( "jacquev6" ).get_events()[ 0 ] - - def testAttributes( self ): - self.assertEqual( self.event.actor.login, "jacquev6" ) - self.assertEqual( self.event.created_at, datetime.datetime( 2012, 5, 26, 10, 1, 39 ) ) - self.assertEqual( self.event.id, "1556114751" ) - self.assertEqual( self.event.org, None ) - self.assertEqual( self.event.payload, {u'commits': [{u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/5bb654d26dd014d36794acd1e6ecf3736f12aad7', u'sha': u'5bb654d26dd014d36794acd1e6ecf3736f12aad7', u'message': u'Implement the three authentication schemes', u'distinct': False, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/cb0313157bf904f2d364377d35d9397b269547a5', u'sha': u'cb0313157bf904f2d364377d35d9397b269547a5', u'message': u"Merge branch 'topic/Authentication' into develop", u'distinct': False, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/0cec0d25e606c023a62a4fc7cdc815309ebf6d16', u'sha': u'0cec0d25e606c023a62a4fc7cdc815309ebf6d16', u'message': u'Publish version 0.7', u'distinct': False, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/ecda065e01876209d2bdf5fe4e91cee8ffaa9ff7', u'sha': u'ecda065e01876209d2bdf5fe4e91cee8ffaa9ff7', u'message': u"Merge branch 'develop'", u'distinct': False, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/3a3bf4763192ee1234eb0557628133e06f3dfc76', u'sha': u'3a3bf4763192ee1234eb0557628133e06f3dfc76', u'message': u"Merge branch 'master' into topic/RewriteWithGeneratedCode\n\nConflicts:\n\tgithub/Github.py\n\tgithub/Requester.py", u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/608f17794664f61693a3dc05e6056fea8fbef0ff', u'sha': u'608f17794664f61693a3dc05e6056fea8fbef0ff', u'message': u'Restore some form of Authorization header in replay data', u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/2c04b8adbd91d38eef4f0767337ab7a12b2f684b', u'sha': u'2c04b8adbd91d38eef4f0767337ab7a12b2f684b', u'message': u'Allow test without pre-set-up Github', u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/5b97389988b6fe43e15a079702f6f1671257fb28', u'sha': u'5b97389988b6fe43e15a079702f6f1671257fb28', u'message': u'Test three authentication schemes', u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/12747613c5ec00deccf296b8619ad507f7050475', u'sha': u'12747613c5ec00deccf296b8619ad507f7050475', u'message': u'Test Issue.getComments', u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/2982fa96c5ca75abe717d974d83f9135d664232e', u'sha': u'2982fa96c5ca75abe717d974d83f9135d664232e', u'message': u'Test the new Repository.full_name attribute', u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}, {u'url': u'https://api.github.com/repos/jacquev6/PyGithub/commits/619eae8d51c5988f0d2889fc767fa677438ba95d', u'sha': u'619eae8d51c5988f0d2889fc767fa677438ba95d', u'message': u'Improve coverage of AuthenticatedUser', u'distinct': True, u'author': {u'name': u'Vincent Jacques', u'email': u'vincent@vincent-jacques.net'}}], u'head': u'619eae8d51c5988f0d2889fc767fa677438ba95d', u'push_id': 80673538, u'ref': u'refs/heads/topic/RewriteWithGeneratedCode', u'size': 11} ) - self.assertEqual( self.event.public, True ) - self.assertEqual( self.event.repo.name, "jacquev6/PyGithub" ) - self.assertEqual( self.event.type, "PushEvent" ) diff --git a/test/Exceptions.py b/test/Exceptions.py deleted file mode 100644 index 1166993b..00000000 --- a/test/Exceptions.py +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import github - -import Framework - -# To stay compatible with Python 2.6, we do not use self.assertRaises with only one argument -class Exceptions( Framework.TestCase ): - def testInvalidInput( self ): - try: - self.g.get_user().create_key( "Bad key", "xxx" ) - self.fail( "Should have raised" ) - except github.GithubException, exception: - self.assertEqual( exception.status, 422 ) - self.assertEqual( - exception.data, - { - "errors": [ - { - "code": "custom", - "field": "key", - "message": "key is invalid. It must begin with 'ssh-rsa' or 'ssh-dss'. Check that you're copying the public half of the key", - "resource": "PublicKey" - } - ], - "message": "Validation Failed" - } - ) - self.assertEqual( str( exception ), "422 {u\'message\': u\'Validation Failed\', u\'errors\': [{u\'field\': u\'key\', u\'message\': u\"key is invalid. It must begin with \'ssh-rsa\' or \'ssh-dss\'. Check that you\'re copying the public half of the key\", u\'code\': u\'custom\', u\'resource\': u\'PublicKey\'}]}" ) - - def testUnknownObject( self ): - try: - self.g.get_user().get_repo( "Xxx" ) - self.fail( "Should have raised" ) - except github.GithubException, exception: - self.assertEqual( exception.status, 404 ) - self.assertEqual( exception.data, { "message": "Not Found" } ) - self.assertEqual( str( exception ), "404 {u'message': u'Not Found'}" ) - - def testUnknownUser( self ): - try: - self.g.get_user( "ThisUserShouldReallyNotExist" ) - self.fail( "Should have raised" ) - except github.GithubException, exception: - self.assertEqual( exception.status, 404 ) - self.assertEqual( exception.data, { "message": "Not Found" } ) - self.assertEqual( str( exception ), "404 {u'message': u'Not Found'}" ) - - def testBadAuthentication( self ): - try: - github.Github( "BadUser", "BadPassword" ).get_user().login - self.fail( "Should have raised" ) - except github.GithubException, exception: - self.assertEqual( exception.status, 401 ) - self.assertEqual( exception.data, { "message": "Bad credentials" } ) - self.assertEqual( str( exception ), "401 {u'message': u'Bad credentials'}" ) diff --git a/test/Framework.py b/test/Framework.py deleted file mode 100644 index 597c64e1..00000000 --- a/test/Framework.py +++ /dev/null @@ -1,182 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import os -import sys -import unittest -import httplib -import traceback -import itertools - -sys.path = [ os.path.join( os.path.dirname( __file__ ), ".." ) ] + sys.path -import github - -class FakeHttpResponse: - def __init__( self, status, headers, output ): - self.status = status - self.__headers = headers - self.__output = output - - def getheaders( self ): - return self.__headers - - def read( self ): - return self.__output - -def fixAuthorizationHeader( headers ): - if "Authorization" in headers: - if headers[ "Authorization" ].startswith( "token " ): - headers[ "Authorization" ] = "token private_token_removed" - elif headers[ "Authorization" ].startswith( "Basic " ): - headers[ "Authorization" ] = "Basic login_and_password_removed" - else: - assert False - -class RecordingConnection: - def __init__( self, file, protocol, host, port, *args, **kwds ): - self.__file = file - self.__protocol = protocol - self.__host = host - self.__port = str( port ) - self.__cnx = self._realConnection( host, port, *args, **kwds ) - - def request( self, verb, url, input, headers ): - print verb, url, input, headers, - self.__cnx.request( verb, url, input, headers ) - fixAuthorizationHeader( headers ) - self.__file.write( self.__protocol + " " + verb + " " + self.__host + " " + self.__port + " " + url + " " + str( headers ) + " " + input + "\n" ) - - def getresponse( self ): - res = self.__cnx.getresponse() - - status = res.status - print "=>", status - headers = res.getheaders() - output = res.read() - - self.__file.write( str( status ) + "\n" ) - self.__file.write( str( headers ) + "\n" ) - self.__file.write( str( output ) + "\n" ) - - return FakeHttpResponse( status, headers, output ) - - def close( self ): - self.__file.write( "\n" ) - return self.__cnx.close() - -class RecordingHttpConnection( RecordingConnection ): - _realConnection = httplib.HTTPConnection - - def __init__( self, file, *args, **kwds ): - RecordingConnection.__init__( self, file, "http", *args, **kwds ) - -class RecordingHttpsConnection( RecordingConnection ): - _realConnection = httplib.HTTPSConnection - - def __init__( self, file, *args, **kwds ): - print args, kwds - RecordingConnection.__init__( self, file, "https", *args, **kwds ) - -class ReplayingConnection: - def __init__( self, testCase, file, protocol, host, port, *args, **kwds ): - self.__testCase = testCase - self.__file = file - self.__protocol = protocol - self.__host = host - self.__port = str( port ) - - def request( self, verb, url, input, headers ): - fixAuthorizationHeader( headers ) - expectation = self.__file.readline().strip() - self.__testCase.assertEqual( self.__protocol + " " + verb + " " + self.__host + " " + self.__port + " " + url + " " + str( headers ) + " " + input, expectation ) - - def getresponse( self ): - status = int( self.__file.readline().strip() ) - headers = eval( self.__file.readline().strip() ) - output = self.__file.readline().strip() - - return FakeHttpResponse( status, headers, output ) - - def close( self ): - self.__file.readline() - -def ReplayingHttpConnection( testCase, file, *args, **kwds ): - return ReplayingConnection( testCase, file, "http", *args, **kwds ) - -def ReplayingHttpsConnection( testCase, file, *args, **kwds ): - return ReplayingConnection( testCase, file, "https", *args, **kwds ) - -class BasicTestCase( unittest.TestCase ): - recordMode = False - - def setUp( self ): - unittest.TestCase.setUp( self ) - self.__fileName = "" - self.__file = None - if self.recordMode: - github.Requester.Requester.injectConnectionClasses( - lambda ignored, *args, **kwds: RecordingHttpConnection( self.__openFile( "wb" ), *args, **kwds ), - lambda ignored, *args, **kwds: RecordingHttpsConnection( self.__openFile( "wb" ), *args, **kwds ) - ) - import GithubCredentials - self.login = GithubCredentials.login - self.password = GithubCredentials.password - self.oauth_token = GithubCredentials.oauth_token - else: - github.Requester.Requester.injectConnectionClasses( - lambda ignored, *args, **kwds: ReplayingHttpConnection( self, self.__openFile( "r" ), *args, **kwds ), - lambda ignored, *args, **kwds: ReplayingHttpsConnection( self, self.__openFile( "r" ), *args, **kwds ) - ) - self.login = "login" - self.password = "password" - self.oauth_token = "oauth_token" - - def tearDown( self ): - unittest.TestCase.tearDown( self ) - self.__closeReplayFileIfNeeded() - - def __openFile( self, mode ): - for ( _, _, functionName, _ ) in traceback.extract_stack(): - if functionName.startswith( "test" ) or functionName == "setUp" or functionName == "tearDown": - if functionName != "test": # because in class Hook( Framework.TestCase ), method testTest calls Hook.test - fileName = os.path.join( os.path.dirname( __file__ ), "ReplayData", self.__class__.__name__ + "." + functionName + ".txt" ) - if fileName != self.__fileName: - self.__closeReplayFileIfNeeded() - self.__fileName = fileName - self.__file = open( self.__fileName, mode ) - return self.__file - - def __closeReplayFileIfNeeded( self ): - if self.__file is not None: - if not self.recordMode: - self.assertEqual( self.__file.readline(), "" ) - self.__file.close() - - def assertListKeyEqual( self, elements, key, expectedKeys ): - realKeys = [ key( element ) for element in elements ] - self.assertEqual( realKeys, expectedKeys ) - - def assertListKeyBegin( self, elements, key, expectedKeys ): - realKeys = [ key( element ) for element in elements[ : len( expectedKeys ) ] ] - self.assertEqual( realKeys, expectedKeys ) - -class TestCase( BasicTestCase ): - def setUp( self ): - BasicTestCase.setUp( self ) - self.g = github.Github( self.login, self.password ) - -def main(): - if "--record" in sys.argv: - BasicTestCase.recordMode = True - - unittest.main( argv = [ arg for arg in sys.argv if arg != "--record" ] ) diff --git a/test/Gist.py b/test/Gist.py deleted file mode 100644 index 76341e8d..00000000 --- a/test/Gist.py +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -import github -import datetime - -class Gist( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.gist = self.g.get_gist( "2729810" ) - - def testAttributes( self ): - self.assertEquals( self.gist.comments, 0 ) - self.assertEquals( self.gist.created_at, datetime.datetime( 2012, 2, 29, 16, 47, 12 ) ) - self.assertEquals( self.gist.description, "How to error 500 Github API v3, as requested by Rick (GitHub Staff)" ) - self.assertEquals( self.gist.files.keys(), [ "fail_github.py" ] ) - self.assertEquals( self.gist.files[ "fail_github.py" ].size, 1636 ) - self.assertEquals( self.gist.files[ "fail_github.py" ].filename, "fail_github.py" ) - self.assertEquals( self.gist.files[ "fail_github.py" ].language, "Python" ) - self.assertEquals( self.gist.files[ "fail_github.py" ].content, 'import httplib\nimport base64\nimport json\n\nlogin = ""\npassword = ""\norgName = ""\nrepoName = "FailGithubApi"\n\ndef doRequest( verb, url, input ):\n input = json.dumps( input )\n cnx = httplib.HTTPSConnection( "api.github.com", strict = True )\n cnx.request( verb, url, input, { "Authorization" : "Basic " + base64.b64encode( login + ":" + password ).replace( \'\\n\', \'\' ) } )\n response = cnx.getresponse()\n status = response.status\n output = response.read()\n cnx.close()\n print verb, url, input, "=>", status, output\n print\n if status < 200 or status >= 300:\n exit( 1 )\n return json.loads( output )\n\n# Create a repo\ndoRequest( "POST", "/user/repos", { "name": repoName } )\n\n# Create a blob, a tree, a commit and the master branch\nb = doRequest(\n "POST", "/repos/%s/%s/git/blobs" % ( login, repoName ),\n { "content": "Content of the blob", "encoding": "latin1" }\n)\nt = doRequest(\n "POST", "/repos/%s/%s/git/trees" % ( login, repoName ),\n { "tree" : [ { "path": "foo.bar", "type": "blob", "mode": "100644", "sha": b["sha"] } ] }\n)\nc = doRequest(\n "POST", "/repos/%s/%s/git/commits" % ( login, repoName ),\n { "parents": [], "message": "Message of the commit", "tree": t["sha"] }\n)\ndoRequest(\n "POST", "/repos/%s/%s/git/refs" % ( login, repoName ),\n { "ref": "refs/heads/master", "sha": c["sha"] }\n)\n\n# Fork the repo\ndoRequest( "POST", "/repos/%s/%s/forks?org=%s" % ( login, repoName, orgName ), None )\n\n# Create a new blob => BOOM error 500\ndoRequest(\n "POST", "/repos/%s/%s/git/blobs" % ( orgName, repoName ),\n { "content": "Content of the new blob", "encoding": "latin1" }\n)\n' ) - self.assertEquals( self.gist.files[ "fail_github.py" ].raw_url, "https://gist.github.com/raw/2729810/2fb3aa84e0efa50dc0f4c18b5df5b7b9ab27076b/fail_github.py" ) - self.assertEquals( self.gist.forks, [] ) - self.assertEquals( self.gist.git_pull_url, "git://gist.github.com/2729810.git" ) - self.assertEquals( self.gist.git_push_url, "git@gist.github.com:2729810.git" ) - self.assertEquals( len( self.gist.history ), 1 ) - self.assertEquals( self.gist.history[ 0 ].change_status.additions, 52 ) - self.assertEquals( self.gist.history[ 0 ].change_status.deletions, 0 ) - self.assertEquals( self.gist.history[ 0 ].change_status.total, 52 ) - self.assertEquals( self.gist.history[ 0 ].committed_at, datetime.datetime( 2012, 2, 29, 16, 47, 12 ) ) - self.assertEquals( self.gist.history[ 0 ].url, "https://api.github.com/gists/2729810/a40de483e42ba33bda308371c0ef8383db73be9e" ) - self.assertEquals( self.gist.history[ 0 ].user.login, "jacquev6" ) - self.assertEquals( self.gist.history[ 0 ].version, "a40de483e42ba33bda308371c0ef8383db73be9e" ) - self.assertEquals( self.gist.html_url, "https://gist.github.com/2729810" ) - self.assertEquals( self.gist.id, "2729810" ) - self.assertEquals( self.gist.public, True ) - self.assertEquals( self.gist.updated_at, datetime.datetime( 2012, 2, 29, 16, 47, 12 ) ) - self.assertEquals( self.gist.url, "https://api.github.com/gists/2729810" ) - self.assertEquals( self.gist.user.login, "jacquev6" ) - - def testEditWithoutParameters( self ): - self.gist.edit() - self.assertEquals( self.gist.description, "Gist created by PyGithub" ) - self.assertEquals( self.gist.updated_at, datetime.datetime( 2012, 5, 19, 7, 0, 58 ) ) - - def testEditWithAllParameters( self ): - self.gist.edit( "Description edited by PyGithub", { "barbaz.txt": github.InputFileContent( "File also created by PyGithub" ) } ) - self.assertEquals( self.gist.description, "Description edited by PyGithub" ) - self.assertEquals( self.gist.updated_at, datetime.datetime( 2012, 5, 19, 7, 6, 10 ) ) - self.assertEquals( self.gist.files.keys(), [ "foobar.txt", "barbaz.txt" ] ) - - def testCreateComment( self ): - comment = self.gist.create_comment( "Comment created by PyGithub" ) - self.assertEquals( comment.id, 323629 ) - - def testGetComments( self ): - self.assertListKeyEqual( self.gist.get_comments(), lambda c: c.id, [ 323637 ] ) - - def testStarring( self ): - self.assertFalse( self.gist.is_starred() ) - self.gist.set_starred() - self.assertTrue( self.gist.is_starred() ) - self.gist.reset_starred() - self.assertFalse( self.gist.is_starred() ) - - def testFork( self ): - gist = self.g.get_gist( "2729818" ) # Random gist - myGist = gist.create_fork() - self.assertEquals( myGist.id, "2729865" ) - self.assertEquals( myGist.fork_of, None ) # WTF - sameGist = self.g.get_gist( "2729865" ) - self.assertEquals( sameGist.fork_of.id, "2729818" ) - - def testDelete( self ): - self.gist.delete() diff --git a/test/GistComment.py b/test/GistComment.py deleted file mode 100644 index 4fb3122b..00000000 --- a/test/GistComment.py +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -import datetime - -class GistComment( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.comment = self.g.get_gist( "2729810" ).get_comment( 323629 ) - - def testAttributes( self ): - self.assertEquals( self.comment.body, "Comment created by PyGithub" ) - self.assertEquals( self.comment.created_at, datetime.datetime( 2012, 5, 19, 7, 7, 57 ) ) - self.assertEquals( self.comment.id, 323629 ) - self.assertEquals( self.comment.updated_at, datetime.datetime( 2012, 5, 19, 7, 7, 57 ) ) - self.assertEquals( self.comment.url, "https://api.github.com/gists/comments/323629" ) - self.assertEquals( self.comment.user.login, "jacquev6" ) - - def testEdit( self ): - self.comment.edit( "Comment edited by PyGithub" ) - self.assertEquals( self.comment.body, "Comment edited by PyGithub" ) - self.assertEquals( self.comment.updated_at, datetime.datetime( 2012, 5, 19, 7, 12, 32 ) ) - - def testDelete( self ): - self.comment.delete() diff --git a/test/GitBlob.py b/test/GitBlob.py deleted file mode 100644 index 64ef55d3..00000000 --- a/test/GitBlob.py +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -class GitBlob( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.blob = self.g.get_user().get_repo( "PyGithub" ).get_git_blob( "53bce9fa919b4544e67275089b3ec5b44be20667" ) - - def testAttributes( self ): - self.assertTrue( self.blob.content.startswith( "IyEvdXNyL2Jpbi9lbnYgcHl0aG9uCgpmcm9tIGRpc3R1dGlscy5jb3JlIGlt\ncG9ydCBzZXR1cAppbXBvcnQgdGV4dHdyYXAKCnNldHVwKAogICAgbmFtZSA9\n" ) ) - self.assertTrue( self.blob.content.endswith( "Z3JhbW1pbmcgTGFuZ3VhZ2UgOjogUHl0aG9uIiwKICAgICAgICAiVG9waWMg\nOjogU29mdHdhcmUgRGV2ZWxvcG1lbnQiLAogICAgXSwKKQo=\n" ) ) - self.assertEqual( len( self.blob.content ), 1757 ) - self.assertEqual( self.blob.encoding, "base64" ) - self.assertEqual( self.blob.size, 1295 ) - self.assertEqual( self.blob.sha, "53bce9fa919b4544e67275089b3ec5b44be20667" ) - self.assertEqual( self.blob.url, "https://api.github.com/repos/jacquev6/PyGithub/git/blobs/53bce9fa919b4544e67275089b3ec5b44be20667" ) diff --git a/test/GitCommit.py b/test/GitCommit.py deleted file mode 100644 index f85a667e..00000000 --- a/test/GitCommit.py +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import datetime - -import Framework - -class GitCommit( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.commit = self.g.get_user().get_repo( "PyGithub" ).get_git_commit( "4303c5b90e2216d927155e9609436ccb8984c495" ) - - def testAttributes( self ): - self.assertEqual( self.commit.author.name, "Vincent Jacques" ) - self.assertEqual( self.commit.author.email, "vincent@vincent-jacques.net" ) - self.assertEqual( self.commit.author.date, datetime.datetime( 2012, 4, 17, 17, 55, 16 ) ) - self.assertEqual( self.commit.committer.name, "Vincent Jacques" ) - self.assertEqual( self.commit.committer.email, "vincent@vincent-jacques.net" ) - self.assertEqual( self.commit.committer.date, datetime.datetime( 2012, 4, 17, 17, 55, 16 ) ) - self.assertEqual( self.commit.message, "Merge branch 'develop'\n" ) - self.assertEqual( len( self.commit.parents ), 2 ) - self.assertEqual( self.commit.parents[ 0 ].sha, "936f4a97f1a86392637ec002bbf89ff036a5062d" ) - self.assertEqual( self.commit.parents[ 1 ].sha, "2a7e80e6421c5d4d201d60619068dea6bae612cb" ) - self.assertEqual( self.commit.sha, "4303c5b90e2216d927155e9609436ccb8984c495" ) - self.assertEqual( self.commit.tree.sha, "f492784d8ca837779650d1fb406a1a3587a764ad" ) - self.assertEqual( self.commit.url, "https://api.github.com/repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495" ) diff --git a/test/GitRef.py b/test/GitRef.py deleted file mode 100644 index df53f017..00000000 --- a/test/GitRef.py +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -class GitRef( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.ref = self.g.get_user().get_repo( "PyGithub" ).get_git_ref( "refs/heads/BranchCreatedByPyGithub" ) - - def testAttributes( self ): - self.assertEqual( self.ref.object.sha, "1292bf0e22c796e91cc3d6e24b544aece8c21f2a" ) - self.assertEqual( self.ref.object.type, "commit" ) - self.assertEqual( self.ref.object.url, "https://api.github.com/repos/jacquev6/PyGithub/git/commits/1292bf0e22c796e91cc3d6e24b544aece8c21f2a" ) - self.assertEqual( self.ref.ref, "refs/heads/BranchCreatedByPyGithub" ) - self.assertEqual( self.ref.url, "https://api.github.com/repos/jacquev6/PyGithub/git/refs/heads/BranchCreatedByPyGithub" ) - - def testEdit( self ): - self.ref.edit( "04cde900a0775b51f762735637bd30de392a2793" ) - - def testEditWithForce( self ): - self.ref.edit( "4303c5b90e2216d927155e9609436ccb8984c495", force = True ) - - def testDelete( self ): - self.ref.delete() diff --git a/test/GitTag.py b/test/GitTag.py deleted file mode 100644 index f7fb6f84..00000000 --- a/test/GitTag.py +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import datetime - -import Framework - -class GitTag( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.tag = self.g.get_user().get_repo( "PyGithub" ).get_git_tag( "f5f37322407b02a80de4526ad88d5f188977bc3c" ) - - def testAttributes( self ): - self.assertEqual( self.tag.message, "Version 0.6\n" ) - self.assertEqual( self.tag.object.sha, "4303c5b90e2216d927155e9609436ccb8984c495" ) - self.assertEqual( self.tag.object.type, "commit" ) - self.assertEqual( self.tag.object.url, "https://api.github.com/repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495" ) - self.assertEqual( self.tag.sha, "f5f37322407b02a80de4526ad88d5f188977bc3c" ) - self.assertEqual( self.tag.tag, "v0.6" ) - self.assertEqual( self.tag.tagger.date, datetime.datetime( 2012, 5, 10, 18, 14, 15 ) ) - self.assertEqual( self.tag.tagger.email, "vincent@vincent-jacques.net" ) - self.assertEqual( self.tag.tagger.name, "Vincent Jacques" ) - self.assertEqual( self.tag.url, "https://api.github.com/repos/jacquev6/PyGithub/git/tags/f5f37322407b02a80de4526ad88d5f188977bc3c" ) diff --git a/test/GitTree.py b/test/GitTree.py deleted file mode 100644 index f660125c..00000000 --- a/test/GitTree.py +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -class GitTree( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.tree = self.g.get_user().get_repo( "PyGithub" ).get_git_tree( "f492784d8ca837779650d1fb406a1a3587a764ad" ) - - def testAttributes( self ): - self.assertEqual( self.tree.sha, "f492784d8ca837779650d1fb406a1a3587a764ad" ) - self.assertEqual( len( self.tree.tree ), 11 ) - self.assertEqual( self.tree.tree[ 0 ].mode, "100644" ) - self.assertEqual( self.tree.tree[ 0 ].path, ".gitignore" ) - self.assertEqual( self.tree.tree[ 0 ].sha, "8a9af1462c3f4e3358315c2d2e6ef1e7334c59dd" ) - self.assertEqual( self.tree.tree[ 0 ].size, 53 ) - self.assertEqual( self.tree.tree[ 0 ].type, "blob" ) - self.assertEqual( self.tree.tree[ 0 ].url, "https://api.github.com/repos/jacquev6/PyGithub/git/blobs/8a9af1462c3f4e3358315c2d2e6ef1e7334c59dd" ) - self.assertEqual( self.tree.tree[ 6 ].mode, "040000" ) - self.assertEqual( self.tree.tree[ 6 ].path, "ReplayDataForIntegrationTest" ) - self.assertEqual( self.tree.tree[ 6 ].sha, "60b4602b2c2070246c5df078fb7a5150b45815eb" ) - self.assertEqual( self.tree.tree[ 6 ].size, None ) - self.assertEqual( self.tree.tree[ 6 ].type, "tree" ) - self.assertEqual( self.tree.tree[ 6 ].url, "https://api.github.com/repos/jacquev6/PyGithub/git/trees/60b4602b2c2070246c5df078fb7a5150b45815eb" ) - self.assertEqual( self.tree.url, "https://api.github.com/repos/jacquev6/PyGithub/git/trees/f492784d8ca837779650d1fb406a1a3587a764ad" ) diff --git a/test/Github.py b/test/Github.py deleted file mode 100644 index 79bb107e..00000000 --- a/test/Github.py +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import datetime - -import Framework - -class Github( Framework.TestCase ): - def testGetGists( self ): - self.assertListKeyBegin( self.g.get_gists(), lambda g: g.id, [ "2729695", "2729656", "2729597", "2729584", "2729569", "2729554", "2729543", "2729537", "2729536", "2729533", "2729525", "2729522", "2729519", "2729515", "2729506", "2729487", "2729484", "2729482", "2729441", "2729432", "2729420", "2729398", "2729372", "2729371", "2729351", "2729346", "2729316", "2729304", "2729296", "2729276", "2729272", "2729265", "2729195", "2729160", "2729143", "2729127", "2729119", "2729113", "2729103", "2729069", "2729059", "2729051", "2729029", "2729027", "2729026", "2729022", "2729002", "2728985", "2728979", "2728964", "2728937", "2728933", "2728884", "2728869", "2728866", "2728855", "2728854", "2728853", "2728846", "2728825", "2728814", "2728813", "2728812", "2728805", "2728802", "2728800", "2728798", "2728797", "2728796", "2728793", "2728758", "2728754", "2728751", "2728748", "2728721", "2728716", "2728715", "2728705", "2728701", "2728699", "2728697", "2728688", "2728683", "2728677", "2728649", "2728640", "2728625", "2728620", "2728615", "2728614", "2728565", "2728564", "2728554", "2728523", "2728519", "2728511", "2728497", "2728496", "2728495", "2728487" ] ) - - def testLegacySearchRepos( self ): - repos = self.g.legacy_search_repos( "github api v3" ) - self.assertListKeyBegin( repos, lambda r: r.name, [ "octokit", "github-v3-api", "github_v3_api" ] ) - self.assertEqual( repos[ 0 ].full_name, "pengwynn/octokit" ) - - # Attributes retrieved from legacy API without lazy completion call - self.assertEqual( repos[ 1 ].created_at, datetime.datetime( 2011, 6, 23, 22, 52, 33 ) ) - self.assertEqual( repos[ 1 ].name, "github-v3-api" ) - self.assertEqual( repos[ 1 ].watchers, 35 ) - self.assertEqual( repos[ 1 ].has_downloads, True ) - self.assertEqual( repos[ 3 ].homepage, "http://peter-murach.github.com/github" ) - self.assertEqual( repos[ 1 ].url, "/repos/jwilger/github-v3-api" ) - self.assertEqual( repos[ 1 ].fork, False ) - self.assertEqual( repos[ 1 ].has_issues, True ) - self.assertEqual( repos[ 1 ].has_wiki, False ) - self.assertEqual( repos[ 1 ].forks, 13 ) - self.assertEqual( repos[ 1 ].size, 212 ) - self.assertEqual( repos[ 1 ].private, False ) - self.assertEqual( repos[ 1 ].open_issues, 2 ) - self.assertEqual( repos[ 3 ].pushed_at, datetime.datetime( 2012, 6, 28, 21, 26, 31 ) ) - self.assertEqual( repos[ 1 ].description, "Ruby Client for the GitHub v3 API" ) - self.assertEqual( repos[ 1 ].language, "Ruby" ) - self.assertEqual( repos[ 1 ].owner.login, "jwilger" ) - self.assertEqual( repos[ 1 ].owner.url, "/users/jwilger" ) - - def testLegacySearchReposPagination( self ): - repos = self.g.legacy_search_repos( "document" ) - self.assertListKeyBegin( repos, lambda r: r.name, [ "git", "nimbus", "kss", "sstoolkit", "lawnchair", "appledoc", "jQ.Mobi", "ipython", "mongoengine", "ravendb", "substance", "symfony-docs", "JavaScript-Garden", "DocSets-for-iOS", "yard", "phpDocumentor2", "phpsh", "Tangle", "Ingredients", "documentjs", "xhp", "couchdb-lucene", "dox", "magento2", "javascriptmvc", "FastPdfKit", "roar", "DocumentUp", "NoRM", "jsdoc", "tagger", "mongodb-csharp", "php-github-api", "beautiful-docs", "mongodb-odm", "iodocs", "seesaw", "bcx-api", "developer.github.com", "amqp", "docsplit", "pycco", "standards-and-practices", "tidy-html5", "redis-doc", "tomdoc", "docs", "flourish", "userguide", "swagger-ui", "rfc", "Weasel-Diesel", "yuidoc", "apigen", "document-viewer", "develop.github.com", "Shanty-Mongo", "PTShowcaseViewController", "gravatar_image_tag", "api-wow-docs", "mongoid-tree", "safari-json-formatter", "mayan", "orm-documentation", "jsfiddle-docs-alpha", "core", "documentcloud", "flexible-nav", "writeCapture", "readium", "xmldocument", "Documentation-Examples", "grails-doc", "stdeb", "aws-autoscaling", "voteable_mongo", "review", "spreadsheet_on_rails", "UKSyntaxColoredTextDocument", "mandango", "bdoc", "Documentation", "documents.com", "rghost", "ticket_mule", "vendo", "khan-api", "spring-data-document-examples", "rspec_api_documentation", "axlsx", "phpdox", "documentation", "Sami", "innershiv", "doxyclean", "documents", "rvm-site", "jqapi", "documentation", "hadoopy", "VichUploaderBundle", "pdoc", "documentation", "wii-js", "oss-docs", "scala-maven-plugin", "Documents", "documenter", "behemoth", "documentation", "documentation", "propelorm.github.com", "Kobold2D", "AutoObjectDocumentation", "php-mongodb-admin", "django-mongokit", "puppet-docs", "docs", "Document", "vendorer", "symfony1-docs", "shocco", "documentation", "jog", "docs", "documentation", "documentation", "documentation", "documentation", "Documentation", "documentation", "documentation", "phpunit-documentation", "ADCtheme", "NelmioApiDocBundle", "iCloud-Singleton-CloudMe", "Documentation", "document", "document_mapper", "heroku-docs", "couchdb-odm", "documentation", "documentation", "document", "documentation", "NanoStore", "documentation", "Documentation", "documentation", "Documentation", "documentation", "document", "documentation", "documentation", "Documentation", "Documentation", "grendel", "ceylon-compiler", "mbtiles-spec", "documentation", "documents", "documents", "Documents", "Documentation", "documentation", "Documentation", "documentation", "documents", "Documentation", "documentation", "documentation", "documents", "Documentation", "documentation", "documenter", "documentation", "documents", "Documents", "documents", "documents", "documentation", "Document", "document", "rdoc", "mongoid_token", "travis-ci.github.com", "Documents", "Documents", "documents", "Document", "Documentation", "documents", "Documents", "Documentation", "documents", "documents", "documents", "documentation", "Documents", "Document", "documents", "documents", "Documentation", "Documentation", "Document", "documents", "Documents", "Documents", "Documentation", "Documents", "documents", "Documents", "document", "documents", "Documentation", "Documents", "documents", "documents", "Documents", "documents", "Documentation", "documentation", "Document", "Documents", "documents", "documents", "documents", "Documentation", "Documentation", "Documents", "Documents", "Documents", "Documenter", "document", "Documentation", "Documents", "Documents", "documentation", "documentation", "Document", "Documents", "Documentation", "Documentation", "Documents", "documents", "Documents", "document", "documentation", "Documents", "documentation", "documentation", "documentation", "Documentation", "Documents", "Documents", "documentation", "Documents", "Documents", "documentation", "documentation", "documents", "Documentation", "documents", "documentation", "Documentation", "Documents", "documentation", "documentation", "documents", "documentation", "Umbraco5Docs", "documents", "Documents", "Documentation", "documents", "document", "documents", "document", "documents", "documentation", "Documents", "documents", "document", "Documents", "Documentation", "Documentation", "documentation", "Documentation", "document", "documentation", "documents", "documents", "Documentations", "document", "documentation", "Documentation", "Document", "Documents", "Documents", "Document" ] ) - - def testLegacySearchReposExplicitPagination( self ): - repos = self.g.legacy_search_repos( "python" ) - self.assertEqual( [ r.name for r in repos.get_page( 4 ) ], [ "assetic", "cartodb", "cuisine", "gae-sessions", "geoalchemy2", "Multicorn", "wmfr-timeline", "redis-rdb-tools", "applet-workflows", "TweetBuff", "groovy-core", "StarTrekGame", "Nuevo", "Cupid", "node-sqlserver", "Magnet2Torrent", "GroundControl", "mock-django", "4bit", "mock-django", "Fabulous", "SFML", "pydicas", "flixel", "up", "mongrel2", "SimpleHTTPServerJs", "ultimos", "Archipel", "JSbooks", "nova", "nodebox", "simplehttp", "dablooms", "solarized", "landslide", "jQuery-File-Upload", "jQuery-File-Upload", "jQuery-File-Upload", "password-manager", "electrum", "twitter_nlp", "djangbone", "pyxfst", "node-gyp", "flare", "www.gittip.com", "wymeditor", "Kokobox", "MyCQ", "runwalk", "git-sweep", "HPCPythonSC2012", "sundown", "node2dm", "statirator", "fantastic-futures", "chainsaw", "itcursos-gerenciador-tarefas", "TideSDK", "genmaybot", "melpa", "ConnectedWire", "tarantool", "anserindicus_sn", "luvit", "Minecraft-Overviewer", "Iconic", "pyist.net", "wikibok", "mejorenvo-scraper", "NewsBlur", "SocketRocket", "spf13-vim", "IWantToWorkAtGloboCom", "ruby-style-guide", "aery32-refguide", "fafsite", "compsense_demo", "enaml", "mpi4py", "fi.pycon.org", "scikits-image", "scikits-image", "uni", "mako.vim", "mako.vim", "slumber", "de-composer", "nvm", "helloshopply", "Alianza", "vimfiles", "socorro-crashstats", "menu", "analytics", "elFinder", "riak_wiki", "livestreamer", "git-goggles" ] ) - - def testLegacySearchReposWithLanguage( self ): - repos = self.g.legacy_search_repos( "document", language = "Python" ) - self.assertListKeyBegin( repos, lambda r: r.name, [ "ipython", "mongoengine", "tagger" ] ) - self.assertEqual( repos[ 0 ].full_name, "ipython/ipython" ) - - def testLegacySearchUsers( self ): - users = self.g.legacy_search_users( "vincent" ) - self.assertListKeyBegin( users, lambda u: u.login, [ "nvie", "obra", "lusis" ] ) - - # Attributes retrieved from legacy API without lazy completion call - self.assertEqual( users[ 0 ].gravatar_id, "c5a7f21b46df698f3db31c37ed0cf55a" ) - self.assertEqual( users[ 0 ].name, "Vincent Driessen" ) - self.assertEqual( users[ 0 ].created_at, datetime.datetime( 2009, 5, 12, 21, 19, 38 ) ) - self.assertEqual( users[ 0 ].location, "Netherlands" ) - self.assertEqual( users[ 0 ].followers, 310 ) - self.assertEqual( users[ 0 ].public_repos, 63 ) - self.assertEqual( users[ 0 ].login, "nvie" ) - - def testLegacySearchUsersPagination( self ): - self.assertEqual( len( list( self.g.legacy_search_users( "Lucy" ) ) ), 146 ) - - def testLegacySearchUsersExplicitPagination( self ): - users = self.g.legacy_search_users( "Lucy" ) - self.assertEqual( [ u.login for u in users.get_page( 1 ) ], [ "lucievh", "lucyim", "Lucief", "RevolverUpstairs", "seriousprogramming", "reicul", "davincidubai", "LucianaNascimentodoPrado", "lucia-huenchunao", "kraji20", "Lucywolo", "Luciel", "sunnysummer", "elush", "oprealuci", "Flika", "lsher", "datadrivenjournalism", "nill2020", "doobi", "lucilu", "deldeldel", "lucianacocca", "lucyli-sfdc", "lucysatchell", "UBM", "kolousek", "lucyzhang", "lmegia", "luisolivo", "Lucyzhen", "Luhzinha", "beautifly", "lucybm96", "BuonocoreL", "lucywilliams", "ZxOxZ", "Motwinb", "johnlucy", "Aquanimation", "alaltaieri", "lucylin", "lucychambers", "JuanSesma", "cdwwebware", "ZachWills" ] ) - - def testLegacySearchUserByEmail( self ): - user = self.g.legacy_search_user_by_email( "vincent@vincent-jacques.net" ) - self.assertEqual( user.login, "jacquev6" ) - self.assertEqual( user.followers, 13 ) - - def testGetHooks( self ): - hooks = self.g.get_hooks() - hook = hooks[ 0 ] - self.assertEqual( hook.name, "activecollab" ) - self.assertEqual( hook.supported_events, [ "push" ] ) - self.assertEqual( hook.events, [ "push" ] ) - self.assertEqual( hook.schema, [ [ "string", "url" ], [ "string", "token" ], [ "string", "project_id" ], [ "string", "milestone_id" ], [ "string", "category_id" ] ] ) diff --git a/test/Hook.py b/test/Hook.py deleted file mode 100644 index f3b3c8b3..00000000 --- a/test/Hook.py +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -import datetime - -class Hook( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.hook = self.g.get_user().get_repo( "PyGithub" ).get_hook( 257993 ) - - def testAttributes( self ): - self.assertEqual( self.hook.active, True ) # WTF - self.assertEqual( self.hook.config, { "url": "http://foobar.com" } ) - self.assertEqual( self.hook.created_at, datetime.datetime( 2012, 5, 19, 6, 1, 45 ) ) - self.assertEqual( self.hook.events, [ "push" ] ) - self.assertEqual( self.hook.id, 257993 ) - self.assertEqual( self.hook.last_response.status, "ok" ) - self.assertEqual( self.hook.last_response.message, "OK" ) - self.assertEqual( self.hook.last_response.code, 200 ) - self.assertEqual( self.hook.name, "web" ) - self.assertEqual( self.hook.updated_at, datetime.datetime( 2012, 5, 29, 18, 49, 47 ) ) - self.assertEqual( self.hook.url, "https://api.github.com/repos/jacquev6/PyGithub/hooks/257993" ) - - def testEditWithMinimalParameters( self ): - self.hook.edit( "web", { "url": "http://foobar.com/hook" } ) - self.assertEqual( self.hook.config, { "url": "http://foobar.com/hook" } ) - self.assertEqual( self.hook.updated_at, datetime.datetime( 2012, 5, 19, 5, 8, 16 ) ) - - def testDelete( self ): - self.hook.delete() - - def testTest( self ): - self.hook.test() # This does not update attributes of hook - - def testEditWithAllParameters( self ): - self.hook.edit( "web", { "url": "http://foobar.com" }, events = [ "fork", "push" ] ) - self.assertEqual( self.hook.events, [ "fork", "push" ] ) - self.hook.edit( "web", { "url": "http://foobar.com" }, add_events = [ "push" ] ) - self.assertEqual( self.hook.events, [ "fork", "push" ] ) - self.hook.edit( "web", { "url": "http://foobar.com" }, remove_events = [ "fork" ] ) - self.assertEqual( self.hook.events, [ "push" ] ) - self.hook.edit( "web", { "url": "http://foobar.com" }, active = True ) - self.assertEqual( self.hook.active, True ) diff --git a/test/Issue.py b/test/Issue.py deleted file mode 100644 index 6ee4871d..00000000 --- a/test/Issue.py +++ /dev/null @@ -1,99 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -import datetime - -class Issue( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.repo = self.g.get_user().get_repo( "PyGithub" ) - self.issue = self.repo.get_issue( 28 ) - - def testAttributes( self ): - self.assertEqual( self.issue.assignee.login, "jacquev6" ) - self.assertEqual( self.issue.body, "Body edited by PyGithub" ) - self.assertEqual( self.issue.closed_at, datetime.datetime( 2012, 5, 26, 14, 59, 33 ) ) - self.assertEqual( self.issue.closed_by.login, "jacquev6" ) - self.assertEqual( self.issue.comments, 0 ) - self.assertEqual( self.issue.created_at, datetime.datetime( 2012, 5, 19, 10, 38, 23 ) ) - self.assertEqual( self.issue.html_url, "https://github.com/jacquev6/PyGithub/issues/28" ) - self.assertEqual( self.issue.id, 4653757 ) - self.assertListKeyEqual( self.issue.labels, lambda l: l.name, [ "Bug", "Project management", "Question" ] ) - self.assertEqual( self.issue.milestone.title, "Version 0.4" ) - self.assertEqual( self.issue.number, 28 ) - self.assertEqual( self.issue.pull_request.diff_url, None ) - self.assertEqual( self.issue.pull_request.patch_url, None ) - self.assertEqual( self.issue.pull_request.html_url, None ) - self.assertEqual( self.issue.state, "closed" ) - self.assertEqual( self.issue.title, "Issue created by PyGithub" ) - self.assertEqual( self.issue.updated_at, datetime.datetime( 2012, 5, 26, 14, 59, 33 ) ) - self.assertEqual( self.issue.url, "https://api.github.com/repos/jacquev6/PyGithub/issues/28" ) - self.assertEqual( self.issue.user.login, "jacquev6" ) - - def testEditWithoutParameters( self ): - self.issue.edit() - - def testEditWithAllParameters( self ): - user = self.g.get_user( "jacquev6" ) - milestone = self.repo.get_milestone( 2 ) - self.issue.edit( "Title edited by PyGithub", "Body edited by PyGithub", user, "open", milestone, [ "Bug" ] ) - self.assertEqual( self.issue.assignee.login, "jacquev6" ) - self.assertEqual( self.issue.body, "Body edited by PyGithub" ) - self.assertEqual( self.issue.state, "open" ) - self.assertEqual( self.issue.title, "Title edited by PyGithub" ) - self.assertListKeyEqual( self.issue.labels, lambda l: l.name, [ "Bug" ] ) - - def testEditResetMilestone( self ): - self.assertEqual( self.issue.milestone.title, "Version 0.4" ) - self.issue.edit( milestone = None ) - self.assertEqual( self.issue.milestone, None ) - - def testEditResetAssignee( self ): - self.assertEqual( self.issue.assignee.login, "jacquev6" ) - self.issue.edit( assignee = None ) - self.assertEqual( self.issue.assignee, None ) - - def testCreateComment( self ): - comment = self.issue.create_comment( "Comment created by PyGithub" ) - self.assertEqual( comment.id, 5808311 ) - - def testGetComments( self ): - self.assertListKeyEqual( self.issue.get_comments(), lambda c: c.user.login, [ "jacquev6", "roskakori" ] ) - - def testGetEvents( self ): - self.assertListKeyEqual( self.issue.get_events(), lambda e: e.id, [ 15819975, 15820048 ] ) - - def testGetLabels( self ): - self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [ "Bug", "Project management", "Question" ] ) - - def testAddAndRemoveLabels( self ): - bug = self.repo.get_label( "Bug" ) - question = self.repo.get_label( "Question" ) - self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [ "Bug", "Project management", "Question" ] ) - self.issue.remove_from_labels( bug ) - self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [ "Project management", "Question" ] ) - self.issue.remove_from_labels( question ) - self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [ "Project management" ] ) - self.issue.add_to_labels( bug, question ) - self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [ "Bug", "Project management", "Question" ] ) - - def testDeleteAndSetLabels( self ): - bug = self.repo.get_label( "Bug" ) - question = self.repo.get_label( "Question" ) - self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [ "Bug", "Project management", "Question" ] ) - self.issue.delete_labels() - self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [] ) - self.issue.set_labels( bug, question ) - self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [ "Bug", "Question" ] ) diff --git a/test/Issue50.py b/test/Issue50.py deleted file mode 100644 index e4dbf492..00000000 --- a/test/Issue50.py +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import github - -import Framework - -class Issue50( Framework.TestCase ): # https://github.com/jacquev6/PyGithub/issues/50 - def setUp( self ): - Framework.TestCase.setUp( self ) - self.repo = self.g.get_user().get_repo( "PyGithub" ) - self.issue = self.repo.get_issue( 50 ) - self.labelName = "Label with spaces and strange characters (&*#$)" - - def testCreateLabel( self ): - label = self.repo.create_label( self.labelName, "ffff00" ) - self.assertEqual( label.name, self.labelName ) - - def testGetLabel( self ): - label = self.repo.get_label( self.labelName ) - self.assertEqual( label.name, self.labelName ) - - def testGetLabels( self ): - self.assertListKeyEqual( self.repo.get_labels(), lambda l: l.name, [ "Refactoring", "Public interface", "Functionalities", "Project management", "Bug", "Question", "RequestedByUser", self.labelName ] ) - - def testAddLabelToIssue( self ): - self.issue.add_to_labels( self.repo.get_label( self.labelName ) ) - - def testRemoveLabelFromIssue( self ): - self.issue.remove_from_labels( self.repo.get_label( self.labelName ) ) - - def testSetIssueLabels( self ): - self.issue.set_labels( self.repo.get_label( "Bug" ), self.repo.get_label( "RequestedByUser" ), self.repo.get_label( self.labelName ) ) - - def testIssueLabels( self ): - self.assertListKeyEqual( self.issue.labels, lambda l: l.name, [ "Bug", self.labelName, "RequestedByUser" ] ) - - def testIssueGetLabels( self ): - self.assertListKeyEqual( self.issue.get_labels(), lambda l: l.name, [ "Bug", self.labelName, "RequestedByUser" ] ) - - def testGetIssuesWithLabel( self ): - self.assertListKeyEqual( self.repo.get_issues( labels = [ self.repo.get_label( self.labelName ) ] ), lambda i: i.number, [ 52, 50 ] ) - - def testCreateIssueWithLabel( self ): - issue = self.repo.create_issue( "Issue created by PyGithub to test issue #50", labels = [ self.repo.get_label( self.labelName ) ] ) - self.assertListKeyEqual( issue.labels, lambda l: l.name, [ self.labelName ] ) - self.assertEqual( issue.number, 52 ) diff --git a/test/Issue80.py b/test/Issue80.py deleted file mode 100644 index b51841bf..00000000 --- a/test/Issue80.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import github - -import Framework - -class Issue80( Framework.BasicTestCase ): # https://github.com/jacquev6/PyGithub/issues/80 - def testIgnoreHttpsFromGithubEnterprise( self ): - g = github.Github( self.login, self.password, base_url = "http://my.enterprise.com/some/prefix" ) # http here - org = g.get_organization( "BeaverSoftware" ) - self.assertEqual( org.url, "https://my.enterprise.com/some/prefix/orgs/BeaverSoftware" ) # https returned - self.assertListKeyEqual( org.get_repos(), lambda r: r.name, [ "FatherBeaver", "TestPyGithub" ] ) # But still http in second request based on org.url - - def testIgnoreHttpsFromGithubEnterpriseWithPort( self ): - g = github.Github( self.login, self.password, base_url = "http://my.enterprise.com:1234/some/prefix" ) # http here - org = g.get_organization( "BeaverSoftware" ) - self.assertEqual( org.url, "https://my.enterprise.com:1234/some/prefix/orgs/BeaverSoftware" ) # https returned - self.assertListKeyEqual( org.get_repos(), lambda r: r.name, [ "FatherBeaver", "TestPyGithub" ] ) # But still http in second request based on org.url diff --git a/test/IssueComment.py b/test/IssueComment.py deleted file mode 100644 index c919928c..00000000 --- a/test/IssueComment.py +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -import datetime - -class IssueComment( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.comment = self.g.get_user().get_repo( "PyGithub" ).get_issue( 28 ).get_comment( 5808311 ) - - def testAttributes( self ): - self.assertEqual( self.comment.body, "Comment created by PyGithub" ) - self.assertEqual( self.comment.created_at, datetime.datetime( 2012, 5, 20, 11, 46, 42 ) ) - self.assertEqual( self.comment.id, 5808311 ) - self.assertEqual( self.comment.updated_at, datetime.datetime( 2012, 5, 20, 11, 46, 42 ) ) - self.assertEqual( self.comment.url, "https://api.github.com/repos/jacquev6/PyGithub/issues/comments/5808311" ) - self.assertEqual( self.comment.user.login, "jacquev6" ) - - def testEdit( self ): - self.comment.edit( "Comment edited by PyGithub" ) - self.assertEqual( self.comment.body, "Comment edited by PyGithub" ) - self.assertEqual( self.comment.updated_at, datetime.datetime( 2012, 5, 20, 11, 53, 59 ) ) - - def testDelete( self ): - self.comment.delete() diff --git a/test/IssueEvent.py b/test/IssueEvent.py deleted file mode 100644 index 200795f6..00000000 --- a/test/IssueEvent.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -import datetime - -class IssueEvent( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.event = self.g.get_user().get_repo( "PyGithub" ).get_issues_event( 16348656 ) - - def testAttributes( self ): - self.assertEqual( self.event.actor.login, "jacquev6" ) - self.assertEqual( self.event.commit_id, "ed866fc43833802ab553e5ff8581c81bb00dd433" ) - self.assertEqual( self.event.created_at, datetime.datetime( 2012, 5, 27, 7, 29, 25 ) ) - self.assertEqual( self.event.event, "referenced" ) - self.assertEqual( self.event.id, 16348656 ) - self.assertEqual( self.event.issue.number, 30 ) - self.assertEqual( self.event.url, "https://api.github.com/repos/jacquev6/PyGithub/issues/events/16348656" ) diff --git a/test/Milestone.py b/test/Milestone.py deleted file mode 100644 index 9433e2b5..00000000 --- a/test/Milestone.py +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -import datetime - -class Milestone( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.milestone = self.g.get_user().get_repo( "PyGithub" ).get_milestone( 1 ) - - def testAttributes( self ): - self.assertEqual( self.milestone.closed_issues, 2 ) - self.assertEqual( self.milestone.created_at, datetime.datetime( 2012, 3, 8, 12, 22, 10 ) ) - self.assertEqual( self.milestone.description, "" ) - self.assertEqual( self.milestone.due_on, datetime.datetime( 2012, 3, 13, 7, 0, 0 ) ) - self.assertEqual( self.milestone.id, 93546 ) - self.assertEqual( self.milestone.number, 1 ) - self.assertEqual( self.milestone.open_issues, 0 ) - self.assertEqual( self.milestone.state, "closed" ) - self.assertEqual( self.milestone.title, "Version 0.4" ) - self.assertEqual( self.milestone.url, "https://api.github.com/repos/jacquev6/PyGithub/milestones/1" ) - self.assertEqual( self.milestone.creator.login, "jacquev6" ) - - def testEditWithMinimalParameters( self ): - self.milestone.edit( "Title edited by PyGithub" ) - self.assertEqual( self.milestone.title, "Title edited by PyGithub" ) - - def testEditWithAllParameters( self ): - self.milestone.edit( "Title edited twice by PyGithub", "closed", "Description edited by PyGithub", due_on = datetime.date( 2012, 6, 16 ) ) - self.assertEqual( self.milestone.title, "Title edited twice by PyGithub" ) - self.assertEqual( self.milestone.state, "closed" ) - self.assertEqual( self.milestone.description, "Description edited by PyGithub" ) - self.assertEqual( self.milestone.due_on, datetime.datetime( 2012, 6, 16, 7, 0, 0 ) ) - - def testGetLabels( self ): - self.assertListKeyEqual( self.milestone.get_labels(), lambda l: l.name, [ "Public interface", "Project management" ] ) - - def testDelete( self ): - self.milestone.delete() diff --git a/test/NamedUser.py b/test/NamedUser.py deleted file mode 100644 index 8f76a6e6..00000000 --- a/test/NamedUser.py +++ /dev/null @@ -1,130 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -import github -import datetime - -class NamedUser( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.user = self.g.get_user( "jacquev6" ) - - def testAttributesOfOtherUser( self ): - self.user = self.g.get_user( "nvie" ) - self.assertEqual( self.user.avatar_url, "https://secure.gravatar.com/avatar/c5a7f21b46df698f3db31c37ed0cf55a?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png" ) - self.assertEqual( self.user.bio, None ) - self.assertEqual( self.user.blog, "http://nvie.com" ) - self.assertEqual( self.user.collaborators, None ) - self.assertEqual( self.user.company, "3rd Cloud" ) - self.assertEqual( self.user.created_at, datetime.datetime( 2009, 5, 12, 21, 19, 38 ) ) - self.assertEqual( self.user.disk_usage, None ) - self.assertEqual( self.user.email, "vincent@3rdcloud.com" ) - self.assertEqual( self.user.followers, 296 ) - self.assertEqual( self.user.following, 41 ) - self.assertEqual( self.user.gravatar_id, "c5a7f21b46df698f3db31c37ed0cf55a" ) - self.assertEqual( self.user.hireable, False ) - self.assertEqual( self.user.html_url, "https://github.com/nvie" ) - self.assertEqual( self.user.id, 83844 ) - self.assertEqual( self.user.location, "Netherlands" ) - self.assertEqual( self.user.login, "nvie" ) - self.assertEqual( self.user.name, "Vincent Driessen" ) - self.assertEqual( self.user.owned_private_repos, None ) - self.assertEqual( self.user.plan, None ) - self.assertEqual( self.user.private_gists, None ) - self.assertEqual( self.user.public_gists, 16 ) - self.assertEqual( self.user.public_repos, 61 ) - self.assertEqual( self.user.total_private_repos, None ) - self.assertEqual( self.user.type, "User" ) - self.assertEqual( self.user.url, "https://api.github.com/users/nvie" ) - - def testAttributesOfSelf( self ): - self.assertEqual( self.user.avatar_url, "https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png" ) - self.assertEqual( self.user.bio, "" ) - self.assertEqual( self.user.blog, "http://vincent-jacques.net" ) - self.assertEqual( self.user.collaborators, 0 ) - self.assertEqual( self.user.company, "Criteo" ) - self.assertEqual( self.user.created_at, datetime.datetime( 2010, 7, 9, 6, 10, 6 ) ) - self.assertEqual( self.user.disk_usage, 17080 ) - self.assertEqual( self.user.email, "vincent@vincent-jacques.net" ) - self.assertEqual( self.user.followers, 13 ) - self.assertEqual( self.user.following, 24 ) - self.assertEqual( self.user.gravatar_id, "b68de5ae38616c296fa345d2b9df2225" ) - self.assertEqual( self.user.hireable, False ) - self.assertEqual( self.user.html_url, "https://github.com/jacquev6" ) - self.assertEqual( self.user.id, 327146 ) - self.assertEqual( self.user.location, "Paris, France" ) - self.assertEqual( self.user.login, "jacquev6" ) - self.assertEqual( self.user.name, "Vincent Jacques" ) - self.assertEqual( self.user.owned_private_repos, 5 ) - self.assertEqual( self.user.plan.name, "micro" ) - self.assertEqual( self.user.plan.collaborators, 1 ) - self.assertEqual( self.user.plan.space, 614400 ) - self.assertEqual( self.user.plan.private_repos, 5 ) - self.assertEqual( self.user.private_gists, 5 ) - self.assertEqual( self.user.public_gists, 2 ) - self.assertEqual( self.user.public_repos, 11 ) - self.assertEqual( self.user.total_private_repos, 5 ) - self.assertEqual( self.user.type, "User" ) - self.assertEqual( self.user.url, "https://api.github.com/users/jacquev6" ) - - def testCreateGist( self ): - gist = self.user.create_gist( True, { "foobar.txt": github.InputFileContent( "File created by PyGithub" ) }, "Gist created by PyGithub on a NamedUser" ) - self.assertEqual( gist.description, "Gist created by PyGithub on a NamedUser" ) - - def testCreateGistWithoutDescription( self ): - gist = self.user.create_gist( True, { "foobar.txt": github.InputFileContent( "File created by PyGithub" ) } ) - self.assertEqual( gist.description, None ) - - def testGetGists( self ): - self.assertListKeyEqual( self.user.get_gists(), lambda g: g.description, [ "Gist created by PyGithub", "FairThreadPoolPool.cpp", "How to error 500 Github API v3, as requested by Rick (GitHub Staff)", "Cadfael: order of episodes in French DVD edition" ] ) - - def testGetFollowers( self ): - self.assertListKeyEqual( self.user.get_followers(), lambda f: f.login, [ "jnorthrup", "brugidou", "regisb", "walidk", "afzalkhan", "sdanzan", "vineus", "gturri", "fjardon", "cjuniet", "jardon-u", "kamaradclimber", "L42y" ] ) - - def testGetFollowing( self ): - self.assertListKeyEqual( self.user.get_following(), lambda f: f.login, [ "nvie", "schacon", "jamis", "chad", "unclebob", "dabrahams", "jnorthrup", "brugidou", "regisb", "walidk", "tanzilli", "fjardon", "r3c", "sdanzan", "vineus", "cjuniet", "gturri", "ant9000", "asquini", "claudyus", "jardon-u", "s-bernard", "kamaradclimber", "Lyloa" ] ) - - def testGetOrgs( self ): - self.assertListKeyEqual( self.user.get_orgs(), lambda o: o.login, [ "BeaverSoftware" ] ) - - def testGetRepo( self ): - self.assertEqual( self.user.get_repo( "PyGithub" ).description, "Python library implementing the full Github API v3" ) - - def testGetRepos( self ): - self.assertListKeyEqual( self.user.get_repos(), lambda r: r.name, [ "TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE" ] ) - - def testGetReposWithType( self ): - self.assertListKeyEqual( self.user.get_repos( "owner" ), lambda r: r.name, [ "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE" ] ) - - def testGetWatched( self ): - self.assertListKeyEqual( self.user.get_watched(), lambda r: r.name, [ "git", "boost.php", "capistrano", "boost.perl", "git-subtree", "git-hg", "homebrew", "celtic_knot", "twisted-intro", "markup", "hub", "gitflow", "murder", "boto", "agit", "d3", "pygit2", "git-pulls", "django_mathlatex", "scrumblr", "developer.github.com", "python-github3", "PlantUML", "bootstrap", "drawnby", "django-socketio", "django-realtime", "playground", "BozoCrack", "FatherBeaver", "PyGithub", "django", "django", "TestPyGithub" ] ) - - def testGetStarred( self ): - self.assertListKeyEqual( self.user.get_starred(), lambda r: r.name, [ "git", "boost.php", "capistrano", "boost.perl", "git-subtree", "git-hg", "homebrew", "celtic_knot", "twisted-intro", "markup", "hub", "gitflow", "murder", "boto", "agit", "d3", "pygit2", "git-pulls", "django_mathlatex", "scrumblr", "developer.github.com", "python-github3", "PlantUML", "bootstrap", "drawnby", "django-socketio", "django-realtime", "playground", "BozoCrack", "FatherBeaver", "amaunet", "django", "django", "moviePlanning", "folly" ] ) - - def testGetSubscriptions( self ): - self.assertListKeyEqual( self.user.get_subscriptions(), lambda r: r.name, [ "ViDE", "Boost.HierarchicalEnum", "QuadProgMm", "DrawSyntax", "DrawTurksHead", "PrivateStuff", "vincent-jacques.net", "Hacking", "C4Planner", "developer.github.com", "PyGithub", "PyGithub", "django", "CinePlanning", "PyGithub", "PyGithub", "PyGithub", "IpMap", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub", "PyGithub" ] ) - - def testGetEvents( self ): - self.assertListKeyBegin( self.user.get_events(), lambda e: e.type, [ "GistEvent", "IssueCommentEvent", "PushEvent", "IssuesEvent" ] ) - - def testGetPublicEvents( self ): - self.assertListKeyBegin( self.user.get_public_events(), lambda e: e.type, [ "PushEvent", "CreateEvent", "GistEvent", "IssuesEvent" ] ) - - def testGetPublicReceivedEvents( self ): - self.assertListKeyBegin( self.user.get_public_received_events(), lambda e: e.type, [ "IssueCommentEvent", "IssueCommentEvent", "IssueCommentEvent", "IssueCommentEvent" ] ) - - def testGetReceivedEvents( self ): - self.assertListKeyBegin( self.user.get_received_events(), lambda e: e.type, [ "IssueCommentEvent", "IssueCommentEvent", "IssueCommentEvent", "IssueCommentEvent" ] ) diff --git a/test/Organization.py b/test/Organization.py deleted file mode 100644 index 10dc001c..00000000 --- a/test/Organization.py +++ /dev/null @@ -1,116 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -import datetime - -class Organization( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.org = self.g.get_organization( "BeaverSoftware" ) - - def testAttributes( self ): - self.assertEqual( self.org.avatar_url, "https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png" ) - self.assertEqual( self.org.billing_email, "BeaverSoftware@vincent-jacques.net" ) - self.assertEqual( self.org.blog, None ) - self.assertEqual( self.org.collaborators, 0 ) - self.assertEqual( self.org.company, None ) - self.assertEqual( self.org.created_at, datetime.datetime( 2012, 2, 9, 19, 20, 12 ) ) - self.assertEqual( self.org.disk_usage, 112 ) - self.assertEqual( self.org.email, None ) - self.assertEqual( self.org.followers, 0 ) - self.assertEqual( self.org.following, 0 ) - self.assertEqual( self.org.gravatar_id, None ) - self.assertEqual( self.org.html_url, "https://github.com/BeaverSoftware" ) - self.assertEqual( self.org.id, 1424031 ) - self.assertEqual( self.org.location, "Paris, France" ) - self.assertEqual( self.org.login, "BeaverSoftware" ) - self.assertEqual( self.org.name, None ) - self.assertEqual( self.org.owned_private_repos, 0 ) - self.assertEqual( self.org.plan.name, "free" ) - self.assertEqual( self.org.plan.private_repos, 0 ) - self.assertEqual( self.org.plan.space, 307200 ) - self.assertEqual( self.org.private_gists, 0 ) - self.assertEqual( self.org.public_gists, 0 ) - self.assertEqual( self.org.public_repos, 2 ) - self.assertEqual( self.org.total_private_repos, 0 ) - self.assertEqual( self.org.type, "Organization" ) - self.assertEqual( self.org.url, "https://api.github.com/orgs/BeaverSoftware" ) - - def testEditWithoutArguments( self ): - self.org.edit() - - def testEditWithAllArguments( self ): - self.org.edit( "BeaverSoftware2@vincent-jacques.net", "http://vincent-jacques.net", "Company edited by PyGithub", "BeaverSoftware2@vincent-jacques.net", "Location edited by PyGithub", "Name edited by PyGithub" ) - self.assertEqual( self.org.billing_email, "BeaverSoftware2@vincent-jacques.net" ) - self.assertEqual( self.org.blog, "http://vincent-jacques.net" ) - self.assertEqual( self.org.company, "Company edited by PyGithub" ) - self.assertEqual( self.org.email, "BeaverSoftware2@vincent-jacques.net" ) - self.assertEqual( self.org.location, "Location edited by PyGithub" ) - self.assertEqual( self.org.name, "Name edited by PyGithub" ) - - def testCreateTeam( self ): - team = self.org.create_team( "Team created by PyGithub" ) - self.assertEqual( team.id, 189850 ) - - def testCreateTeamWithAllArguments( self ): - 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 ): - lyloa = self.g.get_user( "Lyloa" ) - self.assertFalse( self.org.has_in_public_members( lyloa ) ) - self.org.add_to_public_members( lyloa ) - self.assertTrue( self.org.has_in_public_members( lyloa ) ) - self.org.remove_from_public_members( lyloa ) - self.assertFalse( self.org.has_in_public_members( lyloa ) ) - - def testGetPublicMembers( self ): - self.assertListKeyEqual( self.org.get_public_members(), lambda u: u.login, [ "jacquev6" ] ) - - def testGetMembers( self ): - self.assertListKeyEqual( self.org.get_members(), lambda u: u.login, [ "cjuniet", "jacquev6", "Lyloa" ] ) - - def testMembers( self ): - lyloa = self.g.get_user( "Lyloa" ) - self.assertTrue( self.org.has_in_members( lyloa ) ) - self.org.remove_from_members( lyloa ) - self.assertFalse( self.org.has_in_members( lyloa ) ) - - def testGetRepos( self ): - self.assertListKeyEqual( self.org.get_repos(), lambda r: r.name, [ "FatherBeaver", "TestPyGithub" ] ) - - def testGetReposWithType( self ): - self.assertListKeyEqual( self.org.get_repos( "public" ), lambda r: r.name, [ "FatherBeaver", "PyGithub" ] ) - - def testGetEvents( self ): - self.assertListKeyEqual( self.org.get_events(), lambda e: e.type, [ "CreateEvent", "CreateEvent", "PushEvent", "PushEvent", "DeleteEvent", "DeleteEvent", "PushEvent", "PushEvent", "DeleteEvent", "DeleteEvent", "PushEvent", "PushEvent", "PushEvent", "CreateEvent", "CreateEvent", "CreateEvent", "CreateEvent", "CreateEvent", "PushEvent", "PushEvent", "PushEvent", "PushEvent", "PushEvent", "PushEvent", "ForkEvent", "CreateEvent" ] ) - - def testGetTeams( self ): - self.assertListKeyEqual( self.org.get_teams(), lambda t: t.name, [ "Members", "Owners" ] ) - - def testCreateRepoWithMinimalArguments( self ): - repo = self.org.create_repo( "TestPyGithub" ) - self.assertEqual( repo.url, "https://api.github.com/repos/BeaverSoftware/TestPyGithub" ) - - def testCreateRepoWithAllArguments( self ): - 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 ): - pygithub = self.g.get_user( "jacquev6" ).get_repo( "PyGithub" ) - repo = self.org.create_fork( pygithub ) - self.assertEqual( repo.url, "https://api.github.com/repos/BeaverSoftware/PyGithub" ) diff --git a/test/PaginatedList.py b/test/PaginatedList.py deleted file mode 100644 index 016b93bb..00000000 --- a/test/PaginatedList.py +++ /dev/null @@ -1,79 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -class PaginatedList( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.list = self.g.get_user( "openframeworks" ).get_repo( "openFrameworks" ).get_issues() - - def testIteration( self ): - self.assertEqual( len( list( self.list ) ), 333 ) - - def testSeveralIterations( self ): - self.assertEqual( len( list( self.list ) ), 333 ) - self.assertEqual( len( list( self.list ) ), 333 ) - self.assertEqual( len( list( self.list ) ), 333 ) - self.assertEqual( len( list( self.list ) ), 333 ) - - def testIntIndexingInFirstPage( self ): - self.assertEqual( self.list[ 0 ].id, 4772349 ) - self.assertEqual( self.list[ 24 ].id, 4286936 ) - - def testIntIndexingInThirdPage( self ): - self.assertEqual( self.list[ 50 ].id, 3911629 ) - self.assertEqual( self.list[ 74 ].id, 3605277 ) - - def testGetFirstPage( self ): - self.assertListKeyEqual( self.list.get_page( 0 ), lambda i: i.id, [ 4772349, 4767675, 4758608, 4700182, 4662873, 4608132, 4604661, 4588997, 4557803, 4554058, 4539985, 4507572, 4507492, 4507416, 4447561, 4406584, 4384548, 4383465, 4373361, 4373201, 4370619, 4356530, 4352401, 4317009, 4286936 ] ) - - def testGetThirdPage( self ): - self.assertListKeyEqual( self.list.get_page( 2 ), lambda i: i.id, [ 3911629, 3911537, 3910580, 3910555, 3910549, 3897090, 3883598, 3856005, 3850655, 3825582, 3813852, 3812318, 3812275, 3807459, 3799872, 3799653, 3795495, 3754055, 3710293, 3662214, 3647640, 3631618, 3627067, 3614231, 3605277 ] ) - - def testIntIndexingAfterIteration( self ): - self.assertEqual( len( list( self.list ) ), 333 ) - self.assertEqual( self.list[ 11 ].id, 4507572 ) - self.assertEqual( self.list[ 73 ].id, 3614231 ) - self.assertEqual( self.list[ 332 ].id, 94898 ) - - def testSliceIndexingInFirstPage( self ): - self.assertListKeyEqual( self.list[ : 13 ], lambda i: i.id, [ 4772349, 4767675, 4758608, 4700182, 4662873, 4608132, 4604661, 4588997, 4557803, 4554058, 4539985, 4507572, 4507492 ] ) - self.assertListKeyEqual( self.list[ : 13 : 3 ], lambda i: i.id, [ 4772349, 4700182, 4604661, 4554058, 4507492 ] ) - self.assertListKeyEqual( self.list[ 10 : 13 ], lambda i: i.id, [ 4539985, 4507572, 4507492 ] ) - self.assertListKeyEqual( self.list[ 5 : 13 : 3 ], lambda i: i.id, [ 4608132, 4557803, 4507572 ] ) - - def testSliceIndexingUntilFourthPage( self ): - self.assertListKeyEqual( self.list[ : 99 : 10 ], lambda i: i.id, [ 4772349, 4539985, 4370619, 4207350, 4063366, 3911629, 3813852, 3647640, 3528378, 3438233 ] ) - self.assertListKeyEqual( self.list[ 73 : 78 ], lambda i: i.id, [ 3614231, 3605277, 3596240, 3594731, 3593619 ] ) - self.assertListKeyEqual( self.list[ 70 : 80 : 2 ], lambda i: i.id, [ 3647640, 3627067, 3605277, 3594731, 3593430 ] ) - - def testSliceIndexingUntilEnd( self ): - self.assertListKeyEqual( self.list[ 310 : : 3 ], lambda i: i.id, [ 268332, 204247, 169176, 166211, 165898, 163959, 132373, 104702 ] ) - self.assertListKeyEqual( self.list[ 310 : ], lambda i: i.id, [ 268332, 211418, 205935, 204247, 172424, 171615, 169176, 166214, 166212, 166211, 166209, 166208, 165898, 165537, 165409, 163959, 132671, 132377, 132373, 130269, 111018, 104702, 94898 ] ) - - def testInterruptedIteration( self ): - # No asserts, but checks that only three pages are fetched - l = 0 - for element in self.list: - l += 1 - if l == 75: - break - - def testInterruptedIterationInSlice( self ): - # No asserts, but checks that only three pages are fetched - l = 0 - for element in self.list[ :100 ]: - l += 1 - if l == 75: - break diff --git a/test/PullRequest.py b/test/PullRequest.py deleted file mode 100644 index 9f6331e9..00000000 --- a/test/PullRequest.py +++ /dev/null @@ -1,99 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -import datetime - -class PullRequest( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - 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 ) - self.assertEqual( self.pull.base.label, "jacquev6:topic/RewriteWithGeneratedCode" ) - self.assertEqual( self.pull.base.sha, "ed866fc43833802ab553e5ff8581c81bb00dd433" ) - self.assertEqual( self.pull.base.user.login, "jacquev6" ) - self.assertEqual( self.pull.base.ref, "topic/RewriteWithGeneratedCode" ) - self.assertEqual( self.pull.base.repo.full_name, "jacquev6/PyGithub" ) - self.assertEqual( self.pull.body, "Body edited by PyGithub" ) - self.assertEqual( self.pull.changed_files, 45 ) - self.assertEqual( self.pull.closed_at, datetime.datetime( 2012, 5, 27, 10, 29, 7 ) ) - self.assertEqual( self.pull.comments, 0 ) - self.assertEqual( self.pull.commits, 3 ) - self.assertEqual( self.pull.created_at, datetime.datetime( 2012, 5, 27, 9, 25, 36 ) ) - self.assertEqual( self.pull.deletions, 384 ) - self.assertEqual( self.pull.diff_url, "https://github.com/jacquev6/PyGithub/pull/31.diff" ) - self.assertEqual( self.pull.head.label, "BeaverSoftware:master" ) - self.assertEqual( self.pull.html_url, "https://github.com/jacquev6/PyGithub/pull/31" ) - self.assertEqual( self.pull.id, 1436215 ) - self.assertEqual( self.pull.issue_url, "https://github.com/jacquev6/PyGithub/issues/31" ) - self.assertEqual( self.pull.mergeable, None ) - self.assertEqual( self.pull.merged, True ) - self.assertEqual( self.pull.merged_at, datetime.datetime( 2012, 5, 27, 10, 29, 7 ) ) - self.assertEqual( self.pull.merged_by.login, "jacquev6" ) - self.assertEqual( self.pull.number, 31 ) - self.assertEqual( self.pull.patch_url, "https://github.com/jacquev6/PyGithub/pull/31.patch" ) - self.assertEqual( self.pull.review_comments, 1 ) - self.assertEqual( self.pull.state, "closed" ) - self.assertEqual( self.pull.title, "Title edited by PyGithub" ) - self.assertEqual( self.pull.updated_at, datetime.datetime( 2012, 5, 27, 10, 29, 7 ) ) - self.assertEqual( self.pull.url, "https://api.github.com/repos/jacquev6/PyGithub/pulls/31" ) - self.assertEqual( self.pull.user.login, "jacquev6" ) - - def testCreateComment( self ): - 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 ): - self.assertListKeyEqual( self.pull.get_comments(), lambda c: c.id, [ 886298 ] ) - - def testCreateIssueComment( self ): - comment = self.pull.create_issue_comment( "Issue comment created by PyGithub" ) - self.assertEqual( comment.id, 8387331 ) - - def testGetIssueComments( self ): - self.assertListKeyEqual( self.pull.get_issue_comments(), lambda c: c.id, [ 8387331 ] ) - - def testGetIssueComment( self ): - comment = self.pull.get_issue_comment( 8387331 ) - self.assertEqual( comment.body, "Issue comment created by PyGithub" ) - - def testEditWithoutArguments( self ): - self.pull.edit() - - def testEditWithAllArguments( self ): - self.pull.edit( "Title edited by PyGithub", "Body edited by PyGithub", "open" ) - self.assertEqual( self.pull.title, "Title edited by PyGithub" ) - self.assertEqual( self.pull.body, "Body edited by PyGithub" ) - self.assertEqual( self.pull.state, "open" ) - - def testGetCommits( self ): - self.assertListKeyEqual( self.pull.get_commits(), lambda c: c.sha, [ "4aadfff21cdd2d2566b0e4bd7309c233b5f4ae23", "93dcae5cf207de376c91d0599226e7c7563e1d16", "8a4f306d4b223682dd19410d4a9150636ebe4206" ] ) - - def testGetFiles( self ): - self.assertListKeyEqual( self.pull.get_files(), lambda f: f.filename, [ "codegen/templates/GithubObject.py", "src/github/AuthenticatedUser.py", "src/github/Authorization.py", "src/github/Branch.py", "src/github/Commit.py", "src/github/CommitComment.py", "src/github/CommitFile.py", "src/github/CommitStats.py", "src/github/Download.py", "src/github/Event.py", "src/github/Gist.py", "src/github/GistComment.py", "src/github/GistHistoryState.py", "src/github/GitAuthor.py", "src/github/GitBlob.py", "src/github/GitCommit.py", "src/github/GitObject.py", "src/github/GitRef.py", "src/github/GitTag.py", "src/github/GitTree.py", "src/github/GitTreeElement.py", "src/github/Hook.py", "src/github/Issue.py", "src/github/IssueComment.py", "src/github/IssueEvent.py", "src/github/Label.py", "src/github/Milestone.py", "src/github/NamedUser.py", "src/github/Organization.py", "src/github/Permissions.py", "src/github/Plan.py", "src/github/PullRequest.py", "src/github/PullRequestComment.py", "src/github/PullRequestFile.py", "src/github/Repository.py", "src/github/RepositoryKey.py", "src/github/Tag.py", "src/github/Team.py", "src/github/UserKey.py", "test/Issue.py", "test/IssueEvent.py", "test/ReplayData/Issue.testAddAndRemoveLabels.txt", "test/ReplayData/Issue.testDeleteAndSetLabels.txt", "test/ReplayData/Issue.testGetLabels.txt", "test/ReplayData/IssueEvent.setUp.txt" ] ) - - def testMerge( self ): - self.assertFalse( self.pull.is_merged() ) - status = self.pull.merge() - self.assertEqual( status.sha, "688208b1a5a074871d0e9376119556897439697d" ) - self.assertEqual( status.merged, True ) - self.assertEqual( status.message, "Pull Request successfully merged" ) - self.assertTrue( self.pull.is_merged() ) - - def testMergeWithCommitMessage( self ): - self.g.get_user().get_repo( "PyGithub" ).get_pull( 39 ).merge( "Custom commit message created by PyGithub" ) diff --git a/test/PullRequestComment.py b/test/PullRequestComment.py deleted file mode 100644 index 920f46f3..00000000 --- a/test/PullRequestComment.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -import datetime - -class PullRequestComment( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.comment = self.g.get_user().get_repo( "PyGithub" ).get_pull( 31 ).get_comment( 886298 ) - - def testAttributes( self ): - self.assertEqual( self.comment.body, "Comment created by PyGithub" ) - self.assertEqual( self.comment.commit_id, "8a4f306d4b223682dd19410d4a9150636ebe4206" ) - self.assertEqual( self.comment.created_at, datetime.datetime( 2012, 5, 27, 9, 40, 12 ) ) - self.assertEqual( self.comment.id, 886298 ) - self.assertEqual( self.comment.original_commit_id, "8a4f306d4b223682dd19410d4a9150636ebe4206" ) - self.assertEqual( self.comment.original_position, 5 ) - self.assertEqual( self.comment.path, "src/github/Issue.py" ) - self.assertEqual( self.comment.position, 5 ) - self.assertEqual( self.comment.updated_at, datetime.datetime( 2012, 5, 27, 9, 40, 12 ) ) - self.assertEqual( self.comment.url, "https://api.github.com/repos/jacquev6/PyGithub/pulls/comments/886298" ) - self.assertEqual( self.comment.user.login, "jacquev6" ) - - def testEdit( self ): - self.comment.edit( "Comment edited by PyGithub" ) - self.assertEqual( self.comment.body, "Comment edited by PyGithub" ) - - def testDelete( self ): # Test PullRequest.get_comments before - self.comment.delete() diff --git a/test/PullRequestFile.py b/test/PullRequestFile.py deleted file mode 100644 index c4fbae7d..00000000 --- a/test/PullRequestFile.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -class PullRequestFile( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.file = self.g.get_user().get_repo( "PyGithub" ).get_pull( 31 ).get_files()[ 0 ] - - def testAttributes( self ): - self.assertEqual( self.file.additions, 1 ) - self.assertEqual( self.file.blob_url, "https://github.com/jacquev6/PyGithub/blob/8a4f306d4b223682dd19410d4a9150636ebe4206/codegen/templates/GithubObject.py" ) - self.assertEqual( self.file.changes, 2 ) - self.assertEqual( self.file.deletions, 1 ) - self.assertEqual( self.file.filename, "codegen/templates/GithubObject.py" ) - self.assertEqual( self.file.patch, '@@ -70,7 +70,7 @@ def __useAttributes( self, attributes ):\n \n # @toto No need to check if attribute is in attributes when attribute is mandatory\n {% for attribute in class.attributes|dictsort:"name" %}\n- if "{{ attribute.name }}" in attributes and attributes[ "{{ attribute.name }}" ] is not None:\n+ if "{{ attribute.name }}" in attributes and attributes[ "{{ attribute.name }}" ] is not None: # pragma no branch\n \n {% if attribute.type.cardinality == "scalar" %}\n {% if attribute.type.simple %}' ) - self.assertEqual( self.file.raw_url, "https://github.com/jacquev6/PyGithub/raw/8a4f306d4b223682dd19410d4a9150636ebe4206/codegen/templates/GithubObject.py" ) - self.assertEqual( self.file.sha, "8a4f306d4b223682dd19410d4a9150636ebe4206" ) - self.assertEqual( self.file.status, "modified" ) diff --git a/test/ReplayData/GistComment.testEdit.txt b/test/ReplayData/GistComment.testEdit.txt deleted file mode 100644 index 85cbcf52..00000000 --- a/test/ReplayData/GistComment.testEdit.txt +++ /dev/null @@ -1,5 +0,0 @@ -https PATCH api.github.com None /gists/comments/323629 {'Authorization': 'Basic login_and_password_removed'} {"body": "Comment edited by PyGithub"} -200 -[('status', '200 OK'), ('content-length', '478'), ('x-ratelimit-limit', '5000'), ('x-ratelimit-remaining', '4987'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('etag', '"cea8090368993f1fb95c32cdcf4245d3"'), ('date', 'Sat, 19 May 2012 07:12:32 GMT'), ('content-type', 'application/json; charset=utf-8')] -{"url":"https://api.github.com/gists/comments/323629","body":"Comment edited by PyGithub","created_at":"2012-05-19T07:07:57Z","updated_at":"2012-05-19T07:12:32Z","id":323629,"user":{"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","login":"jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","id":327146}} - diff --git a/test/ReplayData/PullRequest.setUp.txt b/test/ReplayData/PullRequest.setUp.txt deleted file mode 100644 index b1473769..00000000 --- a/test/ReplayData/PullRequest.setUp.txt +++ /dev/null @@ -1,15 +0,0 @@ -https GET api.github.com None /user {'Authorization': 'Basic login_and_password_removed'} null -200 -[('status', '200 OK'), ('x-ratelimit-remaining', '4950'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"e3511a4776ec399b168eb5f96423f3c8"'), ('date', 'Sun, 27 May 2012 10:32:04 GMT'), ('content-type', 'application/json; charset=utf-8')] -{"collaborators":0,"type":"User","disk_usage":16856,"bio":"","public_gists":3,"url":"https://api.github.com/users/jacquev6","private_gists":5,"plan":{"private_repos":5,"collaborators":1,"name":"micro","space":614400},"company":"Criteo","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","blog":"http://vincent-jacques.net","email":"vincent@vincent-jacques.net","total_private_repos":5,"followers":13,"name":"Vincent Jacques","public_repos":11,"created_at":"2010-07-09T06:10:06Z","location":"Paris, France","id":327146,"owned_private_repos":5,"following":24,"html_url":"https://github.com/jacquev6","hireable":false,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"} - -https GET api.github.com None /repos/jacquev6/PyGithub {'Authorization': 'Basic login_and_password_removed'} null -200 -[('status', '200 OK'), ('x-ratelimit-remaining', '4949'), ('content-length', '1129'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"65cfc4c324b5a85af62a0091f4d86503"'), ('date', 'Sun, 27 May 2012 10:32:05 GMT'), ('content-type', 'application/json; charset=utf-8')] -{"clone_url":"https://github.com/jacquev6/PyGithub.git","has_downloads":true,"watchers":15,"git_url":"git://github.com/jacquev6/PyGithub.git","updated_at":"2012-05-27T10:29:10Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","mirror_url":null,"has_wiki":false,"has_issues":true,"fork":false,"forks":3,"size":188,"private":false,"open_issues":16,"svn_url":"https://github.com/jacquev6/PyGithub","owner":{"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},"name":"PyGithub","language":"Python","description":"Python library implementing the full Github API v3","ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-27T10:29:09Z","created_at":"2012-02-25T12:53:47Z","id":3544490,"html_url":"https://github.com/jacquev6/PyGithub","full_name":"jacquev6/PyGithub"} - -https GET api.github.com None /repos/jacquev6/PyGithub/pulls/31 {'Authorization': 'Basic login_and_password_removed'} null -200 -[('status', '200 OK'), ('x-ratelimit-remaining', '4948'), ('content-length', '4806'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"2ec526e3dd610dfb92cccc8159bd2585"'), ('date', 'Sun, 27 May 2012 10:32:06 GMT'), ('content-type', 'application/json; charset=utf-8')] -{"merged":true,"mergeable":null,"_links":{"self":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31"},"comments":{"href":"https://api.github.com/repos/jacquev6/PyGithub/issues/31/comments"},"issue":{"href":"https://api.github.com/repos/jacquev6/PyGithub/issues/31"},"html":{"href":"https://github.com/jacquev6/PyGithub/pull/31"},"review_comments":{"href":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31/comments"}},"head":{"ref":"master","label":"BeaverSoftware:master","repo":{"clone_url":"https://github.com/BeaverSoftware/PyGithub.git","has_downloads":true,"watchers":1,"updated_at":"2012-05-27T09:09:17Z","homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/BeaverSoftware/PyGithub","mirror_url":null,"has_wiki":false,"has_issues":false,"fork":true,"forks":0,"git_url":"git://github.com/BeaverSoftware/PyGithub.git","size":176,"private":false,"open_issues":0,"svn_url":"https://github.com/BeaverSoftware/PyGithub","owner":{"url":"https://api.github.com/users/BeaverSoftware","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","id":1424031},"name":"PyGithub","language":"Python","description":"Python library implementing the full Github API v3","ssh_url":"git@github.com:BeaverSoftware/PyGithub.git","pushed_at":"2012-05-27T09:09:17Z","created_at":"2012-05-27T08:50:04Z","id":4460787,"html_url":"https://github.com/BeaverSoftware/PyGithub","full_name":"BeaverSoftware/PyGithub"},"user":{"url":"https://api.github.com/users/BeaverSoftware","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","id":1424031},"sha":"8a4f306d4b223682dd19410d4a9150636ebe4206"},"updated_at":"2012-05-27T10:29:07Z","issue_url":"https://github.com/jacquev6/PyGithub/issues/31","changed_files":45,"body":"Body edited by PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub/pulls/31","comments":0,"base":{"ref":"topic/RewriteWithGeneratedCode","label":"jacquev6:topic/RewriteWithGeneratedCode","repo":{"clone_url":"https://github.com/jacquev6/PyGithub.git","has_downloads":true,"watchers":15,"updated_at":"2012-05-27T10:29:10Z","homepage":"http://vincent-jacques.net/PyGithub","url":"https://api.github.com/repos/jacquev6/PyGithub","mirror_url":null,"has_wiki":false,"has_issues":true,"fork":false,"forks":3,"git_url":"git://github.com/jacquev6/PyGithub.git","size":188,"private":false,"open_issues":16,"svn_url":"https://github.com/jacquev6/PyGithub","owner":{"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},"name":"PyGithub","language":"Python","description":"Python library implementing the full Github API v3","ssh_url":"git@github.com:jacquev6/PyGithub.git","pushed_at":"2012-05-27T10:29:09Z","created_at":"2012-02-25T12:53:47Z","id":3544490,"html_url":"https://github.com/jacquev6/PyGithub","full_name":"jacquev6/PyGithub"},"user":{"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},"sha":"ed866fc43833802ab553e5ff8581c81bb00dd433"},"number":31,"diff_url":"https://github.com/jacquev6/PyGithub/pull/31.diff","merged_by":{"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":"2012-05-27T10:29:07Z","title":"Title edited by PyGithub","deletions":384,"merged_at":"2012-05-27T10:29:07Z","patch_url":"https://github.com/jacquev6/PyGithub/pull/31.patch","additions":511,"created_at":"2012-05-27T09:25:36Z","user":{"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},"state":"closed","id":1436215,"review_comments":1,"commits":3,"html_url":"https://github.com/jacquev6/PyGithub/pull/31"} - diff --git a/test/Repository.py b/test/Repository.py deleted file mode 100644 index a216befd..00000000 --- a/test/Repository.py +++ /dev/null @@ -1,405 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -import github -import datetime - -class Repository( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.repo = self.g.get_user().get_repo( "PyGithub" ) - - def testAttributes( self ): - self.assertEqual( self.repo.clone_url, "https://github.com/jacquev6/PyGithub.git" ) - self.assertEqual( self.repo.created_at, datetime.datetime( 2012, 2, 25, 12, 53, 47 ) ) - self.assertEqual( self.repo.description, "Python library implementing the full Github API v3" ) - self.assertEqual( self.repo.fork, False ) - self.assertEqual( self.repo.forks, 3 ) - self.assertEqual( self.repo.full_name, "jacquev6/PyGithub" ) - self.assertEqual( self.repo.git_url, "git://github.com/jacquev6/PyGithub.git" ) - self.assertEqual( self.repo.has_downloads, True ) - self.assertEqual( self.repo.has_issues, True ) - self.assertEqual( self.repo.has_wiki, False ) - self.assertEqual( self.repo.homepage, "http://vincent-jacques.net/PyGithub" ) - self.assertEqual( self.repo.html_url, "https://github.com/jacquev6/PyGithub" ) - self.assertEqual( self.repo.id, 3544490 ) - self.assertEqual( self.repo.language, "Python" ) - self.assertEqual( self.repo.master_branch, None ) - self.assertEqual( self.repo.name, "PyGithub" ) - self.assertEqual( self.repo.open_issues, 16 ) - self.assertEqual( self.repo.organization, None ) - self.assertEqual( self.repo.owner.login, "jacquev6" ) - self.assertEqual( self.repo.parent, None ) - self.assertEqual( self.repo.permissions.admin, True ) - self.assertEqual( self.repo.permissions.pull, True ) - self.assertEqual( self.repo.permissions.push, True ) - self.assertEqual( self.repo.private, False ) - self.assertEqual( self.repo.pushed_at, datetime.datetime( 2012, 5, 27, 6, 0, 28 ) ) - self.assertEqual( self.repo.size, 308 ) - self.assertEqual( self.repo.source, None ) - self.assertEqual( self.repo.ssh_url, "git@github.com:jacquev6/PyGithub.git" ) - self.assertEqual( self.repo.svn_url, "https://github.com/jacquev6/PyGithub" ) - self.assertEqual( self.repo.updated_at, datetime.datetime( 2012, 5, 27, 6, 55, 28 ) ) - self.assertEqual( self.repo.url, "https://api.github.com/repos/jacquev6/PyGithub" ) - self.assertEqual( self.repo.watchers, 15 ) - - def testEditWithoutArguments( self ): - self.repo.edit( "PyGithub" ) - - def testEditWithAllArguments( self ): - self.repo.edit( "PyGithub", "Description edited by PyGithub", "http://vincent-jacques.net/PyGithub", public = True, has_issues = True, has_wiki = False, has_downloads = True ) - self.assertEqual( self.repo.description, "Description edited by PyGithub" ) - self.repo.edit( "PyGithub", "Python library implementing the full Github API v3" ) - self.assertEqual( self.repo.description, "Python library implementing the full Github API v3" ) - - def testDelete( self ): - repo = self.g.get_user().get_repo( "TestPyGithub" ) - repo.delete() - - def testGetContributors( self ): - self.assertListKeyEqual( self.repo.get_contributors(), lambda c: ( c.login, c.contributions ), [ ( "jacquev6", 355 ) ] ) - - def testCreateMilestone( self ): - milestone = self.repo.create_milestone( "Milestone created by PyGithub", state = "open", description = "Description created by PyGithub", due_on = datetime.date( 2012, 6, 15 ) ) - self.assertEqual( milestone.number, 5 ) - - def testCreateMilestoneWithMinimalArguments( self ): - milestone = self.repo.create_milestone( "Milestone also created by PyGithub" ) - self.assertEqual( milestone.number, 6 ) - - def testCreateIssue( self ): - issue = self.repo.create_issue( "Issue created by PyGithub" ) - self.assertEqual( issue.number, 28 ) - - def testCreateIssueWithAllArguments( self ): - 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 ): - label = self.repo.create_label( "Label with silly name % * + created by PyGithub", "00ff00" ) - self.assertEqual( label.color, "00ff00" ) - self.assertEqual( label.name, "Label with silly name % * + created by PyGithub" ) - self.assertEqual( label.url, "https://api.github.com/repos/jacquev6/PyGithub/labels/Label+with+silly+name+%25+%2A+%2B+created+by+PyGithub" ) - - def testGetLabel( self ): - label = self.repo.get_label( "Label with silly name % * + created by PyGithub" ) - self.assertEqual( label.color, "00ff00" ) - self.assertEqual( label.name, "Label with silly name % * + created by PyGithub" ) - self.assertEqual( label.url, "https://api.github.com/repos/jacquev6/PyGithub/labels/Label+with+silly+name+%25+%2A+%2B+created+by+PyGithub" ) - - def testCreateHookWithMinimalParameters( self ): - hook = self.repo.create_hook( "web", { "url": "http://foobar.com" } ) - self.assertEqual( hook.id, 257967 ) - - def testCreateHookWithAllParameters( self ): - hook = self.repo.create_hook( "web", { "url": "http://foobar.com" }, [ "fork" ], False ) - self.assertEqual( hook.active, True ) # WTF - self.assertEqual( hook.id, 257993 ) - - def testCreateDownloadWithMinimalArguments( self ): - download = self.repo.create_download( "Foobar.txt", 1024 ) - self.assertEqual( download.id, 242562 ) - - def testCreateDownloadWithAllArguments( self ): - download = self.repo.create_download( "Foobar.txt", 1024, "Download created by PyGithub", "text/richtext" ) - self.assertEqual( download.accesskeyid, "1DWESVTPGHQVTX38V182" ) - self.assertEqual( download.acl, "public-read" ) - self.assertEqual( download.bucket, "github" ) - self.assertEqual( download.content_type, "text/richtext" ) - self.assertEqual( download.created_at, datetime.datetime( 2012, 5, 22, 19, 11, 49 ) ) - self.assertEqual( download.description, "Download created by PyGithub" ) - self.assertEqual( download.download_count, 0 ) - self.assertEqual( download.expirationdate, datetime.datetime( 2112, 5, 22, 19, 11, 49 ) ) - self.assertEqual( download.html_url, "https://github.com/downloads/jacquev6/PyGithub/Foobar.txt" ) - self.assertEqual( download.id, 242556 ) - self.assertEqual( download.mime_type, "text/richtext" ) - self.assertEqual( download.name, "Foobar.txt" ) - self.assertEqual( download.path, "downloads/jacquev6/PyGithub/Foobar.txt" ) - self.assertEqual( download.policy, "ewogICAgJ2V4cGlyYXRpb24nOiAnMjExMi0wNS0yMlQxOToxMTo0OS4wMDBaJywKICAgICdjb25kaXRpb25zJzogWwogICAgICAgIHsnYnVja2V0JzogJ2dpdGh1Yid9LAogICAgICAgIHsna2V5JzogJ2Rvd25sb2Fkcy9qYWNxdWV2Ni9QeUdpdGh1Yi9Gb29iYXIudHh0J30sCiAgICAgICAgeydhY2wnOiAncHVibGljLXJlYWQnfSwKICAgICAgICB7J3N1Y2Nlc3NfYWN0aW9uX3N0YXR1cyc6ICcyMDEnfSwKICAgICAgICBbJ3N0YXJ0cy13aXRoJywgJyRGaWxlbmFtZScsICcnXSwKICAgICAgICBbJ3N0YXJ0cy13aXRoJywgJyRDb250ZW50LVR5cGUnLCAnJ10KICAgIF0KfQ==" ) - self.assertEqual( download.prefix, "downloads/jacquev6/PyGithub" ) - self.assertEqual( download.redirect, False ) - self.assertEqual( download.s3_url, "https://github.s3.amazonaws.com/" ) - self.assertEqual( download.signature, "8FCU/4rgT3ohXfE9N6HO7JgbuK4=" ) - self.assertEqual( download.size, 1024 ) - self.assertEqual( download.url, "https://api.github.com/repos/jacquev6/PyGithub/downloads/242556" ) - - def testCreateGitRef( self ): - ref = self.repo.create_git_ref( "refs/heads/BranchCreatedByPyGithub", "4303c5b90e2216d927155e9609436ccb8984c495" ) - self.assertEqual( ref.url, "https://api.github.com/repos/jacquev6/PyGithub/git/refs/heads/BranchCreatedByPyGithub" ) - - def testCreateGitBlob( self ): - blob = self.repo.create_git_blob( "Blob created by PyGithub", "latin1" ) - self.assertEqual( blob.sha, "5dd930f591cd5188e9ea7200e308ad355182a1d8" ) - - def testCreateGitTree( self ): - tree = self.repo.create_git_tree( - [ github.InputGitTreeElement( - "Foobar.txt", - "100644", - "blob", - content = "File created by PyGithub" - ) ] - ) - 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", - "100644", - "blob", - content = "File also created by PyGithub" - ) ], - base_tree - ) - self.assertEqual( tree.sha, "107139a922f33bab6fbeb9f9eb8787e7f19e0528" ) - - def testCreateGitTreeWithSha( self ): - tree = self.repo.create_git_tree( - [ github.InputGitTreeElement( - "Barbaz.txt", - "100644", - "blob", - sha = "5dd930f591cd5188e9ea7200e308ad355182a1d8" - ) ] - ) - self.assertEqual( tree.sha, "fae707821159639589bf94f3fb0a7154ec5d441b" ) - - def testCreateGitCommit( self ): - 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 ): - parents = [ - self.repo.get_git_commit( "7248e66831d4ffe09ef1f30a1df59ec0a9331ece" ), - self.repo.get_git_commit( "12d427464f8d91c8e981043a86ba8a2a9e7319ea" ), - ] - 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 ): - 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 ): - tag = self.repo.create_git_tag( "TaggedByPyGithub", "Tag created by PyGithub", "0b820628236ab8bab3890860fc414fa757ca15f4", "commit" ) - self.assertEqual( tag.sha, "5ba561eaa2b7ca9015662510157b15d8f3b0232a" ) - - def testCreateGitTagWithAllArguments( self ): - tag = self.repo.create_git_tag( "TaggedByPyGithub2", "Tag also created by PyGithub", "526946197ae9da59c6507cacd13ad6f1cfb686ea", "commit", github.InputGitAuthor( "John Doe", "j.doe@vincent-jacques.net", "2008-07-09T16:13:30+12:00" ) ) - self.assertEqual( tag.sha, "f0e99a8335fbc84c53366c4a681118468f266625" ) - - def testCreateKey( self ): - key = self.repo.create_key( "Key added through PyGithub", "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Mm0RjTNAYFfSCtUpO54usdseroUSIYg5KX4JoseTpqyiB/hqewjYLAdUq/tNIQzrkoEJWSyZrQt0ma7/YCyMYuNGd3DU6q6ZAyBeY3E9RyCiKjO3aTL2VKQGFvBVVmGdxGVSCITRphAcsKc/PF35/fg9XP9S0anMXcEFtdfMHz41SSw+XtE+Vc+6cX9FuI5qUfLGbkv8L1v3g4uw9VXlzq4GfTA+1S7D6mcoGHopAIXFlVr+2RfDKdSURMcB22z41fljO1MW4+zUS/4FyUTpL991es5fcwKXYoiE+x06VJeJJ1Krwx+DZj45uweV6cHXt2JwJEI9fWB6WyBlDejWw== vincent@IDEE" ) - self.assertEqual( key.id, 2626761 ) - - def testCollaborators( self ): - lyloa = self.g.get_user( "Lyloa" ) - self.assertFalse( self.repo.has_in_collaborators( lyloa ) ) - self.repo.add_to_collaborators( lyloa ) - self.assertTrue( self.repo.has_in_collaborators( lyloa ) ) - self.assertListKeyEqual( self.repo.get_collaborators(), lambda u: u.login, [ "jacquev6", "Lyloa" ] ) - self.repo.remove_from_collaborators( lyloa ) - self.assertFalse( self.repo.has_in_collaborators( lyloa ) ) - - def testCompare( self ): - comparison = self.repo.compare( "v0.6", "v0.7" ) - self.assertEqual( comparison.status, "ahead" ) - self.assertEqual( comparison.ahead_by, 4 ) - self.assertEqual( comparison.behind_by, 0 ) - self.assertEqual( comparison.diff_url, "https://github.com/jacquev6/PyGithub/compare/v0.6...v0.7.diff" ) - self.assertEqual( comparison.html_url, "https://github.com/jacquev6/PyGithub/compare/v0.6...v0.7" ) - self.assertEqual( comparison.url, "https://api.github.com/repos/jacquev6/PyGithub/compare/v0.6...v0.7" ) - self.assertEqual( comparison.patch_url, "https://github.com/jacquev6/PyGithub/compare/v0.6...v0.7.patch" ) - self.assertEqual( comparison.permalink_url, "https://github.com/jacquev6/PyGithub/compare/jacquev6:4303c5b...jacquev6:ecda065" ) - self.assertEqual( comparison.total_commits, 4 ) - self.assertListKeyEqual( comparison.files, lambda f: f.filename, [ "ReferenceOfClasses.md", "github/Github.py", "github/Requester.py", "setup.py" ] ) - self.assertEqual( comparison.base_commit.sha, "4303c5b90e2216d927155e9609436ccb8984c495" ) - self.assertListKeyEqual( comparison.commits, lambda c: c.sha, [ "5bb654d26dd014d36794acd1e6ecf3736f12aad7", "cb0313157bf904f2d364377d35d9397b269547a5", "0cec0d25e606c023a62a4fc7cdc815309ebf6d16", "ecda065e01876209d2bdf5fe4e91cee8ffaa9ff7" ] ) - - def testGetComments( self ): - self.assertListKeyEqual( - self.repo.get_comments(), - lambda c: c.body, - [ - "probably a noob question: does this completion refer to autocompletion in IDE's/editors? \nI have observed that this is pretty erratic sometimes. I'm using PyDev+Eclipse.\nFor example, in the tutorial from the readme, `g.get_u` gets autocompleted correctly, but `g.get_user().get_r` (or any method or attribute applicable to NamedUsers/AuthenticatedUser, really) does not show autocompletion to `g.get_user().get_repo()`. Is that by design? It makes exploring the library/API a bit cumbersome. ", - "No, it has nothing to do with auto-completion in IDEs :D\n\nGithub API v3 sends only the main part of objects in reply to some requests. So, if the user wants an attribute that has not been received yet, I have to do another request to complete the object.\n\nYet, in version 1.0 (see the milesone), my library will be much more readable for IDEs and their auto-completion mechanisms, because I am giving up the meta-description that I used until 0.6, and I'm now generating much more traditional code, that you will be able to explore as if it was written manually.\n\nIf you want to take the time to open an issue about auto-completion in IDEs, I'll deal with it in milestone 1.0.\n\nThanks !", - "Ah, thanks for the clarification. :blush:\n\nI made issue #27 for the autocompletion. I already suspected something like this meta-description magic, since I tried to read some of the code and it was pretty arcane. I attributed that to my pythonic noobness, though. Thank you. ", - "Comment created by PyGithub" - ] - ) - - def testGetCommits( self ): - self.assertListKeyBegin( self.repo.get_commits(), lambda c: c.sha, [ u'ecda065e01876209d2bdf5fe4e91cee8ffaa9ff7', u'0cec0d25e606c023a62a4fc7cdc815309ebf6d16', u'cb0313157bf904f2d364377d35d9397b269547a5', u'5bb654d26dd014d36794acd1e6ecf3736f12aad7', u'4303c5b90e2216d927155e9609436ccb8984c495', u'2a7e80e6421c5d4d201d60619068dea6bae612cb', u'0af24499a98e85f8ab2191898e8b809e5cebd4c5', u'e5ae923a68a9ae295ce5aa20b1227253de60e918', u'2f64b625f7e2afc9bef61d0decb459e2ef65c550', u'590798d349cba7de6e83b43aa5d4f8b0a38e685d', u'e7dca9143a23b8e2045a4a910a4a329007b10086', u'ab3f9b422cb3043d35cf6002fc9c042f8ead8c2a', u'632d8b63c32a2b79e87eb3b93e1ad228724de4bd', u'64c6a1e975e61b9c1449bed016cd19f33ee4b1c5', u'99963536fc81db3b9986c761b9dd08de22089aa2', u'8d57522bbd15d1fb6b616fae795cd8721deb1c4d', u'1140a91f3e45d09bc15463724f178a7ebf8e3149', u'936f4a97f1a86392637ec002bbf89ff036a5062d', u'e10470481795506e2c232720e2a9ecf588c8b567', u'e456549e5265406f8090ae5145255c8ca9ea5e4e', u'a91131be42eb328ae030f584af500f56aa08424b', u'2469c6e1aeb7919126a8271f6980b555b167e8b0', u'a655d0424135befd3a0d53f3f7eff2d1c754854f', u'ce62e91268aa34dad0ba0dbee4769933e3a71e50', u'1c88ee221b7f995855a1fdfac7d0ba19db918739', u'bd1a5dff3c547c634b2d89f5847218820e343883', u'b226b5b4e2f44107dde674e7a5d3e88d4e3518df', u'25dbd4053e982402c7d92139f167dbe46008c932', u'a0cc821c1beada4aa9ca0d5218664c5372720936', u'c1440bdf20bfeb62684c6d1779448719dce9d2df', u'1095d304b7fab3818dcb4c42093c8c56d3ac05e4', u'bd39726f7cf86ea7ffb33b5718241fdab5fc8f53', u'1d2b27824d20612066d84be42d6691c66bb18ef4', u'6af2bfd0d46bc0eeb8c37b85c7b3003e0e4ae297', u'a475d685d8ae709095d09094ea0962ac182d33f0', u'a85de99ea5b5e7b38bd68e076d09c49207b8687e', u'd24cf209ddd1758188c5f35344f76df818d09a46', u'0909fec395bb1f97e2580d6a029cfc64b352aff9', u'6e421e9e85e12008758870bc046bc2c6120af72a', u'32ed0ebc377efbed5b482b3d49ff54bf1715d55a', u'8213df1d744f251aa8e52229643a9f6ce352f3c0', u'69cc298fd159f19eb204dd09f17d31dc4abc3d41', u'85eef756353e13efcb24c726320cd2617c2a7bd8', u'50ac55b25ceba555b84709839f80447552450697', u'767d75a580279e457f9bc52bc308a17ff8ea0509', u'75e72ffa3066693291f7da03070666e8f885097a', u'504047e218e6b34a3828ccc408431634f17b9504', u'960db1d5c9853e9f5fbbc9237c2c166ceef1f080', u'877dde23e140bbf038f9a2d8f0f07b4e3a965c61', u'1c95ddfa09ec0aa1f07ee9ad50a77be1dd74b55e', u'99564c1cab139d1e4678f5f83f60d26f1210db7e', u'231926207709ceaa61e87b64e34e17d85adecd9c', u'fb722625dddb9a32f75190723f7da12683b7c4b2', u'cab9d71603e127bdd1f600a759dccea1781fa1ab', u'e648e5aeb5edc1fbf83e9d37d2a3cb57c005019a', u'4a5cf98e7f959f1b5d9af484760c25cd27d9180d', u'5d1add448e0b0b1dadb8c6094a9e5e19b255f67e', u'0d9fc99a4b5d1ec6473c9c81c888917c132ffa65', u'b56aa09011378b014221f86dffb8304957a9e6bd', u'3e8169c0a98ce1e2c6a32ae1256ae0f735065df5', u'378558f6cac6183b4a7100c0ce5eaad1cfff6717', u'58b4396aa0e7cb72911b75cb035798143a06e0ee', u'a3be28756101370fbc689eec3a7825c4c385a6c9', u'3d6bd49ce229243fea4bb46a937622d0ec7d4d1c', u'58cb0dbdef9765e0e913c726f923a47315aaf80e', u'7b7ac20c6fa27f72a24483c73ab1bf4deffc89f0', u'97f308e67383368a2d15788cac28e126c8528bb2', u'fc33a6de4f0e08d7ff2de05935517ec3932d212e', u'cc6d0fc044eadf2e6fde5da699f61654c1e691f3', u'2dd71f3777b87f2ba61cb20d2c67f10401e3eb2c', u'366ca58ca004b9129f9d435db8204ce0f5bc57c3', u'0d3b3ffd1e5c143af8725fdee808101f626f683d', u'157f9c13275738b6b39b8d7a874f5f0aee47cb18' ] ) - - def testGetCommitsWithArguments( self ): - self.assertListKeyEqual( self.repo.get_commits( "topic/RewriteWithGeneratedCode", "codegen/GenerateCode.py" ), lambda c: c.sha, [ "de386d5dc9cf103c90c4128eeca0e6abdd382065", "5b44982f6111bff2454243869df2e1c3086ccbba", "d6835ff949141957a733c8ddfa147026515ae493", "075d3d961d4614a2a0835d5583248adfc0687a7d", "8956796e7f462a49f499eac52fab901cdb59abdb", "283da5e7de6a4a3b6aaae7045909d70b643ad380", "d631e83b7901b0a0b6061b361130700a79505319" ] ) - - def testGetDownloads( self ): - self.assertListKeyEqual( self.repo.get_downloads(), lambda d: d.id, [ 245143 ] ) - - def testGetEvents( self ): - self.assertListKeyBegin( self.repo.get_events(), lambda e: e.type, [ "DownloadEvent", "DownloadEvent", "PushEvent", "IssuesEvent", "MemberEvent", "MemberEvent" ] ) - - def testGetForks( self ): - self.assertListKeyEqual( self.repo.get_forks(), lambda r: r.owner.login, [ "abersager" ] ) - - def testGetGitRefs( self ): - self.assertListKeyEqual( self.repo.get_git_refs(), lambda r: r.ref, [ "refs/heads/develop", "refs/heads/master", "refs/heads/topic/DependencyGraph", "refs/heads/topic/RewriteWithGeneratedCode", "refs/tags/v0.1", "refs/tags/v0.2", "refs/tags/v0.3", "refs/tags/v0.4", "refs/tags/v0.5", "refs/tags/v0.6", "refs/tags/v0.7" ] ) - - def testGetGitTreeWithRecursive( self ): - tree = self.repo.get_git_tree( "f492784d8ca837779650d1fb406a1a3587a764ad", True ) - self.assertEqual( len( tree.tree ), 90 ) - self.assertEqual( tree.tree[ 50 ].path, "github/GithubObjects/Gist.py" ) - - def testGetHooks( self ): - self.assertListKeyEqual( self.repo.get_hooks(), lambda h: h.id, [ 257993 ] ) - - def testGetIssues( self ): - 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 ): - 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 = datetime.datetime( 2012, 5, 28, 23, 0, 0 ) ), lambda i: i.id, [ 4793216, 4793162, 4793106, 3624556, 3619973, 3527266 ] ) - self.assertListKeyEqual( self.repo.get_issues( mentioned = otherUser ), lambda i: i.id, [ 4793162 ] ) - - def testGetIssuesWithWildcards( self ): - self.assertListKeyEqual( self.repo.get_issues( milestone = "*" ), lambda i: i.id, [ 4809786, 4793216, 4789817, 4452000, 3628022, 3624595, 3619973, 3527231 ] ) - self.assertListKeyEqual( self.repo.get_issues( milestone = "none" ), lambda i: i.id, [ 4823331, 4809803, 4809778, 4793106, 3643837, 3527245 ] ) - self.assertListKeyEqual( self.repo.get_issues( assignee = "*" ), lambda i: i.id, [ 4823331, 4809803, 4809786, 4809778, 4793216, 4793106, 4789817, 4452000, 3643837, 3628022, 3624595, 3527245, 3527231 ] ) - self.assertListKeyEqual( self.repo.get_issues( assignee = "none" ), lambda i: i.id, [ 3619973 ] ) - - def testGetKeys( self ): - self.assertListKeyEqual( self.repo.get_keys(), lambda k: k.title, [ "Key added through PyGithub" ] ) - - def testGetLabels( self ): - self.assertListKeyEqual( self.repo.get_labels(), lambda l: l.name, [ "Refactoring", "Public interface", "Functionalities", "Project management", "Bug", "Question" ] ) - - def testGetLanguages( self ): - self.assertEqual( self.repo.get_languages(), { "Python": 127266, "Shell": 673} ) - - def testGetMilestones( self ): - self.assertListKeyEqual( self.repo.get_milestones(), lambda m: m.id, [ 93547 ] ) - - def testGetMilestonesWithArguments( self ): - self.assertListKeyEqual( self.repo.get_milestones( "closed", "due_date", "asc" ), lambda m: m.id, [ 93546, 95354, 108652, 124045 ] ) - - def testGetIssuesEvents( self ): - self.assertListKeyBegin( self.repo.get_issues_events(), lambda e: e.event, [ "assigned", "subscribed", "closed", "assigned", "closed" ] ) - - def testGetNetworkEvents( self ): - self.assertListKeyBegin( self.repo.get_network_events(), lambda e: e.type, [ "DownloadEvent", "DownloadEvent", "PushEvent", "IssuesEvent", "MemberEvent" ] ) - - def testGetTeams( self ): - repo = self.g.get_organization( "BeaverSoftware" ).get_repo( "FatherBeaver" ) - self.assertListKeyEqual( repo.get_teams(), lambda t: t.name, [ "Members" ] ) - - def testGetWatchers( self ): - self.assertListKeyEqual( self.repo.get_watchers(), lambda u: u.login, [ "Stals", "att14", "jardon-u", "huxley", "mikofski", "L42y", "fanzeyi", "abersager", "waylan", "adericbourg", "tallforasmurf", "pvicente", "roskakori", "michaelpedersen", "BeaverSoftware" ] ) - - def testGetStargazers( self ): - self.assertListKeyEqual( self.repo.get_stargazers(), lambda u: u.login, [ "Stals", "att14", "jardon-u", "huxley", "mikofski", "L42y", "fanzeyi", "abersager", "waylan", "adericbourg", "tallforasmurf", "pvicente", "roskakori", "michaelpedersen", "stefanfoulis", "equus12", "JuRogn", "joshmoore", "jsilter", "dasapich", "ritratt", "hcilab", "vxnick", "pmuilu", "herlo", "malexw", "ahmetvurgun", "PengGu", "cosmin", "Swop", "kennethreitz", "bryandyck", "jason2506", "zsiciarz", "waawal", "gregorynicholas", "sente", "richmiller55", "thouis", "mazubieta", "michaelhood", "engie", "jtriley", "oangeor", "coryking", "noddi", "alejo8591", "omab", "Carreau", "bilderbuchi", "schwa", "rlerallut", "PengHub", "zoek1", "xobb1t", "notgary", "hattya", "ZebtinRis", "aaronhall", "youngsterxyf", "ailling", "gregwjacobs", "n0rmrx", "awylie", "firstthumb", "joshbrand", "berndca" ] ) - - def testGetSubscribers( self ): - self.assertListKeyEqual( self.repo.get_subscribers(), lambda u: u.login, [ "jacquev6", "equus12", "bilderbuchi", "hcilab", "hattya", "firstthumb", "gregwjacobs", "sagarsane", "liang456", "berndca", "Lyloa" ] ) - - def testCreatePull( self ): - pull = self.repo.create_pull( "Pull request created by PyGithub", "Body of the pull request", "topic/RewriteWithGeneratedCode", "BeaverSoftware:master" ) - self.assertEqual( pull.id, 1436215 ) - - def testCreatePullFromIssue( self ): - issue = self.repo.get_issue( 32 ) - pull = self.repo.create_pull( issue, "topic/RewriteWithGeneratedCode", "BeaverSoftware:master" ) - self.assertEqual( pull.id, 1436310 ) - - def testGetPulls( self ): - self.assertListKeyEqual( self.repo.get_pulls(), lambda p: p.id, [ 1436310 ] ) - - def testGetPullsWithArguments( self ): - self.assertListKeyEqual( self.repo.get_pulls( "closed" ), lambda p: p.id, [ 1448168, 1436310, 1436215 ] ) - - def testLegacySearchIssues( self ): - issues = self.repo.legacy_search_issues( "open", "search" ) - self.assertListKeyEqual( issues, lambda i: i.title, [ "Support new Search API" ] ) - - # Attributes retrieved from legacy API without lazy completion call - self.assertEqual( issues[ 0 ].number, 49 ) - self.assertEqual( issues[ 0 ].created_at, datetime.datetime( 2012, 6, 21, 12, 27, 38 ) ) - self.assertEqual( issues[ 0 ].comments, 4 ) - self.assertEqual( issues[ 0 ].body[ : 20 ], "New API ported from " ) - self.assertEqual( issues[ 0 ].title, "Support new Search API" ) - self.assertEqual( issues[ 0 ].updated_at, datetime.datetime( 2012, 6, 28, 21, 13, 25 ) ) - self.assertEqual( issues[ 0 ].user.login, "kukuts" ) - self.assertEqual( issues[ 0 ].user.url, "/users/kukuts" ) - self.assertListKeyEqual( issues[ 0 ].labels, lambda l: l.name, [ "Functionalities", "RequestedByUser" ] ) - self.assertEqual( issues[ 0 ].state, "open" ) - - def testAssignees( self ): - lyloa = self.g.get_user( "Lyloa" ) - jacquev6 = self.g.get_user( "jacquev6" ) - self.assertTrue( self.repo.has_in_assignees( jacquev6 ) ) - self.assertFalse( self.repo.has_in_assignees( lyloa ) ) - self.repo.add_to_collaborators( lyloa ) - self.assertTrue( self.repo.has_in_assignees( lyloa ) ) - self.assertListKeyEqual( self.repo.get_assignees(), lambda u: u.login, [ "jacquev6", "Lyloa" ] ) - self.repo.remove_from_collaborators( lyloa ) - self.assertFalse( self.repo.has_in_assignees( lyloa ) ) - - def testGetContents( self ): - self.assertEqual( len( self.repo.get_readme().content ), 10212 ) - self.assertEqual( len( self.repo.get_contents( "doc/ReferenceOfClasses.md" ).content ), 38121 ) - - def testGetArchiveLink( self ): - self.assertEqual( self.repo.get_archive_link( "tarball" ), "https://nodeload.github.com/jacquev6/PyGithub/tarball/master" ) - self.assertEqual( self.repo.get_archive_link( "zipball" ), "https://nodeload.github.com/jacquev6/PyGithub/zipball/master" ) - self.assertEqual( self.repo.get_archive_link( "zipball", "master" ), "https://nodeload.github.com/jacquev6/PyGithub/zipball/master" ) - self.assertEqual( self.repo.get_archive_link( "tarball", "develop" ), "https://nodeload.github.com/jacquev6/PyGithub/tarball/develop" ) - - def testGetBranch( self ): - branch = self.repo.get_branch( "develop" ) - self.assertEqual( branch.commit.sha, "03058a36164d2a7d946db205f25538434fa27d94" ) - - def testMergeWithoutMessage( self ): - commit = self.repo.merge( "branchForBase", "branchForHead" ) - self.assertEqual( commit.commit.message, "Merge branchForHead into branchForBase" ) - - def testMergeWithMessage( self ): - commit = self.repo.merge( "branchForBase", "branchForHead", "Commit message created by PyGithub" ) - self.assertEqual( commit.commit.message, "Commit message created by PyGithub" ) - - def testMergeWithNothingToDo( self ): - commit = self.repo.merge( "branchForBase", "branchForHead", "Commit message created by PyGithub" ) - self.assertEqual( commit, None ) - - def testMergeWithConflict( self ): - try: - commit = self.repo.merge( "branchForBase", "branchForHead" ) - self.fail( "Should have raised" ) - except github.GithubException, exception: - self.assertEqual( exception.status, 409 ) - self.assertEqual( exception.data, { "message": "Merge conflict" } ) diff --git a/test/RepositoryKey.py b/test/RepositoryKey.py deleted file mode 100644 index 118df084..00000000 --- a/test/RepositoryKey.py +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -class RepositoryKey( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.key = self.g.get_user().get_repo( "PyGithub" ).get_key( 2626761 ) - - def testAttributes( self ): - self.assertEqual( self.key.id, 2626761 ) - self.assertEqual( self.key.key, "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Mm0RjTNAYFfSCtUpO54usdseroUSIYg5KX4JoseTpqyiB/hqewjYLAdUq/tNIQzrkoEJWSyZrQt0ma7/YCyMYuNGd3DU6q6ZAyBeY3E9RyCiKjO3aTL2VKQGFvBVVmGdxGVSCITRphAcsKc/PF35/fg9XP9S0anMXcEFtdfMHz41SSw+XtE+Vc+6cX9FuI5qUfLGbkv8L1v3g4uw9VXlzq4GfTA+1S7D6mcoGHopAIXFlVr+2RfDKdSURMcB22z41fljO1MW4+zUS/4FyUTpL991es5fcwKXYoiE+x06VJeJJ1Krwx+DZj45uweV6cHXt2JwJEI9fWB6WyBlDejWw==" ) - self.assertEqual( self.key.title, "Key added through PyGithub" ) - self.assertEqual( self.key.url, "https://api.github.com/user/keys/2626761" ) - self.assertEqual( self.key.verified, True ) - - def testEdit( self ): - self.key.edit( "Title edited by PyGithub", "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==" ) - self.assertEqual( self.key.key, "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==" ) - self.assertEqual( self.key.title, "Title edited by PyGithub" ) - - def testEditWithoutParameters( self ): - self.key.edit() - - def testDelete( self ): - self.key.delete() diff --git a/test/Tag.py b/test/Tag.py deleted file mode 100644 index cee1e060..00000000 --- a/test/Tag.py +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -class Tag( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.tag = self.g.get_user().get_repo( "PyGithub" ).get_tags()[ 0 ] - - def testAttributes( self ): - self.assertEqual( self.tag.commit.sha, "636e6112deb72277b3bffcc3303cd7e8a7431a5d" ) - self.assertEqual( self.tag.name, "v0.3" ) - self.assertEqual( self.tag.tarball_url, "https://github.com/jacquev6/PyGithub/tarball/v0.3" ) - self.assertEqual( self.tag.zipball_url, "https://github.com/jacquev6/PyGithub/zipball/v0.3" ) diff --git a/test/Team.py b/test/Team.py deleted file mode 100644 index 10b622a8..00000000 --- a/test/Team.py +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -class Team( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.org = self.g.get_organization( "BeaverSoftware" ) - self.team = self.org.get_team( 189850 ) - - def testAttributes( self ): - self.assertEqual( self.team.id, 189850 ) - self.assertEqual( self.team.members_count, 0 ) - self.assertEqual( self.team.name, "Team created by PyGithub" ) - self.assertEqual( self.team.permission, "pull" ) - self.assertEqual( self.team.repos_count, 0 ) - self.assertEqual( self.team.url, "https://api.github.com/teams/189850" ) - - def testMembers( self ): - user = self.g.get_user( "jacquev6" ) - self.assertListKeyEqual( self.team.get_members(), lambda u: u.login, [] ) - self.assertFalse( self.team.has_in_members( user ) ) - self.team.add_to_members( user ) - self.assertListKeyEqual( self.team.get_members(), lambda u: u.login, [ "jacquev6" ] ) - self.assertTrue( self.team.has_in_members( user ) ) - self.team.remove_from_members( user ) - self.assertListKeyEqual( self.team.get_members(), lambda u: u.login, [] ) - self.assertFalse( self.team.has_in_members( user ) ) - - def testRepos( self ): - repo = self.org.get_repo( "FatherBeaver" ) - self.assertListKeyEqual( self.team.get_repos(), lambda r: r.name, [] ) - self.assertFalse( self.team.has_in_repos( repo ) ) - self.team.add_to_repos( repo ) - self.assertListKeyEqual( self.team.get_repos(), lambda r: r.name, [ "FatherBeaver" ] ) - self.assertTrue( self.team.has_in_repos( repo ) ) - self.team.remove_from_repos( repo ) - self.assertListKeyEqual( self.team.get_repos(), lambda r: r.name, [] ) - self.assertFalse( self.team.has_in_repos( repo ) ) - - def testEditWithoutArguments( self ): - self.team.edit( "Name edited by PyGithub" ) - self.assertEqual( self.team.name, "Name edited by PyGithub" ) - - def testEditWithAllArguments( self ): - self.team.edit( "Name edited twice by PyGithub", "admin" ) - self.assertEqual( self.team.name, "Name edited twice by PyGithub" ) - self.assertEqual( self.team.permission, "admin" ) - - def testDelete( self ): - self.team.delete() diff --git a/test/UserKey.py b/test/UserKey.py deleted file mode 100644 index 948f7c04..00000000 --- a/test/UserKey.py +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 2012 Vincent Jacques -# vincent@vincent-jacques.net - -# This file is part of PyGithub. http://vincent-jacques.net/PyGithub - -# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public License along with PyGithub. If not, see . - -import Framework - -class UserKey( Framework.TestCase ): - def setUp( self ): - Framework.TestCase.setUp( self ) - self.key = self.g.get_user().get_key( 2626650 ) - - def testAttributes( self ): - self.assertEqual( self.key.id, 2626650 ) - self.assertEqual( self.key.key, "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2Mm0RjTNAYFfSCtUpO54usdseroUSIYg5KX4JoseTpqyiB/hqewjYLAdUq/tNIQzrkoEJWSyZrQt0ma7/YCyMYuNGd3DU6q6ZAyBeY3E9RyCiKjO3aTL2VKQGFvBVVmGdxGVSCITRphAcsKc/PF35/fg9XP9S0anMXcEFtdfMHz41SSw+XtE+Vc+6cX9FuI5qUfLGbkv8L1v3g4uw9VXlzq4GfTA+1S7D6mcoGHopAIXFlVr+2RfDKdSURMcB22z41fljO1MW4+zUS/4FyUTpL991es5fcwKXYoiE+x06VJeJJ1Krwx+DZj45uweV6cHXt2JwJEI9fWB6WyBlDejWw==" ) - self.assertEqual( self.key.title, "Key added through PyGithub" ) - self.assertEqual( self.key.url, "https://api.github.com/user/keys/2626650" ) - self.assertEqual( self.key.verified, True ) - - def testEditWithoutArguments( self ): - self.key.edit() - - def testEditWithAllArguments( self ): - self.key.edit( "Title edited by PyGithub", "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==" ) - self.assertEqual( self.key.key, "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5Q58YmzZjU64prR5Pk91MfeHezOTgLqDYmepYbv3qjguiHtPai1vSai5WvUv3hgf9DArXsXE5CV6yoBIhAdGtpJKExHuQ2m4XTFCdbrgfQ3ypcSdgzEiQemyTA6TWwhbuwjJ1IqJMYOVLH+FBCkD8pyIpUDO7v3vaR2TCEuNwOS7lbsRsW3OkGYnUKjaPaCTe/inrqb7I3OE8cPhWJ3dM/zzzBj22J4LCNKhjKua8TFS74xGm3lNDZ6/twQl4n4xmrH/3tG+WOJicNO3JohNHqK9T0pILnr3epEyfdkBjcG0qXApqWvH2WipJhaH6of8Gdr0Z/K/7p8QFddmwNgdPQ==" ) - self.assertEqual( self.key.title, "Title edited by PyGithub" ) - - def testDelete( self ): - self.key.delete()