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