(self)
| 81 | |
| 82 | class HeaderHandler(TestWebSocketHandler): |
| 83 | def open(self): |
| 84 | methods_to_test = [ |
| 85 | functools.partial(self.write, "This should not work"), |
| 86 | functools.partial(self.redirect, "http://localhost/elsewhere"), |
| 87 | functools.partial(self.set_header, "X-Test", ""), |
| 88 | functools.partial(self.set_cookie, "Chocolate", "Chip"), |
| 89 | functools.partial(self.set_status, 503), |
| 90 | self.flush, |
| 91 | self.finish, |
| 92 | ] |
| 93 | for method in methods_to_test: |
| 94 | try: |
| 95 | # In a websocket context, many RequestHandler methods |
| 96 | # raise RuntimeErrors. |
| 97 | method() # type: ignore |
| 98 | raise Exception("did not get expected exception") |
| 99 | except RuntimeError: |
| 100 | pass |
| 101 | self.write_message(self.request.headers.get("X-Test", "")) |
| 102 | |
| 103 | |
| 104 | class HeaderEchoHandler(TestWebSocketHandler): |
nothing calls this directly
no test coverage detected