(self)
| 257 | context.wrap_socket.return_value.close.assert_called_once_with() |
| 258 | |
| 259 | def test_assert_hostname_closes_socket(self) -> None: |
| 260 | context = mock.create_autospec(ssl_.SSLContext) |
| 261 | context.wrap_socket.return_value.getpeercert.return_value = { |
| 262 | "subjectAltName": (("DNS", "google.com"),) |
| 263 | } |
| 264 | conn = HTTPSConnection( |
| 265 | "google.com", port=443, assert_hostname="example.com", ssl_context=context |
| 266 | ) |
| 267 | with mock.patch.object(conn, "_new_conn"): |
| 268 | with pytest.raises(ImplementationCertificateError): |
| 269 | conn.connect() |
| 270 | |
| 271 | context.wrap_socket.return_value.close.assert_called_once_with() |
| 272 | |
| 273 | @pytest.mark.parametrize( |
| 274 | "accept_encoding", |
nothing calls this directly
no test coverage detected