From bec5b605fb17957779384e428e064a89fa2bdcca Mon Sep 17 00:00:00 2001 From: Sheng Date: Fri, 5 Jul 2019 13:15:18 +0800 Subject: [PATCH] Updated tests --- tests/test_app.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/test_app.py b/tests/test_app.py index 923a85f..8be823f 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -209,6 +209,23 @@ class TestAppBasic(TestAppBase): self.assertIsNone(msg) self.assertEqual(ws.close_reason, 'Websocket authentication failed.') + @tornado.testing.gen_test + def test_app_with_correct_credentials_but_ip_not_matched(self): + url = self.get_url('/') + response = yield self.async_post(url, self.body) + data = json.loads(to_str(response.body)) + self.assert_status_none(data) + + clients = handler.clients + handler.clients = {} + url = url.replace('http', 'ws') + ws_url = url + 'ws?id=' + data['id'] + ws = yield tornado.websocket.websocket_connect(ws_url) + msg = yield ws.read_message() + self.assertIsNone(msg) + self.assertEqual(ws.close_reason, 'Websocket authentication failed.') + handler.clients = clients + @tornado.testing.gen_test def test_app_with_correct_credentials_user_robey(self): url = self.get_url('/')