Beispiel #1
0
    def __init__(self, event, issue=None):
        super(IssueEvent, self).__init__(event, None)
        # The type of event:
        #   ('closed', 'reopened', 'subscribed', 'merged', 'referenced',
        #    'mentioned', 'assigned')
        #: The type of event, e.g., closed
        self.event = event.get('event')
        #: SHA of the commit.
        self.commit_id = event.get('commit_id')
        self._api = event.get('url', '')

        #: :class:`Issue <github3.issue.Issue>` where this comment was made.
        self.issue = issue
        if event.get('issue'):
            from github3.issues import Issue
            self.issue = Issue(event.get('issue'), self)

        #: Number of comments
        self.comments = event.get('comments', 0)

        #: datetime object representing when the event was created.
        self.created_at = self._strptime(event.get('created_at'))

        #: Dictionary of links for the pull request
        self.pull_request = event.get('pull_request', {})

        self._uniq = self.commit_id
Beispiel #2
0
def _issuecomm(payload):
    from github3.issues import Issue
    from github3.issues.comment import IssueComment
    if payload.get('issue'):
        payload['issue'] = Issue(payload['issue'], None)
    if payload.get('comment'):
        payload['comment'] = IssueComment(payload['comment'], None)
    return payload
Beispiel #3
0
 def __init__(self, data, session=None):
     result = data.copy()
     #: Score of the result
     self.score = result.pop('score')
     #: Text matches
     self.text_matches = result.pop('text_matches', [])
     #: Issue object
     self.issue = Issue(result, self)
 def test_issue_137(self):
     """
     GitHub sometimes returns `pull` as part of of the `html_url` for Issue
     requests.
     """
     issue = Issue(
         helper.create_example_data_helper('issue_137')(), self.session)
     self.assertEqual(issue.html_url,
                      "https://github.com/sigmavirus24/github3.py/pull/1")
Beispiel #5
0
 def test_issue_137(self):
     """
     GitHub sometimes returns `pull` as part of of the `html_url` for Issue
     requests.
     """
     i = Issue(load('issue_137'))
     self.assertEqual(i.html_url,
                      "https://github.com/sigmavirus24/github3.py/pull/1")
     self.assertEqual(i.repository, ("sigmavirus24", "github3.py"))
Beispiel #6
0
def _issueevent(payload):
    from github3.issues import Issue
    if payload.get('issue'):
        payload['issue'] = Issue(payload['issue'], None)
    return payload
Beispiel #7
0
 def test_enterprise(self):
     Issue(load('issue_enterprise'))
Beispiel #8
0
 def test_equality(self):
     i = Issue(load('issue'))
     assert self.i == i
     i._uniq = 1
     assert self.i != i
Beispiel #9
0
 def setUp(self):
     super(TestIssue, self).setUp()
     self.i = Issue(self.i.to_json(), self.g)
Beispiel #10
0
 def __init__(self, methodName='runTest'):
     super(TestIssue, self).__init__(methodName)
     self.i = Issue(load('issue'))
     self.api = ("https://api.github.com/repos/sigmavirus24/github3.py/"
                 "issues/1")