Commit fc8c22d5 authored by Denis Bilenko's avatar Denis Bilenko

fix test__server_pywsgi.py not to depend on test__server_http

parent 90edbed7
......@@ -4,9 +4,6 @@ from gevent import pywsgi
import test__server
from test__server import *
from test__server import Settings as server_Settings
from test__server_http import Settings as http_Settings
import gevent.wsgi; gevent.wsgi.WSGIServer.__init__ = None
def application(self, environ, start_response):
......@@ -33,10 +30,40 @@ class SimpleWSGIServer(pywsgi.WSGIServer):
application = application
class Settings(http_Settings):
internal_error_start = 'HTTP/1.0 500 Internal Server Error\n'.replace('\n', '\r\n')
internal_error_end = '\n\nInternal Server Error'.replace('\n', '\r\n')
internal_error503 = '''HTTP/1.0 503 Service Unavailable
Connection: close
Content-type: text/plain
Content-length: 31
Service Temporarily Unavailable'''.replace('\n', '\r\n')
class Settings:
ServerClass = pywsgi.WSGIServer
ServerSubClass = SimpleWSGIServer
close_socket_detected = True
restartable = False
close_socket_detected = False
@staticmethod
def assert500(self):
conn = self.makefile()
conn.write('GET / HTTP/1.0\r\n\r\n')
result = conn.read()
assert result.startswith(internal_error_start), (result, internal_error_start)
assert result.endswith(internal_error_end), (result, internal_error_end)
assertAcceptedConnectionError = assert500
@staticmethod
def assert503(self):
conn = self.makefile()
conn.write('GET / HTTP/1.0\r\n\r\n')
result = conn.read()
assert result == internal_error503, (result, internal_error503)
@staticmethod
def assertPoolFull(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