diff options
Diffstat (limited to 'dummyserver/testcase.py')
-rw-r--r-- | dummyserver/testcase.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/dummyserver/testcase.py b/dummyserver/testcase.py index e5ae51b..f5588a0 100644 --- a/dummyserver/testcase.py +++ b/dummyserver/testcase.py @@ -42,10 +42,10 @@ class SocketDummyServerTestCase(unittest.TestCase): @classmethod def start_response_handler(cls, response, num=1, block_send=None): ready_event = threading.Event() + def socket_handler(listener): for _ in range(num): ready_event.set() - ready_event.clear() sock = listener.accept()[0] consume_socket(sock) @@ -61,9 +61,9 @@ class SocketDummyServerTestCase(unittest.TestCase): @classmethod def start_basic_handler(cls, **kw): return cls.start_response_handler( - b'HTTP/1.1 200 OK\r\n' - b'Content-Length: 0\r\n' - b'\r\n', **kw) + b'HTTP/1.1 200 OK\r\n' + b'Content-Length: 0\r\n' + b'\r\n', **kw) @classmethod def tearDownClass(cls): @@ -113,6 +113,17 @@ class HTTPSDummyServerTestCase(HTTPDummyServerTestCase): certs = DEFAULT_CERTS +class IPV6HTTPSDummyServerTestCase(HTTPSDummyServerTestCase): + host = '::1' + + @classmethod + def setUpClass(cls): + if not socket.has_ipv6: + raise SkipTest('IPv6 not available') + else: + super(IPV6HTTPSDummyServerTestCase, cls).setUpClass() + + class HTTPDummyProxyTestCase(unittest.TestCase): http_host = 'localhost' |