mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 19:22:45 +01:00
Fix http server's tests.
This commit is contained in:
parent
21c17b8248
commit
39b534246f
@ -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()
|
||||
|
10
src/test.py
10
src/test.py
@ -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."""
|
||||
|
Loading…
Reference in New Issue
Block a user