From 1ebd245750a7de2f39d28678fe6dc6fadd5f90f4 Mon Sep 17 00:00:00 2001 From: Vadim Semenov Date: Tue, 2 Apr 2013 19:27:26 +0400 Subject: [PATCH] tests: test for websocket_connect failure --- tornado/test/websocket_test.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tornado/test/websocket_test.py b/tornado/test/websocket_test.py index eb961d24..eef5ed55 100644 --- a/tornado/test/websocket_test.py +++ b/tornado/test/websocket_test.py @@ -32,3 +32,14 @@ class WebSocketTest(AsyncHTTPTestCase): ws.read_message(self.stop) response = self.wait().result() self.assertEqual(response, 'hello') + + @gen_test + def test_websocket_fail(self): + try: + ws = yield websocket_connect( + 'ws://localhost:%d/no_websock' % self.get_http_port(), + io_loop=self.io_loop) + except: + pass + else: + self.fail('Should\'ve caught an Exception')