Commit b4dcad91 authored by Denis Bilenko's avatar Denis Bilenko

wsgi2_test.py: add test for Internal Server Error

parent 6de81586
......@@ -6,5 +6,35 @@ del TestHttps, TestChunkedApp, TestBigChunks
TestCase.get_wsgi_module = lambda *args: wsgi2
class Expected(Exception):
pass
class TestError(TestCase):
@staticmethod
def application(env, start_response):
raise Expected
@property
def url(self):
return 'http://127.0.0.1:%s' % self.port
def test(self):
try:
r = urllib2.urlopen(self.url)
raise AssertionError('Must raise HTTPError, returned %r: %s' % (r, r.code))
except urllib2.HTTPError, ex:
assert ex.code == 500, ex
assert ex.msg == 'Internal Server Error', ex
class TestError_after_start_response(TestError):
@staticmethod
def application(env, start_response):
start_response('200 OK', [('Content-Type', 'text/plain')])
raise Expected
if __name__ == '__main__':
greentest.main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment