commit bec5b605fb17957779384e428e064a89fa2bdcca
parent 5719f2429528b251f0da6e9c37c6edd5fbe6853e
Author: Sheng <webmaster0115@gmail.com>
Date: Fri, 5 Jul 2019 13:15:18 +0800
Updated tests
Diffstat:
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/tests/test_app.py b/tests/test_app.py
@@ -210,6 +210,23 @@ class TestAppBasic(TestAppBase):
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('/')
response = yield self.async_post(url, self.body)