Reformatted docstrings to be consistent with the rest of the code.
This commit is contained in:
@@ -32,36 +32,31 @@ def fake_response(data, headers):
|
||||
|
||||
|
||||
class Error(unittest.TestCase):
|
||||
"""Test handling of error bodies
|
||||
"""
|
||||
"""Test handling of error bodies."""
|
||||
|
||||
def test_json_body(self):
|
||||
"""Test a nicely formed, expected error response
|
||||
"""
|
||||
"""Test a nicely formed, expected error response."""
|
||||
resp, content = fake_response(json_error_content,
|
||||
{'status':'400', 'content-type': 'application/json'})
|
||||
error = HttpError(resp, content)
|
||||
self.assertEqual(str(error), '<HttpError 400 "country is required">')
|
||||
|
||||
def test_bad_json_body(self):
|
||||
"""Test handling of bodies with invalid json
|
||||
"""
|
||||
"""Test handling of bodies with invalid json."""
|
||||
resp, content = fake_response('{',
|
||||
{'status':'400', 'content-type': 'application/json'})
|
||||
error = HttpError(resp, content)
|
||||
self.assertEqual(str(error), '<HttpError 400 "{">')
|
||||
|
||||
def test_missing_message_json_body(self):
|
||||
"""Test handling of bodies with missing expected 'message' element
|
||||
"""
|
||||
"""Test handling of bodies with missing expected 'message' element."""
|
||||
resp, content = fake_response('{}',
|
||||
{'status':'400', 'content-type': 'application/json'})
|
||||
error = HttpError(resp, content)
|
||||
self.assertEqual(str(error), '<HttpError 400 "{}">')
|
||||
|
||||
def test_non_json(self):
|
||||
"""Test handling of non-JSON bodies
|
||||
"""
|
||||
"""Test handling of non-JSON bodies"""
|
||||
resp, content = fake_response('NOT OK', {'status':'400'})
|
||||
error = HttpError(resp, content)
|
||||
self.assertEqual(str(error), '<HttpError 400 "Ok">')
|
||||
|
Reference in New Issue
Block a user