mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-01 19:31:10 +00:00
Add test coverage for #182
This commit is contained in:
@@ -56,6 +56,22 @@ class Exceptions(Framework.TestCase): # To stay compatible with Python 2.6, we
|
||||
)
|
||||
self.assertTrue(raised)
|
||||
|
||||
def testNonJsonDataReturnedByGithub(self):
|
||||
# Replay data was forged according to https://github.com/jacquev6/PyGithub/pull/182
|
||||
raised = False
|
||||
try:
|
||||
self.g.get_user("jacquev6")
|
||||
except github.GithubException, exception:
|
||||
raised = True
|
||||
self.assertEqual(exception.status, 503)
|
||||
self.assertEqual(
|
||||
exception.data,
|
||||
{
|
||||
"data": "<html><body><h1>503 Service Unavailable</h1>No server is available to handle this request.</body></html>",
|
||||
}
|
||||
)
|
||||
self.assertTrue(raised)
|
||||
|
||||
def testUnknownObject(self):
|
||||
raised = False
|
||||
try:
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
https
|
||||
GET
|
||||
api.github.com
|
||||
None
|
||||
/users/jacquev6
|
||||
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
|
||||
null
|
||||
503
|
||||
[('status', '503 Servive Unavailable'), ('content-length', '104'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('etag', '"ca6a3702f840b6bff0bb1bca6be0337c"'), ('date', 'Sat, 02 Jun 2012 12:12:32 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
<html><body><h1>503 Service Unavailable</h1>No server is available to handle this request.</body></html>
|
||||
|
||||
Reference in New Issue
Block a user