(self)
| 272 | close_connection.assert_called_with() |
| 273 | |
| 274 | def test_request_POST(self) -> None: |
| 275 | conn = HTTP2Connection("example.com") |
| 276 | conn.sock = mock.MagicMock( |
| 277 | sendall=mock.Mock(return_value=None), |
| 278 | ) |
| 279 | sendall = conn.sock.sendall |
| 280 | data_to_send = conn._h2_conn._obj.data_to_send = mock.Mock(return_value=b"foo") # type: ignore[method-assign] |
| 281 | send_headers = conn._h2_conn._obj.send_headers = mock.Mock(return_value=None) # type: ignore[method-assign] |
| 282 | send_data = conn._h2_conn._obj.send_data = mock.Mock(return_value=None) # type: ignore[method-assign] |
| 283 | conn._h2_conn._obj.get_next_available_stream_id = mock.Mock(return_value=1) # type: ignore[method-assign] |
| 284 | close_connection = conn._h2_conn._obj.close_connection = mock.Mock( # type: ignore[method-assign] |
| 285 | return_value=None |
| 286 | ) |
| 287 | |
| 288 | conn.request("POST", "/", body=b"foo") |
| 289 | conn.close() |
| 290 | |
| 291 | data_to_send.assert_called_with() |
| 292 | sendall.assert_called_with(b"foo") |
| 293 | send_headers.assert_called_with( |
| 294 | stream_id=1, |
| 295 | headers=[ |
| 296 | (b":scheme", b"https"), |
| 297 | (b":method", b"POST"), |
| 298 | (b":authority", b"example.com:443"), |
| 299 | (b":path", b"/"), |
| 300 | (b"user-agent", _get_default_user_agent().encode()), |
| 301 | ], |
| 302 | end_stream=False, |
| 303 | ) |
| 304 | send_data.assert_called_with(1, b"foo", end_stream=True) |
| 305 | close_connection.assert_called_with() |
| 306 | |
| 307 | def test_close(self) -> None: |
| 308 | conn = HTTP2Connection("example.com") |
nothing calls this directly
no test coverage detected