Commit c5f27cd0 authored by Denis Bilenko's avatar Denis Bilenko

move TestError* from test__wsgi.py to wsgi_test.py

parent 905b76db
......@@ -6,35 +6,6 @@ del TestHttps, TestChunkedApp, TestBigChunks
TestCase.get_wsgi_module = lambda *args: wsgi
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()
......@@ -487,6 +487,37 @@ class TestInputReadlines(TestInputReadline):
return lines
class ExpectedException(Exception):
pass
class TestError(TestCase):
@staticmethod
def application(env, start_response):
raise ExpectedException
@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 ExpectedException
class HTTPRequest(urllib2.Request):
"""Hack urllib2.Request to support PUT and DELETE methods."""
......
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