| 421 | |
| 422 | @tornado.testing.gen_test |
| 423 | def test_websocket(self): |
| 424 | ws_req = httpclient.HTTPRequest( |
| 425 | f"ws://localhost:{self.get_http_port()}/updates", |
| 426 | headers={"Cookie": self.auth_cookie}, |
| 427 | ) |
| 428 | |
| 429 | ws_client = yield websocket.websocket_connect(ws_req) |
| 430 | self.master.options.anticomp = True |
| 431 | |
| 432 | r1 = yield ws_client.read_message() |
| 433 | response = json.loads(r1) |
| 434 | assert response == { |
| 435 | "type": "options/update", |
| 436 | "payload": { |
| 437 | "anticomp": { |
| 438 | "value": True, |
| 439 | "choices": None, |
| 440 | "default": False, |
| 441 | "help": "Try to convince servers to send us un-compressed data.", |
| 442 | "type": "bool", |
| 443 | } |
| 444 | }, |
| 445 | } |
| 446 | ws_client.close() |
| 447 | |
| 448 | # trigger on_close by opening a second connection. |
| 449 | ws_client2 = yield websocket.websocket_connect(ws_req) |
| 450 | ws_client2.close() |
| 451 | |
| 452 | @tornado.testing.gen_test |
| 453 | def test_websocket_filter_application(self): |