(self, method, path, headers=None, protocols=False)
| 18 | self.loop.close() |
| 19 | |
| 20 | def make_request(self, method, path, headers=None, protocols=False): |
| 21 | self.app = mock.Mock() |
| 22 | self.app._debug = False |
| 23 | if headers is None: |
| 24 | headers = CIMultiDict( |
| 25 | {'HOST': 'server.example.com', |
| 26 | 'UPGRADE': 'websocket', |
| 27 | 'CONNECTION': 'Upgrade', |
| 28 | 'SEC-WEBSOCKET-KEY': 'dGhlIHNhbXBsZSBub25jZQ==', |
| 29 | 'ORIGIN': 'http://example.com', |
| 30 | 'SEC-WEBSOCKET-VERSION': '13'}) |
| 31 | if protocols: |
| 32 | headers['SEC-WEBSOCKET-PROTOCOL'] = 'chat, superchat' |
| 33 | |
| 34 | message = RawRequestMessage(method, path, HttpVersion11, headers, |
| 35 | [(k.encode('utf-8'), v.encode('utf-8')) |
| 36 | for k, v in headers.items()], |
| 37 | False, False) |
| 38 | self.payload = mock.Mock() |
| 39 | self.transport = mock.Mock() |
| 40 | self.reader = mock.Mock() |
| 41 | self.writer = mock.Mock() |
| 42 | self.app.loop = self.loop |
| 43 | self.app.on_response_prepare = signals.Signal(self.app) |
| 44 | req = Request(self.app, message, self.payload, |
| 45 | self.transport, self.reader, self.writer) |
| 46 | return req |
| 47 | |
| 48 | def test_nonstarted_ping(self): |
| 49 | ws = WebSocketResponse() |
no test coverage detected