Add test for the websocket connection-refused fix.

This commit is contained in:
Ben Darnell 2013-11-03 14:01:41 -05:00
parent 086de753b0
commit 15bccd8a01
1 changed files with 13 additions and 1 deletions

View File

@ -86,7 +86,7 @@ class WebSocketTest(AsyncHTTPTestCase):
io_loop=self.io_loop)
@gen_test
def test_websocket_network_fail(self):
def test_websocket_network_timeout(self):
sock, port = bind_unused_port()
sock.close()
with self.assertRaises(HTTPError) as cm:
@ -97,6 +97,18 @@ class WebSocketTest(AsyncHTTPTestCase):
connect_timeout=0.01)
self.assertEqual(cm.exception.code, 599)
@gen_test
def test_websocket_network_fail(self):
sock, port = bind_unused_port()
sock.close()
with self.assertRaises(HTTPError) as cm:
with ExpectLog(gen_log, ".*"):
yield websocket_connect(
'ws://localhost:%d/' % port,
io_loop=self.io_loop,
connect_timeout=3600)
self.assertEqual(cm.exception.code, 599)
@gen_test
def test_websocket_close_buffered_data(self):
ws = yield websocket_connect(