Commit c44cf31a authored by Denis Bilenko's avatar Denis Bilenko

rename wsgi_test.py to test__pywsgi.py

--HG--
rename : greentest/wsgi_test.py => greentest/test__pywsgi.py
parent 8da12eb0
......@@ -200,18 +200,17 @@ class TestCase(greentest.TestCase):
validator = staticmethod(validator)
def get_listener(self):
return ('127.0.0.1', 0)
def init_server(self, application):
self.server = self.get_wsgi_module().WSGIServer(('127.0.0.1', 0), application)
def setUp(self):
greentest.TestCase.setUp(self)
application = self.application
if self.validator is not None:
application = self.validator(application)
listener = self.get_listener()
self.server = self.get_wsgi_module().WSGIServer(listener, application)
self.init_server(application)
self.server.start()
self.port = self.server.server_port
greentest.TestCase.setUp(self)
def tearDown(self):
greentest.TestCase.tearDown(self)
......@@ -484,12 +483,11 @@ class TestUseWrite(TestCase):
class HttpsTestCase(TestCase):
def get_listener(self):
certificate_file = os.path.join(os.path.dirname(__file__), 'test_server.crt')
private_key_file = os.path.join(os.path.dirname(__file__), 'test_server.key')
sock = socket.socket()
socket.bind_and_listen(sock, ('', 0))
return socket.ssl(sock, private_key_file, certificate_file)
certfile = os.path.join(os.path.dirname(__file__), 'test_server.crt')
keyfile = os.path.join(os.path.dirname(__file__), 'test_server.key')
def init_server(self, application):
self.server = self.get_wsgi_module().WSGIServer(('127.0.0.1', 0), application, certfile=self.certfile, keyfile=self.keyfile)
def urlopen(self, *args, **kwargs):
req = HTTPRequest("https://localhost:%s/foo" % self.server.server_port, *args, **kwargs)
......@@ -606,6 +604,7 @@ class TestError_after_start_response(TestError):
start_response('200 OK', [('Content-Type', 'text/plain')])
raise ExpectedException
class TestEmptyYield(TestCase):
@staticmethod
......
from gevent import wsgi
import wsgi_test
from wsgi_test import *
import test__pywsgi
from test__pywsgi import *
del TestHttps
wsgi_test.server_implements_chunked = False
test__pywsgi.server_implements_chunked = False
TestCase.get_wsgi_module = lambda *args: wsgi
class TestHttpsError(HttpsTestCase):
def setUp(self):
listener = self.get_listener()
from gevent.socket import ssl, socket
listener = socket()
listener.bind(('0.0.0.0', 0))
listener.listen(5)
listener = ssl(listener, keyfile=self.keyfile, certfile=self.certfile)
self.assertRaises(TypeError, self.get_wsgi_module().WSGIServer, listener, self.application)
def tearDown(self):
......
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