8000 Merge pull request #663 from mindw/Vampire/combined-status · pythonthings/github3.py@5544e97 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5544e97

Browse files
authored
Merge pull request sigmavirus24#663 from mindw/Vampire/combined-status
Picking up sigmavirus24#599 Add retrieving of the combined status of a RepoCommit
2 parents 9aa43ea + 6c73f1e commit 5544e97

File tree

10 files changed

+261
-6
lines changed

10 files changed

+261
-6
lines changed

AUTHORS.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,6 @@ Contributors
142142
- Alexander Koshelev <daevaorn@gmail.com>
143143

144144
- Gabi Davar (@mindw)
145+
146+
- Björn Kautler (@Vampire)
147+

LATEST_VERSION_NOTES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Unreleased
77
- Deprecate ``Organization#events`` in favor of ``Organization#public_events``.
88
- Fix test failtures on windows caused by unclosed file handles.
99
- Add ``Tag.tagger_as_User`` which attempts to return the tagger as as User.
10+
- Add ``Repo.statuses`` and a corresponding ``repo.status.CombinedStatus`` to
11+
get a combined view of commit statuses for a given ref.
1012

1113
1.0.0a4: 2016-02-19
1214
~~~~~~~~~~~~~~~~~~~

docs/repos.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ This part of the documentation covers:
2222
- :class:`RepoCommit <github3.repos.commit.RepoCommit>`
2323
- :class:`Comparison <github3.repos.comparison.Comparison>`
2424
- :class:`Status <github3.repos.status.Status>`
25+
- :class:`CombinedStatus <github3.repos.status.CombinedStatus>`
2526
- :class:`ContributorStats <github3.repos.stats.ContributorStats>`
2627

2728
None of these objects should be instantiated directly by the user (developer).
@@ -153,6 +154,11 @@ about `comments <http://developer.github.com/v3/repos/comments/>`_.
153154

154155
---------
155156

157+
.. autoclass:: github3.repos.status.CombinedStatus
158+
:members:
159+
160+
---------
161+
156162
.. module:: github3.repos.stats
157163

158164
.. autoclass:: github3.repos.stats.ContributorStats

example-notebooks/statuses-api.ipynb

Lines changed: 109 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"language": "python",
4747
"metadata": {},
4848
"outputs": [],
49-
"prompt_number": 5
49+
"prompt_number": 1
5050
},
5151
{
5252
"cell_type": "markdown",
@@ -66,7 +66,7 @@
6666
"language": "python",
6767
"metadata": {},
6868
"outputs": [],
69-
"prompt_number": 7
69+
"prompt_number": 2
7070
},
7171
{
7272
"cell_type": "markdown",
@@ -130,7 +130,113 @@
130130
]
131131
}
132132
],
133-
"prompt_number": 8
133+
"prompt_number": 3
134+
},
135+
{
136+
"cell_type": "heading",
137+
"level": 2,
138+
"metadata": {},
139+
"source": [
140+
"Listing Combined Status Associated with a Reference"
141+
]
142+
},
143+
{
144+
"cell_type": "code",
145+
"collapsed": false,
146+
"input": [
147+
"import github3\n",
148+
"\n",
149+
"\n",
150+
"repository = github3.repository('sigmavirus24', 'github3.py')"
151+
],
152+
"language": "python",
153+
"metadata": {},
154+
"outputs": [],
155+
"prompt_number": 1
156+
},
157+
{
158+
"cell_type": "markdown",
159+
"metadata": {},
160+
"source": [
161+
"With a repository object, we can now retrieve the statuses from a number of different commit-like objects which we can retrieve using the repository's ``commit`` method."
162+
]
163+
},
164+
{
165+
"cell_type": "code",
166+
"collapsed": false,
167+
"input": [
168+
"commit = repository.commit('9df71a9772d5f43e332c855a32d4689f28289989')\n",
169+
"tag = repository.commit('0.9.3')\n",
170+
"branch = repository.commit('stable/0.9')"
171+
],
172+
"language": "python",
173+
"metadata": {},
174+
"outputs": [],
175+
"prompt_number": 2
176+
},
177+
{
178+
"cell_type": "markdown",
179+
"metadata": {},
180+
"source": [
181+
"Each of these bindings now hold a reference to a different ``RepoCommit`` object and each has a ``status`` method. We can retrieve the combined status about each reference and print them."
182+
]
183+
},
184+
{
185+
"cell_type": "code",
186+
"collapsed": false,
187+
"input": [
188+
"for ref in (commit, tag, branch):\n",
189+
" print('Showing combined status for \"{0.sha}\" ({0.html_url})'.format(ref))\n",
190+
" combined_status = ref.status()\n",
191+
" print(\" State: {0.state}; Total count: {0.total_count}\".format(combined_status))\n",
192+
" print(\" Statuses:\")\n",
193+
" for status in combined_status.statuses:\n",
194+
" print(\" State: {0.state}; Description: {0.description}; Context: {0.context}\".format(status))"
195+
],
196+
"language": "python",
197+
"metadata": {},
198+
"outputs": [
199+
{
200+
"output_type": "stream",
201+
"stream": "stdout",
202+
"text": [
203+
"Showing combined status for \"9df71a9772d5f43e332c855a32d4689f28289989\" (https://github.com/sigmavirus24/github3.py/commit/9df71a9772d5f43e332c855a32d4689f28289989)\n",
204+
" State: success; Total count: 1"
205+
]
206+
},
207+
{
208+
"output_type": "stream",
209+
"stream": "stdout",
210+
"text": [
211+
"\n",
212+
" Statuses:\n",
213+
" State: success; Description: The Travis CI build passed; Context: continuous-integration/travis-ci\n",
214+
"Showing combined status for \"52a3f30e05cf434285e775979f01f1a8355049a7\" (https://github.com/sigmavirus24/github3.py/commit/52a3f30e05cf434285e775979f01f1a8355049a7)\n",
215+
" State: success; Total count: 1"
216+
]
217+
},
218+
{
219+
"output_type": "stream",
220+
"stream": "stdout",
221+
"text": [
222+
"\n",
223+
" Statuses:\n",
224+
" State: success; Description: The Travis CI build passed; Context: continuous-integration/travis-ci\n",
225+
"Showing combined status for \"c4c3fc3ea3b56152303a1a856d7d7fe220b9b8b4\" (https://github.com/sigmavirus24/github3.py/commit/c4c3fc3ea3b56152303a1a856d7d7fe220b9b8b4)\n",
226+
" State: failure; Total count: 1"
227+
]
228+
},
229+
{
230+
"output_type": "stream",
231+
"stream": "stdout",
232+
"text": [
233+
"\n",
234+
" Statuses:\n",
235+
" State: failure; Description: The Travis CI build failed; Context: continuous-integration/travis-ci/push\n"
236+
]
237+
}
238+
],
239+
"prompt_number": 3
134240
},
135241
{
136242
"cell_type": "heading",

github3/repos/commit.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,16 @@ def patch(self):
9191
headers={'Accept': 'application/vnd.github.patch'})
9292
return resp.content if self._boolean(resp, 200, 404) else b''
9393

94+
def status(self):
95+
"""Retrieve the combined status for this commit.
96+
97+
:returns: the combined status for this commit
98+
:rtype: :class:`~github3.repos.status.CombinedStatus`
99+
"""
100+
url = self._build_url('status', base_url=self._api)
101+
json = self._json(self._get(url), 200)
102+
return self._instance_or_null(status.CombinedStatus, json)
103+
94104
def statuses(self):
95105
"""Retrieve the statuses for this commit.
96106

github3/repos/status.py

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@
1313

1414

1515
class Status(GitHubCore):
16-
"""The :class:`Status <Status>` object. This represents information from
17-
the Repo Status API.
16+
"""The :class:`Status <Status>` object.
17+
18+
This represents information from the Repo Status API.
1819
1920
See also: http://developer.github.com/v3/repos/statuses/
2021
"""
22+
2123
def _update_attributes(self, status):
2224
#: A string label to differentiate this status from the status of
2325
#: other systems
@@ -46,3 +48,40 @@ def _update_attributes(self, status):
4648

4749
def _repr(self):
4850
return '<Status [{s.id}:{s.state}]>'.format(s=self)
51+
52+
53+
class CombinedStatus(GitHubCore):
54+
"""The :class:`CombinedStatus <CombinedStatus>` object.
55+
56+
This represents combined information from the Repo Status API.
57+
58+
See also: http://developer.github.com/v3/repos/statuses/
59+
"""
60+
61+
def _update_attributes(self, combined_status):
62+
#: State of the combined status, e.g., 'success', 'pending', 'failure'
63+
self.state = self._get_attribute(combined_status, 'state')
64+
65+
#: ref's SHA
66+
self.sha = self._get_attribute(combined_status, 'sha')
67+
68+
#: Total count of sub-statuses
69+
self.total_count = self._get_attribute(combined_status, 'total_count')
70+
71+
#: List of :class:`Status <github3.repos.status.Status>`
72+
#: objects.
73+
statuses = self._get_attribute(combined_status, 'statuses', [])
74+
self.statuses = [Status(s) for s in statuses]
75+
76+
from . import Repository
77+
#: Repository the combined status belongs too.
78+
self.repository = self._class_attribute(
79+
combined_status, 'repository', Repository, self
80+
)
81+
82+
#: commit URL
83+
self.commit_url = self._get_attribute(combined_status, 'commit_url')
84+
85+
def _repr(self):
86+
f = '<CombinedStatus [{s.state}:{s.total_count} sub-statuses]>'
87+
return f.format(s=self)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"http_interactions": [{"recorded_at": "2017-01-27T22:33:47", "request": {"body": {"encoding": "utf-8", "string": ""}, "uri": "https://api.github.com/repos/sigmavirus24/github3.py", "method": "GET", "headers": {"Accept": "application/vnd.github.drax-preview+json", "Accept-Encoding": "gzip, deflate", "Content-Type": "application/json", "User-Agent": "github3.py/1.0.0a4", "Connection": "keep-alive", "Accept-Charset": "utf-8"}}, "response": {"body": {"encoding": "utf-8", "string": "", "base64_string": "H4sIAAAAAAAAA62YwW7jNhCGX8XQtY5pS8kmEbDY7antqXtIL70YtERbRChRICm7jpB3709SsiQvajthgSCwZc7Hn0POaIZtxPMoTR5Xy8fVah5VtGRRGu24KZpNsqiP0TzaNkKsux8035V0z1Wj43syGSUPFVNR2kZC7ngFxngoKHaa+H75lCznEd1TQ9W6UQLjCmNqnRLiH+qFpzaaqUxWhlVmkcmSNMQbf9t/TUDbqY5hsREenLFq3nG8MWCanAkqTCnOJPipncnZ4K0UQh5AORd9bSJysrSedBRe7T5JgWVLpCkYfIclvVtHcG0+LspZtdhAbdY8txyNDVEs/7Cwzg6y7P6/t0SxWjpgs9GZ4rXhsvq4wIk1aFLtaMXf6OdosNaAWGkfl+KsYM32OIsfN/dmLakV39PsaF2jWMb4Hs7+JPLMHkRzrG3Y/oVDYV3PDVvTvLRhuKVCs/d55KY3GOQezBF1t57+aZjn7LSrmPDH0RSymgm+UVQdZ1upZhwxq7Y0w1mdHZBGZjius9+4+b3ZzH798cfeRi/GvZ6UXIxc5/xJME7lWNKVPbmIQHgCAEmv7BjEsfYtwf8unjKEOt1IRY28ljQuC5yAWjL+as+SYbQMEu4AABVShnnSAQDiWjfspqN9eeGOo0kfP1VTbnzKuyVqLqM9AVqpRp6vGAvy4AnSkj4rIxyqrAjD9oyW+E9ut+kuSKq1B2Yj5CaIgxclcZCW6IL695BZh6qzVMuYQBXbBku1jBPUqMD9djIt5ITES9Bg64N09gzSdh4VtNo1dBdGPUGw6/ZVvaNvV4uYy7EzUIC0FZrimyY8yQ0cq9TXDoj3MJcOmAHqCpLLZc4VB4wKG+eCsuTX6oLLxA4xOfb/A9ae03O0/X69jLku1zJaMuRkn/Q7eoh3u6zf6xzP0bUDQUeiZ5D2l5qawmYuTFVTxUJEdwjSbiiKrcVi0RaMurK6ZCowgj0BKKqyAlVjiM62Z6DqKalx1frWysxRvQtJ8yDfniAA+m0M0eoJ4/2v0YcGCXSAMbHkgmkjq7AcO1DG7EoavuXZLR3L5XCbgNpvmlcZm1Mh5ji1hmcc5xi1tt1FFJwszEOegGXgGsB3KoLhSAd5XTHPaInvNHNWC3kMzkIjjA1ixdDd5Gtq0JXEy1V8t0zuVsnL6jl9eEofkr8xpqnzyZjHu+XqLn54WSUp/u5jO6ZudDHC+CGPL3GMu4s0cRik1e5c4xPuLfAfdyU/XRqM+hR7FQFDrYvB8Ptglv7HpUpnlgkc0LNIun3O/fm77roppBayZDVqj9H1jLdL6uMCrs7R1OUy0wsu7cL4G0auHp6fnidVRiabCvvxJfkyjw7UoCDG+3z8sK9OTp2knZrqtY/9KDWqsa0qngy5ZfTwwF/50NBilJWsezPfGnbTxXGMZMyVkt21U4VcgGuFmlXdbCdhT74/BccZjYZgKfixX0m3sJxtaSPM2hfpWEmO7kLIGksRPGOVhmta217iJ3d1gx+6y7Q/u6+6zv9B2xilXpRriP3HLU51g2uZoY+vmDmgZe3VOonjcqlbb3L//i9S0x5Q2hMAAA=="}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/sigmavirus24/github3.py", "headers": {"Server": "GitHub.com", "Cache-Control": "public, max-age=60, s-maxage=60", "X-GitHub-Request-Id": "BB0F:2C94:6EA107D:8BA26C5:588BCACB", "ETag": "W/\"b489787b00572f2716ce91cbb0c2bd5a\"", "Date": "Fri, 27 Jan 2017 22:33:47 GMT", "X-RateLimit-Limit": "60", "Content-Security-Policy": "default-src 'none'", "Content-Type": "application/json; charset=utf-8", "X-GitHub-Media-Type": "github.drax-preview; format=json", "X-Served-By": "a241e1a8264a6ace03db946c85b92db3", "Vary": "Accept", "Transfer-Encoding": "chunked", "X-Content-Type-Options": "nosniff", "Status": "200 OK", "Last-Modified": "Wed, 25 Jan 2017 13:13:42 GMT", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "Content-Encoding": "gzip", "Access-Control-Allow-Origin": "*", "X-RateLimit-Remaining": "59", "X-RateLimit-Reset": "1485560027", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "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"}}}, {"recorded_at": "2017-01-27T22:33:47", "request": {"body": {"encoding": "utf-8", "string": ""}, "uri": "https://api.github.com/repos/sigmavirus24/github3.py/commits/9aa43ea48c762b19e8191ae2c5c5fcb87fe30b44", "method": "GET", "headers": {"Accept": "application/vnd.github.v3.full+json", "Accept-Encoding": "gzip, deflate", "Content-Type": "application/json", "User-Agent": "github3.py/1.0.0a4", "Connection": "keep-alive", "Accept-Charset": "utf-8"}}, "response": {"body": {"encoding": "utf-8", "string": "", "base64_string": "H4sIAAAAAAAAA+1YS2/bRhD+KwtepCCy+JZIAUICGAiaW5Cml9aBsCSH0rYUlyWXMlzB/70zS1Ii6cS27PZm+SB5ufP69pvZGR6NaseNlRFy7rnAvSBeLpzIDiGwQ5uDE/uxn8ZRsEzBtSLPM2ZGLPd7oYzV0eC12smSfuV8D6jlM8/ZtSwTXsUSd8KeiwyXtyVPU65ime1FvpWHj1t6MEdFuCnhikQdy15eWfaVs/zmOCvHXfn278Z9Z03B/2xmD1XFt+TIdQYYRV0wkStAz5WQOVNQqYqlsmRf6iz7Cn/XuMBKOAi4ZUXzjbGoElDFscWUx7BwbcdJPCf0w8DiqcvBciAFHqXcWlop+C5fAArWJeG0U6qoVqbJCzHfCrWrI8LILKGQlVkJRO0gyrpyPLN56s6LO/ppkt3KfLY9hPWVBhsOVOaFtIFcbWJZ58ge63VOvMCBndpnm2HcPZB/Bm9j6AWBViNbFx3qpeGZJIDoVsilc1Zmcity5FU/NtwgEmPleFbgWrj5wBUvx67qxarlYF1BGUtMhlxpOtZmI/zhsHZRG6ZIo4PUGk9xmZQNuYwSzz8Z3JzKLJO3qGXs9DBpHhoyT5InLViNXqgFJY+mVDtA7DCkewJCYI24WJ2WOmIWV2ojEtJTIfYlJBdrauXQrdscPTrquqEV1lEVl6KgSna5gwNp1CbLLc/FP7ouXq4NpYmjuqRdHKGWQmk4ENUvFm/EjmZRigOP7wiaEmIQBwT7hSpH8qhR3RV0i/yGpCDohYINT/DaM1YpzyoY32hvKToovG8p+pKkekvRrlX6QdV/SYoWvNSX6eqPrpcLIIy5ZfmLKEghCfF7sUh4GvluGCz9ZZwESRDhA8z5V7RW3bV/gbXn3539prHtap5t5/67vpcIkqOhpOLYrjoLbB+SROiLwFjZ2MpDBu1/jo+VLhUZ9EG0F4m7DEPHDxFNH0Lb5nHgpH7o+Y6XeH5k+wuElRpiEm2HCt17m71u3KSVTYGNeIUNMFVZ9KxGQ8ZeJiIVkODaI57hULHj+ZZcoxiiTEaju+QZfSFJPbsr1B4/HkPJby93AoX+Sx/aLu+Jm/XxcaTT8VTIH0pI1xeMDwXOjzs84o8f2ZVtu7MFe09fS4YLCaR6QtOc2DTTWDWtIEvfrW5y1v8UbM3owXwLp+16mJvm9X69WNrvRgI08/XU4lTIinln4oF6MsUrvPsVE5XIkZh5DNOe/IydRjfN32acpDESDb8fuPqUqjkVu7M+Xfrm1HdQCG0UJ2RKkAXkDzG5Mejv1528ZWrHFZM5sBjn32Y/w18kp6de1o6980bmJtdH4S1nro1n4QV4JP2z0DQRSpZ3D632YCIwu41svWbTSb8hmMzY5DzrTtrIbvKrOEOY2Tc8uDOC08/nif0XyApEAo//iow1Lvee9yZ6bOJ1fJ+w5DAZ/QmxOoWohQnEMV1alunQZkx33DMErZCzhi3IpqhZ0mfb+UHqzhTczVtmNAz8mRaM+qqNg+SfZKR2uvuItE/fuUgI5Ia/fae67VEJ/K+eMcCedbyvJfgn6mdnCO21rLOE5VKxVOQJmxyt+8mNMUc/91xNG1ujGEpQdYmZdM7Xc4wnzhKjT9w5BTVmLGe0ryWtKgV28khlaFZlyjj78rUNeHisFHJMsSjs0emu6UrDYHE66TlZEQNPntziK5qmmGCPgW+9oKSU3HTi04GeAQXIdE/tz2pSR7Keze6cNFfW41whAq77CTNgI5W32Q90NSe0toMFvq5aeqMd/YjJukZ7PSAVLY2kHhbBR6oVsRsL1jmnv+oXa9fNO40fp3VX4Z7K7IGqYXob99/v/wVVxz2VABUAAA=="}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/sigmavirus24/github3.py/commits/9aa43ea48c762b19e8191ae2c5c5fcb87fe30b44", "headers": {"Server": "GitHub.com", "Cache-Control": "public, max-age=60, s-maxage=60", "X-GitHub-Request-Id": "BB0F:2C94:6EA1086:8BA26D4:588BCACB", "ETag": "W/\"ed504fbf37d1d1a357357f18fe2795b7\"", "Date": "Fri, 27 Jan 2017 22:33:47 GMT", "X-RateLimit-Limit": "60", "Content-Security-Policy": "default-src 'none'", "Content-Type": "application/json; charset=utf-8", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "X-Served-By": "cee4c0729c8e9147e7abcb45b9d69689", "Vary": "Accept", "Transfer-Encoding": "chunked", "X-Content-Type-Options": "nosniff", "Status": "200 OK", "Last-Modified": "Fri, 27 Jan 2017 22:23:51 GMT", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "Content-Encoding": "gzip", "Access-Control-Allow-Origin": "*", "X-RateLimit-Remaining": "58", "X-RateLimit-Reset": "1485560027", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "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"}}}, {"recorded_at": "2017-01-27T22:33:47", "request": {"body": {"encoding": "utf-8", "string": ""}, "uri": "https://api.github.com/repos/sigmavirus24/github3.py/commits/9aa43ea48c762b19e8191ae2c5c5fcb87fe30b44/status", "method": "GET", "headers": {"Accept": "application/vnd.github.v3.full+json", "Accept-Encoding": "gzip, deflate", "Content-Type": "application/json", "User-Agent": "github3.py/1.0.0a4", "Connection": "keep-alive", "Accept-Charset": "utf-8"}}, "response": {"body": {"encoding": "utf-8", "string": "", "base64_string": "H4sIAAAAAAAAA8WYXY+jNhSG/0rEbZM4QDL5kKrVqhft3u3FtJW6qiIDDrgDGNkm0yzKf+85NiGQ7pLJuFJvooRwHl6fLx/TeEpTzbydV7Ey4WXqTc2VWjHl7b40Xi1z+DPTulI7QmjF5ynXWR3NY1EQySqhiOJpQY9c1ipYEvtvOK9O5MIhW0qXIaPLTbx+CiJ/yzb+1qcsiFfx6hBHm/WBhYtouYRn88TbbTfL1Spcr56slKG4hKlY8kpzUYKu3ynXIHpyEHLysap+Yyf4EtU8TyZaTEBilTNY3dTTVKZM74erifmcVtURjcxyKin+YrH+5oJmsCADtp+zIJwl7MhyUQE9FqVmf2sQhN94WYtazThcSyVFpeA3+xgSSVrGGZpIBn5P9hStgoW/ni38WbB+DoJdsNyF2z/gnrpK7txznv5vEXra+E/La4RUHcdMKVA9jNBzxibPEtJDTX761Iamokqx5HtR0ebuGQRHyPSbscDkMrFQxN8+LYKlv169JQodmVS1uhOEMNiF/p0gtPec/wQ3ZBTi+ECia6Fpvo9FXUICBFPPlBLXQp68XWPKIFz7i7XvT72SFlgD18qCtR7qPN+3f3yn/uAu8VoyibxcpBzrpX8r/I+PCZaLTbiYevRIoUhuKsReVG3NQ1OQJtVLbeqlJtb4w/HHEGiQ7JaBWA8ujPYOhA17B1hkushvJPTazY36g8hz8QqUW9HDJvXvB5HOEj1pKNBE3kkBy4YInTHwHSzpjI7gSj8uylg10ECV3vMEOdBApYQe8aAfsfGiHcjC+J8b06cNsI667vm4wIE10KA8acm/mg73OA2ssVuYvH94hcYKrKEDl+9wtTVroOHzI41P6BrJYsaP4Ox3Im/sgahPFZbtr5AU6Hqu2Z4mBZbhgeaKnaeeeTxuvubCI9nf22aBPey4n086E+Uk57DXyJPZGnErkgca41b5Ctv3BNJ18jPXv9TR5OPnT0esXrjvpVMymnGju35LuhPSUQSUp3zB6L6wkxMH7RsCn209xVDqNBKwJ4t7TWNc4ADUkP5PzCXNaOEk3AAAlAnx4gQyAABxpWr2ptQeX7jhKHKpn7IuItvy3lI142hLAK0wHPC0ZMxp4R2kIZeubEcvN+yF0bSDnIk2TZ2koj1golxEThzYKImBNASmEbsP6b2rOqQiYwCV7OAsFRkdVEvHeBuZCOmQl9PH+N4ynpPdCaZpPZrTMq1p6pZEHQSijlt1Sr/eHWLu6mwpgMQJTfKodm9yVw4qtbMD1LtT6HuYK9Qc55wC1RtsjAuKgt+bC8Zd2iIGaf8fYDFPb9H4+/4Yc18uMhpy7cm26bd0F++2Xf+is/+M9jjglBIXBml+qKjOsHPBoyoqmYvoFkGaiMKwNZ/Pm4xRM1YXDN4FOCm2BEBRGWcwNbrobC4MmHoKqs20fkCZCUzvuaCJk9IOAkAbRhetltCPfwXnUCeBBtAnFjxnSovSMUIdpc8uheYHHr/lxDJebgNQ80HxMmZTmudTyFrNYw55DLM2RhEGTubmIUuAZcBrAHtSyRmktJPXJbOMhtiTZsKqXJycu1AP48H5xjY6l4RrW+UjbxDff3S5NOY3P619w+md/wFxGEk5RhUAAA=="}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/sigmavirus24/github3.py/commits/9aa43ea48c762b19e8191ae2c5c5fcb87fe30b44/status", "headers": {"Server": "GitHub.com", "Cache-Control": "public, max-age=60, s-maxage=60", "X-GitHub-Request-Id": "BB0F:2C94:6EA1090:8BA26E2:588BCACB", "ETag": "W/\"81650974f2a0a7da30773eeea065f4b7\"", "Date": "Fri, 27 Jan 2017 22:33:47 GMT", "X-RateLimit-Limit": "60", "Content-Security-Policy": "default-src 'none'", "Content-Type": "application/json; charset=utf-8", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "X-Served-By": "7f48e2f7761567e923121f17538d7a6d", "Vary": "Accept", "Transfer-Encoding": "chunked", "X-Content-Type-Options": "nosniff", "Status": "200 OK", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "Content-Encoding": "gzip", "Access-Control-Allow-Origin": "*", "X-RateLimit-Remaining": "57", "X-RateLimit-Reset": "1485560027", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "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"}}}], "recorded_with": "betamax/0.8.0"}

tests/integration/test_repos_commit.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,19 @@
55

66

77
class TestRepoCommit(helper.IntegrationHelper):
8-
98
"""Integration tests for the RepoCommit object."""
109

10+
def test_status(self):
11+
"""Verify that we can retrieve the combined status for a commit."""
12+
cassette_name = self.cassette_name('status')
13+
with self.recorder.use_cassette(cassette_name):
14+
repository = self.gh.repository('sigmavirus24', 'github3.py')
15+
commit = repository.commit(
16+
'9aa43ea48c762b19e8191ae2c5c5fcb87fe30b44'
17+
)
18+
combined_status = commit.status()
19+
assert isinstance(combined_status, github3.repos.status.CombinedStatus)
20+
1121
def test_statuses(self):
1222
"""Test the ability to retrieve statuses on a commit."""
1323
cassette_name = self.cassette_name('statuses')

0 commit comments

Comments
 (0)
0