Created
September 22, 2013 14:28
-
-
Save acuros/6660415 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestWSGIHandler(unittest.TestCase): | |
def test_call_application(self): | |
request = dict(meta=dict(ip='127.0.0.1', port=19234), | |
parameters=dict(url='/')) | |
environ, handler = Environ(request), WSGIHandler() | |
bson_binary = handler.call_application(various_status_application, | |
environ.get_dict()) | |
self.assertEqual(dict(status=dict(reason='OK', code='200')), | |
bson.loads(bson_binary)) | |
def test_not_found_status(self): | |
request = dict(meta=dict(ip='127.0.0.1', port=19234), | |
parameters=dict(url='/?404 NOT FOUND')) | |
environ, handler = Environ(request), WSGIHandler() | |
bson_binary = handler.call_application(various_status_application, | |
environ.get_dict()) | |
self.assertEqual(dict(status=dict(reason='NOT FOUND', code='404')), | |
bson.loads(bson_binary)) | |
def test_no_json_response(self): | |
request = dict(meta=dict(ip='127.0.0.1', port=19234), | |
parameters=dict(url='/?404 NOT FOUND')) | |
environ, handler = Environ(request), WSGIHandler() | |
bson_binary = handler.call_application(no_json_response_application, | |
environ.get_dict()) | |
self.assertEqual(dict(status=dict(reason='NOT FOUND', code='404'), | |
no_json_response='Page Not Found' | |
), | |
bson.loads(bson_binary)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment