Skip to content

Commit 9621175

Browse files
ahayworthsigmavirus24
authored andcommitted
Remove GitHubStatus (#982)
* Update GitHubStatus for new GitHub status api On 2018-12-11, GitHub updated its public-facing statuspage: https://github.blog/2018-12-11-introducing-the-new-github-status-site/ The new statuspage has a different API, backed by Statuspage.io: https://www.githubstatus.com/api/ This PR updates the GitHubStatus class to use the new API, and wraps all functions appropriately. It is technically a breaking change, because the new API is significantly different than the old. I've updated tests where appropriate; and introduced a few new line-length errors from the linter. However, when fixing those, the linter began complaining about different docstring errors and so I decided that lengthy docstrings might be acceptable in this case. 😄 * Add myself to AUTHORS.rst * Actually, remove GitHubStatus After conversation on the PR to fix this object ... it does seem that no one really uses it. After all, it's been utterly non-functional for at least a year, and no one has opened an issue. This commit rips it out. Co-authored-by: Ian Stapleton Cordasco <graffatcolmingov@gmail.com>
1 parent 54e0ce5 commit 9621175

File tree

11 files changed

+5
-125
lines changed

11 files changed

+5
-125
lines changed

AUTHORS.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,6 @@ Contributors
195195

196196
- Bharat Raghunathan (@Bharat123rox)
197197

198-
- Kevin P. Fleming (@kpfleming)
198+
- Kevin P. Fleming (@kpfleming)
199+
200+
- Andrew Hayworth (@ahayworth)

docs/source/api-reference/github.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,6 @@ object so for brevity's sake, I'm not listing all of it's inherited members.
2929
:members:
3030

3131

32-
GitHubStatus Object
33-
===================
34-
35-
.. autoclass:: github3.github.GitHubStatus
36-
:members:
37-
38-
3932
GitHubSession Object
4033
====================
4134

src/github3/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,13 @@
5656
user,
5757
zen,
5858
)
59-
from .github import GitHub, GitHubEnterprise, GitHubStatus
59+
from .github import GitHub, GitHubEnterprise
6060
from .exceptions import GitHubError
6161

6262
__all__ = (
6363
"GitHub",
6464
"GitHubEnterprise",
6565
"GitHubError",
66-
"GitHubStatus",
6766
"authorize",
6867
"login",
6968
"enterprise_login",

src/github3/github.py

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2919,39 +2919,3 @@ def admin_stats(self, option):
29192919
url = self._build_url("enterprise", "stats", option.lower())
29202920
stats = self._json(self._get(url), 200)
29212921
return stats
2922-
2923-
2924-
class GitHubStatus(models.GitHubCore):
2925-
"""A sleek interface to the GitHub System Status API.
2926-
2927-
This will only ever return the JSON objects returned by the API.
2928-
"""
2929-
2930-
def __init__(self, session=None):
2931-
"""Create a status API client."""
2932-
super(GitHubStatus, self).__init__({}, session or self.new_session())
2933-
self.session.base_url = "https://status.github.com"
2934-
2935-
def _repr(self):
2936-
return "<GitHub Status>"
2937-
2938-
def _recipe(self, *args):
2939-
url = self._build_url(*args)
2940-
resp = self._get(url)
2941-
return resp.json() if self._boolean(resp, 200, 404) else {}
2942-
2943-
def api(self):
2944-
"""Retrieve API status."""
2945-
return self._recipe("api.json")
2946-
2947-
def status(self):
2948-
"""Retrieve overall status."""
2949-
return self._recipe("api", "status.json")
2950-
2951-
def last_message(self):
2952-
"""Retrieve the last message."""
2953-
return self._recipe("api", "last-message.json")
2954-
2955-
def messages(self):
2956-
"""Retrieve all messages."""
2957-
return self._recipe("api", "messages.json")

tests/cassettes/GitHubStatus_api.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/cassettes/GitHubStatus_last_message.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/cassettes/GitHubStatus_messages.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/cassettes/GitHubStatus_status.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/integration/helper.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,3 @@ def match(self, request, recorded_request):
123123
class GitHubEnterpriseHelper(IntegrationHelper):
124124
def get_client(self):
125125
return github3.GitHubEnterprise(self.enterprise_url)
126-
127-
128-
class GitHubStatusHelper(IntegrationHelper):
129-
def get_client(self):
130-
return github3.GitHubStatus()

tests/integration/test_github.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from .helper import (
1010
GitHubEnterpriseHelper,
1111
IntegrationHelper,
12-
GitHubStatusHelper,
1312
)
1413

1514
GPG_KEY = (
@@ -773,40 +772,3 @@ def test_admin_stats(self):
773772
stats = self.gh.admin_stats("all")
774773

775774
assert isinstance(stats, dict)
776-
777-
778-
class TestGitHubStatus(GitHubStatusHelper):
779-
def setUp(self):
780-
super(TestGitHubStatus, self).setUp()
781-
782-
def test_api(self):
783-
"""Test the ability to check the status of /api."""
784-
cassette_name = self.cassette_name("api")
785-
with self.recorder.use_cassette(cassette_name):
786-
api = self.gh.api()
787-
788-
assert isinstance(api, dict)
789-
790-
def test_last_message(self):
791-
"""Test the ability to check the status of /api/last-message."""
792-
cassette_name = self.cassette_name("last_message")
793-
with self.recorder.use_cassette(cassette_name):
794-
last_message = self.gh.last_message()
795-
796-
assert isinstance(last_message, dict)
797-
798-
def test_messages(self):
799-
"""Test the ability to check the status of /api/messages."""
800-
cassette_name = self.cassette_name("messages")
801-
with self.recorder.use_cassette(cassette_name):
802-
messages = self.gh.messages()
803-
804-
assert isinstance(messages, list)
805-
806-
def test_status(self):
807-
"""Test the ability to check the status of /api/status."""
808-
cassette_name = self.cassette_name("status")
809-
with self.recorder.use_cassette(cassette_name):
810-
status = self.gh.status()
811-
812-
assert isinstance(status, dict)

tests/unit/test_github.py

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pytest
22

33
from github3 import GitHubEnterprise, GitHubError
4-
from github3.github import GitHub, GitHubStatus
4+
from github3.github import GitHub
55
from github3.projects import Project
66

77
from . import helper
@@ -1542,34 +1542,3 @@ def test_str(self):
15421542
assert str(self.instance) == "<GitHub Enterprise [{0}]>".format(
15431543
enterprise_url_for()
15441544
)
1545-
1546-
1547-
class TestGitHubStatus(helper.UnitHelper):
1548-
1549-
"""Test methods on GitHubStatus."""
1550-
1551-
described_class = GitHubStatus
1552-
1553-
def test_api(self):
1554-
"""Verify the request for /api."""
1555-
with helper.mock.patch.object(GitHubStatus, "_recipe") as _recipe:
1556-
self.instance.api()
1557-
_recipe.assert_called_once_with("api.json")
1558-
1559-
def test_last_message(self):
1560-
"""Verify the request for /api/last-message."""
1561-
with helper.mock.patch.object(GitHubStatus, "_recipe") as _recipe:
1562-
self.instance.last_message()
1563-
_recipe.assert_called_once_with("api", "last-message.json")
1564-
1565-
def test_messages(self):
1566-
"""Verify the request for /api/messages."""
1567-
with helper.mock.patch.object(GitHubStatus, "_recipe") as _recipe:
1568-
self.instance.messages()
1569-
_recipe.assert_called_once_with("api", "messages.json")
1570-
1571-
def test_status(self):
1572-
"""Verify the request for /api/status."""
1573-
with helper.mock.patch.object(GitHubStatus, "_recipe") as _recipe:
1574-
self.instance.status()
1575-
_recipe.assert_called_once_with("api", "status.json")

0 commit comments

Comments
 (0)