Fix http server's tests.

This commit is contained in:
Valentin Lorentz 2013-02-01 20:38:01 +01:00
parent 21c17b8248
commit 39b534246f
2 changed files with 4 additions and 10 deletions

View File

@ -84,7 +84,7 @@ class RealSupyHTTPServer(HTTPServer):
class TestSupyHTTPServer(RealSupyHTTPServer):
def __init__(self, *args, **kwargs):
pass
self.callbacks = {}
def serve_forever(self, *args, **kwargs):
pass
def shutdown(self, *args, **kwargs):
@ -151,7 +151,7 @@ class SupyHTTPServerCallback:
neither overriden this message or defined an handler for this query.""")
def doGet(self, handler, path, *args, **kwargs):
handler.send_response(404)
handler.send_response(400)
self.send_header('Content_type', 'text/plain; charset=utf-8')
self.send_header('Content-Length', len(self.defaultResponse))
self.end_headers()

View File

@ -493,14 +493,6 @@ class ChannelPluginTestCase(PluginTestCase):
frm = self.prefix
self.irc.feedMsg(ircmsgs.privmsg(to, query, prefix=frm))
class TestSupyHTTPServer(httpserver.SupyHTTPServer):
def __init__(self, *args, **kwargs):
pass
def serve_forever(self, *args, **kwargs):
pass
def shutdown(self, *args, **kwargs):
pass
class TestRequestHandler(httpserver.SupyHTTPRequestHandler):
def __init__(self, rfile, wfile, *args, **kwargs):
self._headers_mode = True
@ -524,6 +516,8 @@ class TestRequestHandler(httpserver.SupyHTTPRequestHandler):
self.server = httpserver.http_servers[0]
httpserver.SupyHTTPRequestHandler.do_X(self, *args, **kwargs)
httpserver.http_servers = [httpserver.TestSupyHTTPServer()]
# Partially stolen from the standart Python library :)
def open_http(url, data=None):
"""Use HTTP protocol."""