-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathtest_issues.py
More file actions
82 lines (65 loc) · 2.78 KB
/
test_issues.py
File metadata and controls
82 lines (65 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Copyright (C) 2011-2012 James Rowe <[email protected]>
#
# This file is part of python-github2, and is made available under the 3-clause
# BSD license. See LICENSE for the full details.
from datetime import datetime
from nose.tools import eq_
import utils
class Issue(utils.HttpMockTestCase):
def test_properties(self):
issue = self.client.issues.show('ask/python-github2', 24)
eq_(issue.position, 24.0)
eq_(issue.number, 24)
eq_(issue.votes, 0)
eq_(len(issue.body), 164)
eq_(issue.title, 'Pagination support for commits.')
eq_(issue.user, 'svetlyak40wt')
eq_(issue.state, 'open')
eq_(issue.labels, [])
eq_(issue.created_at, datetime(2010, 12, 8, 23, 50, 26))
eq_(issue.closed_at, None)
eq_(issue.updated_at, datetime(2011, 1, 4, 16, 26, 7))
eq_(issue.diff_url,
'https://github.com/ask/python-github2/pull/24.diff')
eq_(issue.patch_url,
'https://github.com/ask/python-github2/pull/24.patch')
eq_(issue.pull_request_url,
'https://github.com/ask/python-github2/pull/24')
def test_issue_repr(self):
issue = self.client.issues.show('ask/python-github2', 24)
eq_(repr(issue), '<Issue: Pagination suppor...>')
class Comment(utils.HttpMockTestCase):
def test_properties(self):
comments = self.client.issues.comments('ask/python-github2', 24)
comment = comments[0]
eq_(comment.created_at, datetime(2010, 12, 9, 22, 37, 26))
eq_(comment.updated_at, datetime(2010, 12, 9, 22, 37, 26))
eq_(len(comment.body), 267)
eq_(comment.id, 601871)
eq_(comment.user, 'nvie')
def test_comment_repr(self):
comments = self.client.issues.comments('ask/python-github2', 24)
eq_(repr(comments[1]), '<Comment: Sure, but I have ...>')
class IssueQueries(utils.HttpMockTestCase):
"""Test issue querying."""
def test_search(self):
issues = self.client.issues.search('ask/python-github2', 'timezone',
'closed')
eq_(len(issues), 2)
eq_(issues[1].number, 39)
def test_list(self):
issues = self.client.issues.list('ask/python-github2')
eq_(len(issues), 4)
eq_(issues[-1].number, 58)
def test_list_with_state(self):
issues = self.client.issues.list('ask/python-github2', "closed")
eq_(len(issues), 55)
eq_(issues[0].number, 59)
def test_issue_labels(self):
labels = self.client.issues.list_labels('JNRowe/misc-overlay')
eq_(len(labels), 4)
eq_(labels[0], 'feature')
def test_list_by_label(self):
issues = self.client.issues.list_by_label('JNRowe/misc-overlay', 'bug')
eq_(len(issues), 30)
eq_(issues[-1].number, 328)