connect() creates an opening handshake request.
(self, _generate_key)
| 101 | |
| 102 | @patch("websockets.client.generate_key", return_value=KEY) |
| 103 | def test_connect(self, _generate_key): |
| 104 | """connect() creates an opening handshake request.""" |
| 105 | client = ClientProtocol(URI) |
| 106 | request = client.connect() |
| 107 | |
| 108 | self.assertIsInstance(request, Request) |
| 109 | self.assertEqual(request.path, "/test") |
| 110 | self.assertEqual( |
| 111 | request.headers, |
| 112 | Headers( |
| 113 | { |
| 114 | "Host": "example.com", |
| 115 | "Upgrade": "websocket", |
| 116 | "Connection": "Upgrade", |
| 117 | "Sec-WebSocket-Key": KEY, |
| 118 | "Sec-WebSocket-Version": "13", |
| 119 | } |
| 120 | ), |
| 121 | ) |
| 122 | |
| 123 | def test_path(self): |
| 124 | """connect() uses the path from the URI.""" |
nothing calls this directly
no test coverage detected