Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 3 commits
  • 6 files changed
  • 0 commit comments
  • 1 contributor
Showing with 17 additions and 12 deletions.
  1. +2 −2 github3/auths.py
  2. +3 −1 github3/repos.py
  3. +3 −2 tests/test_auths.py
  4. +2 −1 tests/test_gists.py
  5. +3 −3 tests/test_github.py
  6. +4 −3 tests/test_repos.py
View
4 github3/auths.py
@@ -12,14 +12,14 @@
class Authorization(GitHubCore):
"""The :class:`Authorization <Authorization>` object."""
- def __init__(self, auth, session):
+ def __init__(self, auth, session=None):
super(Authorization, self).__init__(auth, session)
#: Details about the application (name, url)
self.app = auth.get('app', {})
#: Returns the Authorization token
self.token = auth.get('token', '')
#: App name
- self.name = auth.app.get('name', '')
+ self.name = self.app.get('name', '')
#: URL about the note
self.note_url = auth.get('note_url', '')
#: Note about the authorization
View
4 github3/repos.py
@@ -1959,7 +1959,9 @@ def __init__(self, commit, session=None):
#: :class:`User <github3.users.User>` who committed the commit.
self.committer = User(commit.get('committer', {}), self._session)
#: :class:`Commit <github3.git.Commit>`.
- self.commit = Commit(commit.get('commit'), self._session)
+ self.commit = commit.get('commit')
+ if self.commit:
+ self.commit = Commit(self.commit, self._session)
self.sha = commit.get('sha')
#: The number of additions made in the commit.
View
5 tests/test_auths.py
@@ -17,7 +17,7 @@ def __init__(self, methodName='runTest'):
'token': 'upupdowndownleftrightba',
'created_at': '2012-02-28T01:45:49Z',
}
- self.authorization = Authorization(json)
+ self.authorization = Authorization(json, None)
else:
self.authorization = self.g.authorize(self.user, self.pw, [])
self.deleted = False
@@ -61,7 +61,8 @@ def test_update(self):
if self.deleted:
self.authorization.delete()
- def test_delelte(self):
+ def test_delete(self):
if not self.auth:
return
expect(self.authorization.delete()).is_True()
+ self.deleted = True
View
3 tests/test_gists.py
@@ -19,7 +19,8 @@ def test_repr(self):
expect(repr(self.gist)) != ''
def test_iter_forks(self):
- expect(next(self.gist.iter_forks())).isinstance(Gist)
+ forks = [f for f in self.gist.iter_forks()]
+ expect(forks).list_of(Gist)
def test_list_forks(self):
expect(self.gist.list_forks()).isinstance(list)
View
6 tests/test_github.py
@@ -1,5 +1,5 @@
import github3
-from .base import expect, expect_str, BaseTest
+from .base import expect, expect_str, BaseTest, str_test
from github3.repos import Repository
from github3.events import Event
from github3.auths import Authorization
@@ -247,13 +247,13 @@ def test_list_emails(self):
self.raisesGHE(self.g.list_emails)
if self.auth:
- expect(self._g.list_emails()).list_of(dict)
+ expect(self._g.list_emails()).list_of(str_test)
def test_iter_emails(self):
self.raisesGHE(self.g.iter_emails)
if self.auth:
- expect(next(self._g.iter_emails())).isinstance(dict)
+ expect_str(next(self._g.iter_emails()))
def test_list_events(self):
expect(self.g.list_events()).list_of(Event)
View
7 tests/test_repos.py
@@ -208,7 +208,8 @@ def test_list_comments(self):
self.fail('No commenter with login kennethreitz')
def test_iter_comments(self):
- expect(next(self.repo.iter_comments())).isinstance(RepoComment)
+ expect(next(self.requests_repo.iter_comments())
+ ).isinstance(RepoComment)
def test_list_comments_on_commit(self):
comments = self.requests_repo.list_comments_on_commit(
@@ -259,8 +260,8 @@ def test_list_forks(self):
expect(self.repo.list_forks('oldest')).list_of(Repository)
def test_iter_forks(self):
- expect(next(self.repo.list_forks())).isinstance(Repository)
- expect(next(self.repo.list_forks('oldest'))).isinstance(Repository)
+ expect(next(self.repo.iter_forks())).isinstance(Repository)
+ expect(next(self.repo.iter_forks('oldest'))).isinstance(Repository)
def test_iter_issues(self):
expect(next(self.repo.iter_issues())).isinstance(Issue)

No commit comments for this range

Something went wrong with that request. Please try again.