Skip to content
Snippets Groups Projects
Commit 8ac6b270 authored by Barry Morrison's avatar Barry Morrison
Browse files

tests pass, fixes #248

parent 0eec5f64
No related branches found
No related tags found
No related merge requests found
Showing
with 90 additions and 90 deletions
Loading
Loading
@@ -17,8 +17,8 @@ __copyright__ = 'Copyright 2012-2014 Ian Cordasco'
__version__ = '0.9.1'
__version_info__ = tuple(int(i) for i in __version__.split('.'))
 
from github3.api import *
from github3.github import GitHub, GitHubEnterprise, GitHubStatus
from github3.models import GitHubError
from .api import *
from .github import GitHub, GitHubEnterprise, GitHubStatus
from .models import GitHubError
 
# flake8: noqa
Loading
Loading
@@ -8,8 +8,8 @@ This module contains the Authorization object.
"""
from __future__ import unicode_literals
 
from github3.decorators import requires_basic_auth
from github3.models import GitHubCore
from .decorators import requires_basic_auth
from .models import GitHubCore
 
 
class Authorization(GitHubCore):
Loading
Loading
Loading
Loading
@@ -37,7 +37,7 @@ def requires_auth(func):
if auth:
return func(self, *args, **kwargs)
else:
from github3.models import GitHubError
from .models import GitHubError
# Mock a 401 response
r = generate_fake_error_response(
'{"message": "Requires authentication"}'
Loading
Loading
@@ -58,7 +58,7 @@ def requires_basic_auth(func):
if hasattr(self, '_session') and self._session.auth:
return func(self, *args, **kwargs)
else:
from github3.models import GitHubError
from .models import GitHubError
# Mock a 401 response
r = generate_fake_error_response(
'{"message": "Requires username/password authentication"}'
Loading
Loading
@@ -80,7 +80,7 @@ def requires_app_credentials(func):
if client_id and client_secret:
return func(self, *args, **kwargs)
else:
from github3.models import GitHubError
from .models import GitHubError
# Mock a 401 response
r = generate_fake_error_response(
'{"message": "Requires username/password authentication"}'
Loading
Loading
Loading
Loading
@@ -8,7 +8,7 @@ This module contains the class(es) related to Events
"""
from __future__ import unicode_literals
 
from github3.models import GitHubObject
from .models import GitHubObject
 
 
class Event(GitHubObject):
Loading
Loading
@@ -31,8 +31,8 @@ class Event(GitHubObject):
 
def __init__(self, event):
super(Event, self).__init__(event)
from github3.users import User
from github3.orgs import Organization
from .users import User
from .orgs import Organization
#: :class:`User <github3.users.User>` object representing the actor.
self.actor = User(event.get('actor')) if event.get('actor') else None
#: datetime object representing when the event was created.
Loading
Loading
@@ -75,36 +75,36 @@ class Event(GitHubObject):
 
 
def _commitcomment(payload):
from github3.repos.comment import RepoComment
from .repos.comment import RepoComment
if payload.get('comment'):
payload['comment'] = RepoComment(payload['comment'], None)
return payload
 
 
def _follow(payload):
from github3.users import User
from .users import User
if payload.get('target'):
payload['target'] = User(payload['target'], None)
return payload
 
 
def _forkev(payload):
from github3.repos import Repository
from .repos import Repository
if payload.get('forkee'):
payload['forkee'] = Repository(payload['forkee'], None)
return payload
 
 
def _gist(payload):
from github3.gists import Gist
from .gists import Gist
if payload.get('gist'):
payload['gist'] = Gist(payload['gist'], None)
return payload
 
 
def _issuecomm(payload):
from github3.issues import Issue
from github3.issues.comment import IssueComment
from .issues import Issue
from .issues.comment import IssueComment
if payload.get('issue'):
payload['issue'] = Issue(payload['issue'], None)
if payload.get('comment'):
Loading
Loading
@@ -113,35 +113,35 @@ def _issuecomm(payload):
 
 
def _issueevent(payload):
from github3.issues import Issue
from .issues import Issue
if payload.get('issue'):
payload['issue'] = Issue(payload['issue'], None)
return payload
 
 
def _member(payload):
from github3.users import User
from .users import User
if payload.get('member'):
payload['member'] = User(payload['member'], None)
return payload
 
 
def _pullreqev(payload):
from github3.pulls import PullRequest
from .pulls import PullRequest
if payload.get('pull_request'):
payload['pull_request'] = PullRequest(payload['pull_request'], None)
return payload
 
 
def _pullreqcomm(payload):
from github3.pulls import ReviewComment
from .pulls import ReviewComment
if payload.get('comment'):
payload['comment'] = ReviewComment(payload['comment'], None)
return payload
 
 
def _release(payload):
from github3.repos.release import Release
from .repos.release import Release
release = payload.get('release')
if release:
payload['release'] = Release(release)
Loading
Loading
@@ -149,9 +149,9 @@ def _release(payload):
 
 
def _team(payload):
from github3.orgs import Team
from github3.repos import Repository
from github3.users import User
from .orgs import Team
from .repos import Repository
from .users import User
if payload.get('team'):
payload['team'] = Team(payload['team'], None)
if payload.get('repo'):
Loading
Loading
Loading
Loading
@@ -8,8 +8,8 @@ Module containing the logic for a GistComment
"""
from __future__ import unicode_literals
 
from github3.models import BaseComment
from github3.users import User
from ..models import BaseComment
from ..users import User
 
 
class GistComment(BaseComment):
Loading
Loading
Loading
Loading
@@ -7,7 +7,7 @@ Module containing the logic for the GistFile object.
"""
from __future__ import unicode_literals
 
from github3.models import GitHubObject
from ..models import GitHubObject
 
 
class GistFile(GitHubObject):
Loading
Loading
Loading
Loading
@@ -9,12 +9,12 @@ This module contains the Gist class alone for simplicity.
from __future__ import unicode_literals
 
from json import dumps
from github3.models import GitHubCore
from github3.decorators import requires_auth
from github3.gists.comment import GistComment
from github3.gists.file import GistFile
from github3.gists.history import GistHistory
from github3.users import User
from ..models import GitHubCore
from ..decorators import requires_auth
from .comment import GistComment
from .file import GistFile
from .history import GistHistory
from ..users import User
 
 
class Gist(GitHubCore):
Loading
Loading
Loading
Loading
@@ -8,8 +8,8 @@ Module containing the logic for the GistHistory object.
"""
from __future__ import unicode_literals
 
from github3.models import GitHubCore
from github3.users import User
from ..models import GitHubCore
from ..users import User
 
 
class GistHistory(GitHubCore):
Loading
Loading
@@ -63,6 +63,6 @@ class GistHistory(GitHubCore):
:returns: :class:`Gist <github3.gists.gist.Gist>`
 
"""
from github3.gists.gist import Gist
from .gist import Gist
json = self._json(self._get(self._api), 200)
return Gist(json, self)
Loading
Loading
@@ -11,9 +11,9 @@ from __future__ import unicode_literals
 
from json import dumps
from base64 import b64decode
from github3.models import GitHubObject, GitHubCore, BaseCommit
from github3.users import User
from github3.decorators import requires_auth
from .models import GitHubObject, GitHubCore, BaseCommit
from .users import User
from .decorators import requires_auth
 
 
class Blob(GitHubObject):
Loading
Loading
Loading
Loading
@@ -8,20 +8,20 @@ This module contains the main GitHub session object.
"""
from __future__ import unicode_literals
 
from github3.auths import Authorization
from github3.decorators import (requires_auth, requires_basic_auth,
from .auths import Authorization
from .decorators import (requires_auth, requires_basic_auth,
requires_app_credentials)
from github3.events import Event
from github3.gists import Gist
from github3.issues import Issue, issue_params
from github3.models import GitHubCore
from github3.orgs import Organization, Team
from github3.repos import Repository
from github3.search import (CodeSearchResult, IssueSearchResult,
from .events import Event
from .gists import Gist
from .issues import Issue, issue_params
from .models import GitHubCore
from .orgs import Organization, Team
from .repos import Repository
from .search import (CodeSearchResult, IssueSearchResult,
RepositorySearchResult, UserSearchResult)
from github3.structs import SearchIterator
from github3.users import User, Key
from github3.notifications import Thread
from .structs import SearchIterator
from .users import User, Key
from .notifications import Thread
from uritemplate import URITemplate
 
 
Loading
Loading
@@ -1459,8 +1459,8 @@ class GitHubEnterprise(GitHub):
 
There is no need to provide the end of the url (e.g., /api/v3/), that will
be taken care of by us.
If you have a self signed SSL for your local github enterprise you can
If you have a self signed SSL for your local github enterprise you can
override the validation by passing `verify=False`.
"""
def __init__(self, url, login='', password='', token='', verify=True):
Loading
Loading
Loading
Loading
@@ -7,7 +7,7 @@ This module contains the classes related to issues.
See also: http://developer.github.com/v3/issues/
"""
 
from github3.utils import timestamp_parameter
from ..utils import timestamp_parameter
from .issue import Issue
 
__all__ = [Issue]
Loading
Loading
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
 
from github3.models import BaseComment
from github3.users import User
from ..models import BaseComment
from ..users import User
 
 
class IssueComment(BaseComment):
Loading
Loading
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
 
from github3.models import GitHubCore
from github3.users import User
from ..models import GitHubCore
from ..users import User
 
 
class IssueEvent(GitHubCore):
Loading
Loading
@@ -36,7 +36,7 @@ class IssueEvent(GitHubCore):
#: :class:`Issue <github3.issues.Issue>` where this comment was made.
self.issue = event.get('issue')
if self.issue:
from github3.issues import Issue
from .issue import Issue
self.issue = Issue(self.issue, self)
 
#: :class:`User <github3.users.User>` who caused this event.
Loading
Loading
Loading
Loading
@@ -3,13 +3,13 @@ from __future__ import unicode_literals
 
from re import match
from json import dumps
from github3.decorators import requires_auth
from github3.issues.comment import IssueComment
from github3.issues.event import IssueEvent
from github3.issues.label import Label
from github3.issues.milestone import Milestone
from github3.models import GitHubCore
from github3.users import User
from ..decorators import requires_auth
from .comment import IssueComment
from .event import IssueEvent
from .label import Label
from .milestone import Milestone
from ..models import GitHubCore
from ..users import User
from uritemplate import URITemplate
 
 
Loading
Loading
Loading
Loading
@@ -2,8 +2,8 @@
from __future__ import unicode_literals
 
from json import dumps
from github3.decorators import requires_auth
from github3.models import GitHubCore
from ..decorators import requires_auth
from ..models import GitHubCore
 
 
class Label(GitHubCore):
Loading
Loading
Loading
Loading
@@ -2,10 +2,10 @@
from __future__ import unicode_literals
 
from json import dumps
from github3.decorators import requires_auth
from github3.issues.label import Label
from github3.models import GitHubCore
from github3.users import User
from ..decorators import requires_auth
from .label import Label
from ..models import GitHubCore
from ..users import User
 
 
class Milestone(GitHubCore):
Loading
Loading
Loading
Loading
@@ -10,9 +10,9 @@ from __future__ import unicode_literals
 
from json import dumps
from requests.compat import urlparse, is_py2
from github3.decorators import requires_auth
from github3.session import GitHubSession
from github3.utils import UTC
from .decorators import requires_auth
from .session import GitHubSession
from .utils import UTC
from datetime import datetime
from logging import getLogger
 
Loading
Loading
@@ -31,7 +31,7 @@ class GitHubObject(object):
self.last_modified = json.pop('Last-Modified', None)
self._uniq = json.get('url', None)
self._json_data = json
def to_json(self):
"""Return the json representing this object."""
return self._json_data
Loading
Loading
@@ -169,7 +169,7 @@ class GitHubCore(GitHubObject):
:param params dict: (optional) Parameters for the request
:param str etag: (optional), ETag from the last call
"""
from github3.structs import GitHubIterator
from .structs import GitHubIterator
return GitHubIterator(count, url, cls, self, params, etag)
 
@property
Loading
Loading
Loading
Loading
@@ -10,7 +10,7 @@ See also: http://developer.github.com/v3/activity/notifications/
from __future__ import unicode_literals
 
from json import dumps
from github3.models import GitHubCore
from .models import GitHubCore
 
 
class Thread(GitHubCore):
Loading
Loading
@@ -39,7 +39,7 @@ class Thread(GitHubCore):
#: Thread information
self.thread = notif.get('thread', {})
 
from github3.repos import Repository
from .repos import Repository
#: Repository the comment was made on
self.repository = Repository(notif.get('repository', {}), self)
#: When the thread was last updated
Loading
Loading
Loading
Loading
@@ -9,11 +9,11 @@ This module contains all of the classes related to organizations.
from __future__ import unicode_literals
 
from json import dumps
from github3.events import Event
from github3.models import BaseAccount, GitHubCore
from github3.repos import Repository
from github3.users import User
from github3.decorators import requires_auth
from .events import Event
from .models import BaseAccount, GitHubCore
from .repos import Repository
from .users import User
from .decorators import requires_auth
from uritemplate import URITemplate
 
 
Loading
Loading
Loading
Loading
@@ -10,11 +10,11 @@ from __future__ import unicode_literals
 
from re import match
from json import dumps
from github3.git import Commit
from github3.models import GitHubObject, GitHubCore, BaseComment
from github3.users import User
from github3.decorators import requires_auth
from github3.issues.comment import IssueComment
from .git import Commit
from .models import GitHubObject, GitHubCore, BaseComment
from .users import User
from .decorators import requires_auth
from .issues.comment import IssueComment
from uritemplate import URITemplate
 
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment