From 9bfcbd8aa7bff9e72ea2c3cef9c3d9b5c3691534 Mon Sep 17 00:00:00 2001 From: Gene Wood Date: Mon, 7 Oct 2019 16:42:25 -0700 Subject: [PATCH] Add GitHub unit test This doesn't yet mock the response from GitHub, it makes a live call This call could be ratelimited or fail due to transient network issues Once we switch to using requests we'll want to mock out this GitHub response --- agithub/agithub_test.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/agithub/agithub_test.py b/agithub/agithub_test.py index 28f56b0..ad79144 100755 --- a/agithub/agithub_test.py +++ b/agithub/agithub_test.py @@ -88,5 +88,17 @@ class TestIncompleteRequest(unittest.TestCase): ) +def test_github(): + g = GitHub() + status, data = g.users.octocat.get() + assert data.get('name') == 'The Octocat' + assert status == 200 + # Workaround to https://github.com/mozilla/agithub/issues/67 + response_headers = dict([(x.lower(), y) for x, y in g.getheaders()]) + assert ( + response_headers.get('Content-Type'.lower()) == + 'application/json; charset=utf-8') + + if __name__ == '__main__': unittest.main()