From 15bccd8a01bd4ca90c97960bf7908be1cc525b7b Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Sun, 3 Nov 2013 14:01:41 -0500 Subject: [PATCH] Add test for the websocket connection-refused fix. --- tornado/test/websocket_test.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tornado/test/websocket_test.py b/tornado/test/websocket_test.py index 28375cd6..3c6e3a9a 100644 --- a/tornado/test/websocket_test.py +++ b/tornado/test/websocket_test.py @@ -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(