(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 | {&class="cm">#x27;HOSTclass="st">': 'server.example.com', |
| 26 | &class="cm">#x27;UPGRADEclass="st">': 'websocket', |
| 27 | &class="cm">#x27;CONNECTIONclass="st">': 'Upgrade', |
| 28 | &class="cm">#x27;SEC-WEBSOCKET-KEYclass="st">': 'dGhlIHNhbXBsZSBub25jZQ==', |
| 29 | &class="cm">#x27;ORIGINclass="st">': 'http://example.com', |
| 30 | &class="cm">#x27;SEC-WEBSOCKET-VERSIONclass="st">': '13'}) |
| 31 | if protocols: |
| 32 | headers[&class="cm">#x27;SEC-WEBSOCKET-PROTOCOLclass="st">'] = 'chat, superchat' |
| 33 | |
| 34 | message = RawRequestMessage(method, path, HttpVersion11, headers, |
| 35 | [(k.encode(&class="cm">#x27;utf-8class="st">'), 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