10000 Rename Issue#iter_comments · qiwsir/github3.py@a9b1387 · GitHub
[go: up one dir, main page]

Skip to content

Commit a9b1387

Browse files
committed
Rename Issue#iter_comments
1 parent 67a19a8 commit a9b1387

File tree

7 files changed

+171
-17
lines changed

7 files changed

+171
-17
lines changed

HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Old name New name
5555
``GitHub#iter_repos`` ``GitHub#reposistories``
5656
``GitHub#iter_user_repos`` ``GitHub#repositories_by``
5757
``GitHub#iter_user_teams`` ``GitHub#user_teams``
58+
``Issue#iter_comments`` ``Issue#comments``
5859
``Organization#iter_members`` ``Organization#members``
5960
``Organization#iter_public_members`` ``Organization#public_members``
6061
``Organization#iter_repos`` ``Organization#repositories``

github3/issues/issue.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,16 @@ def comment(self, id_num):
157157
json = self._json(self._get(url), 200)
158158
return IssueComment(json) if json else None
159159

160+
def comments(self, number=-1):
161+
r"""Iterate over the comments on this issue.
162+
163+
:param int number: (optional), number of comments to iterate over
164+
:returns: iterator of
165+
:class:`IssueComment <github3.issues.comment.IssueComment>`\ s
166+
"""
167+
url = self._build_url('comments', base_url=self._api)
168+
return self._iter(int(number), url, IssueComment)
169+
160170
@requires_auth
161171
def create_comment(self, body):
162172
"""Create a comment on this issue.
@@ -211,16 +221,6 @@ def is_closed(self):
211221
return True
212222
return False
213223

214-
def iter_comments(self, number=-1):
215-
"""Iterate over the comments on this issue.
216-
217-
:param int number: (optional), number of comments to iterate over
218-
:returns: iterator of
219-
:class:`IssueComment <github3.issues.comment.IssueComment>`\ s
220-
"""
221-
url = self._build_url('comments', base_url=self._api)
222-
return self._iter(int(number), url, IssueComment)
223-
224224
def iter_events(self, number=-1):
225225
"""Iterate over events associated with this issue only.
226226

tests/cassettes/Issue_comments.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"http_interactions": [{"request": {"body": {"string": "", "encoding": "utf-8"}, "headers": {"Accept-Charset": "utf-8", "Content-Type": "application/json", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "User-Agent": "github3.py/1.0.0"}, "method": "GET", "uri": "https://api.github.com/repos/sigmavirus24/github3.py"}, "response": {"body": {"string": "", "base64_string": "H4sIAAAAAAAAA62YTY/iOBCG/wrKdWlMSNNApNHMnnb3Nofey16QkzjE6iSObAdER/3f93Uc8sFogW6v1EKQdj1+Xa5yqtx4PPHCYOMvN74/90paMC/0DlxndRQsqrM399I6z/fdPxQ/FPTIZa1Wz2QySpxKJr2w8XJx4CUY46GgmGlWz8ttsJx79Eg1lfta5hiXaV2pkBD7UC0stVZMxqLUrNSLWBSkJtb4+/HbCrSD7BgG68X+8zZYvyTbXbpbrdnLbuVvthFjfrILaJxuYHA1V8W7eSwckylyJTjTRX4l0UprTa4GpyLPxQmU60Xdm4j0lsbTLYWXhy9SYNkQoTMG32JJH8ZRXOnPi2qtGmyw0nueGI7ChkmWfFpYZwdZJj4+GiJZJVpgHalY8kpzUX5e4MQaNCEPtOTv9Gs0WCtAjLTPS2mtYM2OiNXPm1uzhlSSH2l8Nq6RLGb8CGd/EXllD6I+Vyat/0ZQGNdzzfY0KUyapjRX7GPutdNrDGofzJGVj0b/9BhIWL+rmPDnWWeinOU8klSeZ6mQM46climNEauzE46ZGcJ19gfXf9bR7Peffx0DCMS4t17JzcxtnT9JxqkcQ7qzJzcRSE8AIOmNnZ04xr4h+OzyKUaq00hIqsW9Q+O2wAmoIeOfJpY0o4WT8BYAUCaEmydbAEBcqZo9FNq3F95yFLnkT1kXkT3yHsma22hLgFaqcM6XjDl5sIc05HIqIx3KOHPDXhgNsd/a3aYHJ6nGHpgoF5ETBy9K0kIaojJq30N676rOUA1jApUsdZZqGD1US8f9bmUaSI/ES1Bj6510Xhik6Tya0/JQ04MbtYdg182r+kDf7xYxt3NnoABpKjjJo9r9kBs4RqmtHZDvbi4dMAO0LUhulzl3HDAqbFoXFAW/VxfcJnaISdj/D1gTp9do8/t+GXNfrmE0ZDiT7aHf0V282536F52kGebo2gWnkLgwSPNbRXVmTi5MVVHJXER3CNJEFMXWYrFoMkbbsrpg0jGDLQEoKuMMVaOLzubCQNVTUN1W66mRmaB6zwVNnHzbQwC02+ii1RLGMVahT3US2ALGxILnTGlRup2xA2XMLoXmKY8f6Vhup9sE1HxXvIzZnOb5HFGrecwRx6i1zS6i4GRuHrIELAPXBLZTyRlC2snrkllGQ2ynGUuGRiTZU40GYrX0V0/L4MkPXv1duN6G6+AfrKSuksmY56flFn+v/iZcrcL10oypapWNMO0Q/+V1ucI1RLh+MUNwAnYhiG+4gsAnrj1+6e9HLYW5NYChUtlg+GMwC//jfqQzi3PE0lXQPz7n8fq1dN8UUjNRsAplQnfT0q8yqM4LeDpB+5WIWC3QAxOzMv6Oobtgt54UBLGoS+yHv3uZeyeqUbvi1Tt+eCkk+qbPTE3V3qapF2pZm64ST4ZjYPTwxN943/HZpq2jb3BfVHApRXdfVCJJ0e9XrOzYgwzbOCovNDajEUb3ILtbRcJSWud6b4tnyE5Q9eeigu6S6RPavgvY0MYVx2XZ249/AfzD9aY9EwAA", "encoding": "utf-8"}, "headers": {"vary": "Accept, Accept-Encoding", "x-served-by": "62a1303ae95931e56e387e87d354bb24", "x-xss-protection": "1; mode=block", "x-content-type-options": "nosniff", "etag": "\"ee1469828784a316b923eb33d476b2a1\"", "access-control-allow-credentials": "true", "status": "200 OK", "x-ratelimit-remaining": "59", "x-github-media-type": "github.v3; param=full; format=json", "access-control-expose-headers": "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "transfer-encoding": "chunked", "x-github-request-id": "48A0C4D3:0875:142040AE:53EFB2DE", "cache-control": "public, max-age=60, s-maxage=60", "last-modified": "Fri, 08 Aug 2014 17:22:50 GMT", "date": "Sat, 16 Aug 2014 19:37:02 GMT", "access-control-allow-origin": "*", "content-security-policy": "default-src 'none'", "content-encoding": "gzip", "strict-transport-security": "max-age=31536000; includeSubdomains", "server": "GitHub.com", "x-ratelimit-limit": "60", "x-frame-options": "deny", "content-type": "application/json; charset=utf-8", "x-ratelimit-reset": "1408221422"}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/sigmavirus24/github3.py"}, "recorded_at": "2014-08-16T19:37:02"}, {"request": {"body": {"string": "", "encoding": "utf-8"}, "headers": {"Accept-Charset": "utf-8", "Content-Type": "application/json", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "User-Agent": "github3.py/1.0.0"}, "method": "GET", "uri": "https://api.github.com/repos/sigmavirus24/github3.py/issues/187"}, "response": {"body": {"string": "", "base64_string": "H4sIAAAAAAAAA71WXa8aNxD9K5YfE4K9y9eyIlSt2oe89SFVpZaKeNcDWPXaK9sLIYj/3vEukMtNdO/lBlUIiTWec+Ycz4z3QBunaU43IdQ+Z0zUqr9WYdMU/dJWzEFtPfNqXYmtco1Ph6z7d9Cv90x534BnSTahPapFAdov7wLHOrADM6KCI4JjLhWYcC/4Mxwiw/aOuB0Yom5CpR9Z8cDVF/mpJM3TUconaZr1qGmqAhzN0eseDSpowEP71ZZNtIWEnSUrUQbriGjCBhNofNx9oNqulcGtDynx7xZ8yLMB71GxFUG4xwfXLvpTLUS00pqAXG1ZNKwL/mn7PkW0tTthRFhaJsNsMBrLbLqapiMYT9NkkhUAiZwORLmKtfJkkUSy65q7yVDcvLJa2x2iPBZ1XdzfErFL5AVFmfUrUTDywGzYAHqLkmIZr5V/roa/k1QbdcDG82GpZMTxeDYO5M2JneIwrZ3BjA5tf7eATeFLp+qgrLndtatoRLNuLYz6Il6HhtEeQdrRc7PCNgqjX9LW37G6Czuw2qmtKPfRGgclqC2a/UrIR/GIGPZ17N4/Youi9SrAUsgqtulKaA/H8yyl+d+Hp1vl6fHcDVH2S7NGmjhJkbR7KK22OB4oJIlME3rs3YPnN+H3X4lOT2cmnkLCy3sxmY0wJcTR94DwavGiUAJ+7sT7u1Du7Q5vx7cfhPnKHJdJXCbd8kUzn2ac0+M/bcOGaL+tIQZqW/6LWXXnjRPY43g2gBtMo3WPVkqDD9ZcFi73VT7Au9ABgsmlCAiY8mT4jifvePaR85yP8tHoLyRoavntniT5mCb5MMtHSdxTautPMB1tYeV+GW8uxJ3V85kgGwer94vLy0FAkQFcewUUTgmzLBsXlGFRXuPZMOXj8WiQTNIJn3I+GYwXdH5+s7g9eMbEnFRCAqmAoGitvgD5QAw2oiPydPeBJCqQGVRzEYjQesbwZ3/G6vnCLAzK+Fl7G7egv9KTYEkBREgsivgbpzOZlVbC/Pxa016YM9aukVVjyjjE+uRPaAGIICvYkbW1ksBnUdV4UBHnnE0kipXQJoAet5YG+ByP6vVGvNCEzoB+1P2s6Cu5P6DzpPH/kPem0/emv3AoEb/Pivx0pfLTj8k8tUux77r0+B+ALh1POgsAAA==", "encoding": "utf-8"}, "headers": {"vary": "Accept, Accept-Encoding", "x-served-by": "a1d8c69b807c8e21f06cad9da377d1b0", "x-xss-protection": "1; mode=block", "x-content-type-options": "nosniff", "etag": "\"9c8f535a8bdb69177f2992aa89cc39b4\"", "access-control-allow-credentials": "true", "status": "200 OK", "x-ratelimit-remaining": "58", "x-github-media-type": "github.v3; param=full; format=json", "access-control-expose-headers": "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "transfer-encoding": "chunked", "x-github-request-id": "48A0C4D3:0875:142040FF:53EFB2DE", "cache-control": "public, max-age=60, s-maxage=60", "last-modified": "Sat, 16 Aug 2014 02:27:44 GMT", "date": "Sat, 16 Aug 2014 19:37:02 GMT", "access-control-allow-origin": "*", "content-security-policy": "default-src 'none'", "content-encoding": "gzip", "strict-transport-security": "max-age=31536000; includeSubdomains", "server": "GitHub.com", "x-ratelimit-limit": "60", "x-frame-options": "deny", "content-type": "application/json; charset=utf-8", "x-ratelimit-reset": "1408221422"}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/sigmavirus24/github3.py/issues/187"}, "recorded_at": "2014-08-16T19:37:02"}, {"request": {"body": {"string": "", "encoding": "utf-8"}, "headers": {"Accept-Charset": "utf-8", "Content-Type": "application/json", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "User-Agent": "github3.py/1.0.0"}, "method": "GET", "uri": "https://api.github.com/repos/sigmavirus24/github3.py/issues/187/comments?per_page=100"}, "response": {"body": {"string": "", "base64_string": "H4sIAAAAAAAAA+1YXY/iNhT9K276sH0AkgAZkoil6qp92KrbjqqtKrVUyCQOWJPEqe3AUjT/vceBnSUZCsPHqPMwD0jIuef43uOYc7l/rq1SplZozbUuVGjbtOCdGdfzctqJRGZLVghlKz7L6ILLUnX79uZpr1OsbK5UyZSNwIzlWtk9dxAETs+1WuDL0kmdeof2CKHrD76uuLfM7R3iar3BfE7S2ANp8tgKP5O3rFIxaYVrKxUznkMUpmik2Z2i023ojR94gduy6IJqKptZVItqK5/hikSuIUylZGlvwN8u3nbBNpNbDpOB5TCPud3Yi/qJHzDW73ndQeI7NPb6HvOmPQAOHpPZTNm1dA8fQC00EWkqlmBoFlR/F5qb2A84pLf5zvPZWRzArW2h5wyaopR7IxBX+tSEKswab6jSEx4bFoUTkSw+MaktCiktc2Szrq5BRVdOVSR5obnIT02uhgWXkDOa83/oOVzAKlBUt/PE2ioMsGxhruyJ4A1obReSL2i0MpJIFjG+gMRnETbQ4NOrguFG/GauIgTnmk1onJnrmNBUsfuWFUlGNTakGnFdx+23Hbft+B8dN+z7Ydf/A7iyiI/GTEW8mphrApphMfpZaEa0IIqlSUiGLBt9L/I3mmRMzhhZ4jdRlJrEIirNj111bEMbUSRsF2RoF6NxPs7B8w5R70GkaZquiEHN5mZlTmOiRMbIrz/c/mTz2xUe5QScBQCJFBnRTGncBGC4Iss5ywnXZEkV4VmRMrMri/GQYlGUaQzGBRIT8g7LS5amJBGS0JywT9QAOlVWEKMqVLNPRq96lUcrrIozhb2cqrYFPaplcrSYyaYaiXrweTkVEeu+dX0fdgMHUh22gbN8eEP8TD4M8sc+vJsmajKW2e07fg+hZznxBrzXiSO37/e8m9gPkqDrsZug6w78KWNuHPRolJie4QlO3Ej46YcA+pPcuHaAZ/vxHpZLHLnxVl3gyTWm67lynXbX06H/yb5cYzvVmWvg0725Br+OOzcyqrk75LnInz1YtHfEnx9iav4c8wWJUqrU27HFMsrT9t8lDDtuQ7N0NbZGv+TkY8la5EcYoDNoEdMYEFil4226gtsPBE2C47TIO7SEK/JBSMkVHHgpwROOc1K3xifaydBGZrD+4eMEE0lnxrSR3HdVH6BoDv/mGVOVxXcOYBvFkSuaFSq9rK04kPZOye/foCHR9I5ht682kEYr8j+d2DjffxrQ5SWpPM5rCn7pei6VDa3P6Lx3nZi2yXz+Q8Dt09E1daz2HF34xj4kXpf0Obqufs+0CE83/D3jlP3Tjw3xM3VdIH/cdb1OP3YnYa/Tj9fpRzUyebnTD28QOr1j3dXnmMb043eURqY0ukNrIs3IgmRmeIG/AaqD4UVcjUKqgQPNMbnAeoeE3+ybMJzH9MXfzsPjP/Rf/wJiGPWszRYAAA==", "encoding": "utf-8"}, "headers": {"vary": "Accept, Accept-Encoding", "x-served-by": "3061975e1f37121b3751604ad153c687", "x-xss-protection": "1; mode=block", "x-content-type-options": "nosniff", "etag": "\"ce2781d7530ec339ede9dce49e349d6b\"", "access-control-allow-credentials": "true", "status": "200 OK", "x-ratelimit-remaining": "57", "x-github-media-type": "github.v3; param=full; format=json", "access-control-expose-headers": "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "transfer-encoding": "chunked", "x-github-request-id": "48A0C4D3:0875:14204127:53EFB2DE", "cache-control": "public, max-age=60, s-maxage=60", "date": "Sat, 16 Aug 2014 19:37:02 GMT", "access-control-allow-origin": "*", "content-security-policy": "default-src 'none'", "content-encoding": "gzip", "strict-transport-security": "max-age=31536000; includeSubdomains", "server": "GitHub.com", "x-ratelimit-limit": "60", "x-frame-options": "deny", "content-type": "application/json; charset=utf-8", "x-ratelimit-reset": "1408221422"}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/sigmavirus24/github3.py/issues/187/comments?per_page=100"}, "recorded_at": "2014-08-16T19:37:02"}], "recorded_with": "betamax/0.4.0"}

tests/integration/test_issue.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
1+
"""Integration tests for Issues."""
12
import github3
23

34
from .helper import IntegrationHelper
45

56

67
class TestIssue(IntegrationHelper):
8+
9+
"""Integration tests for methods on the Issue class."""
10+
11+
def test_comments(self):
12+
"""Test the ability to retrieve comments on an issue."""
13 B41A +
cassette_name = self.cassette_name('comments')
14+
with self.recorder.use_cassette(cassette_name):
15+
issue = self.gh.issue('sigmavirus24', 'github3.py', 187)
16+
assert issue is not None
17+
comments = list(issue.comments())
18+
19+
assert len(comments) > 0
20+
for comment in comments:
21+
assert isinstance(comment, github3.issues.comment.IssueComment)
22+
723
def test_iter_events(self):
824
"""Test the ability to iterate over issue events."""
925
self.token_login()

tests/test_issues.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,6 @@ def test_is_closed(self):
241241
self.i.state = 'open'
242242
assert self.i.is_closed() is False
243243

244-
def test_iter_comments(self):
245-
self.response('issue_comment', _iter=True)
246-
self.get(self.api + '/comments')
247-
248-
assert isinstance((next(self.i.iter_comments())), IssueComment)
249-
self.mock_assertions()
250-
251244
def test_iter_events(self):
252245
self.response('issue_event', _iter=True)
253246
self.get(self.api + '/events')

tests/unit/issue_example_data

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
{
2+
"url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
3+
"html_url": "https://github.com/octocat/Hello-World/issues/1347",
4+
"number": 1347,
5+
"state": "open",
6+
"title": "Found a bug",
7+
"body": "I'm having a problem with this.",
8+
"user": {
9+
"login": "octocat",
10+
"id": 1,
11+
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
12+
"gravatar_id": "somehexcode",
13+
"url": "https://api.github.com/users/octocat",
14+
"html_url": "https://github.com/octocat",
15+
"followers_url": "https://api.github.com/users/octocat/followers",
16+
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
17+
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
18+
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
19+
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
20+
"organizations_url": "https://api.github.com/users/octocat/orgs",
21+
"repos_url": "https://api.github.com/users/octocat/repos",
22+
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
23+
"received_events_url": "https://api.github.com/users/octocat/received_events",
24+
"type": "User",
25+
"site_admin": false
26+
},
27+
"labels": [
28+
{
29+
"url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
30+
"name": "bug",
31+
"color": "f29513"
32+
}
33+
],
34+
"assignee": {
35+
"login": "octocat",
36+
"id": 1,
37+
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
38+
"gravatar_id": "somehexcode",
39+
"url": "https://api.github.com/users/octocat",
40+
"html_url": "https://github.com/octocat",
41+
"followers_url": "https://api.github.com/users/octocat/followers",
42+
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
43+
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
44+
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
45+
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
46+
"organizations_url": "https://api.github.com/users/octocat/orgs",
47+
"repos_url": "https://api.github.com/users/octocat/repos",
48+
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
49+
"received_events_url": "https://api.github.com/users/octocat/received_events",
50+
"type": "User",
51+
"site_admin": false
52+
},
53+
"milestone": {
54+
"url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
55+
"number": 1,
56+
"state": "open",
57+
"title": "v1.0",
58+
"description": "",
59+
"creator": {
60+
"login": "octocat",
61+
"id": 1,
62+
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
63+
"gravatar_id": "somehexcode",
64+
"url": "https://api.github.com/users/octocat",
65+
"html_url": "https://github.com/octocat",
66+
"followers_url": "https://api.github.com/users/octocat/followers",
67+
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
68+
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
69+
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
70+
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
71+
"organizations_url": "https://api.github.com/users/octocat/orgs",
72+
"repos_url": "https://api.github.com/users/octocat/repos",
73+
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
74+
"received_events_url": "https://api.github.com/users/octocat/received_events",
75+
"type": "User",
76+
"site_admin": false
77+
},
78+
"open_issues": 4,
79+
"closed_issues": 8,
80+
"created_at": "2011-04-10T20:09:31Z",
81+
"updated_at": "2014-03-03T18:58:10Z",
82+
"due_on": null
83+
},
84+
"comments": 0,
85+
"pull_request": {
86+
"url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347",
87+
"html_url": "https://github.com/octocat/Hello-World/pull/1347",
88+
"diff_url": "https://github.com/octocat/Hello-World/pull/1347.diff",
89+
"patch_url": "https://github.com/octocat/Hello-World/pull/1347.patch"
90+
},
91+
"closed_at": null,
92+
"created_at": "2011-04-22T13:33:48Z",
93+
"updated_at": "2011-04-22T13:33:48Z",
94+
"closed_by": {
95+
"login": "octocat",
96+
"id": 1,
97+
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
98+
"gravatar_id": "somehexcode",
99+
"url": "https://api.github.com/users/octocat",
100+
"html_url": "https://github.com/octocat",
101+
"followers_url": "https://api.github.com/users/octocat/followers",
102+
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
103+
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
104+
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
105+
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
106+
"organizations_url": "https://api.github.com/users/octocat/orgs",
107+
"repos_url": "https://api.github.com/users/octocat/repos",
108+
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
109+
"received_events_url": "https://api.github.com/users/octocat/received_events",
110+
"type": "User",
111+
"site_admin": false
112+
}
113+
}

tests/unit/test_issues_issue.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""Unit tests for the Issue class."""
2+
import github3
3+
4+
from .helper import (UnitIteratorHelper, create_url_helper,
5+
create_example_data_helper)
6+
7+
url_for = create_url_helper(
8+
'https://api.github.com/repos/octocat/Hello-World/issues/1347'
9+
)
10+
11+
get_issue_example_data = create_example_data_helper('issue_example_data')
12+
13+
14+
class TestIssueIterators(UnitIteratorHelper):
15+
16+
"""Test Issue methods that return iterators."""
17+
18+
described_class = github3.issues.Issue
19+
example_data = get_issue_example_data()
20+
21+
def test_comments(self):
22+
"""Test the request to retrieve an issue's comments."""
23+
i = self.instance.comments()
24+
self.get_next(i)
25+
26+
self.session.get.assert_called_once_with(
27+
url_for('comments'),
28+
params={'per_page': 100},
29+
headers={}
30+
)

0 commit comments

Comments
 (0)
0