MCPcopy Create free account
hub / github.com/EasyIME/PIME / open

Method open

python/python3/tornado/test/websocket_test.py:78–96  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

76
77class 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
99class HeaderEchoHandler(TestWebSocketHandler):

Callers

nothing calls this directly

Calls 2

write_messageMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected