(self)
| 185 | conn._h2_conn._obj.end_stream.assert_called_with(1) |
| 186 | |
| 187 | def test_send_file_str(self) -> None: |
| 188 | conn = HTTP2Connection("example.com") |
| 189 | mock_open = mock.mock_open(read_data="foo\r\nbar\r\n") |
| 190 | with mock.patch("builtins.open", mock_open): |
| 191 | conn.sock = mock.MagicMock( |
| 192 | sendall=mock.Mock(return_value=None), |
| 193 | ) |
| 194 | conn._h2_conn._obj.data_to_send = mock.Mock(return_value=b"foo") # type: ignore[method-assign] |
| 195 | conn._h2_conn._obj.send_data = mock.Mock(return_value=None) # type: ignore[method-assign] |
| 196 | conn._h2_conn._obj.get_next_available_stream_id = mock.Mock(return_value=1) # type: ignore[method-assign] |
| 197 | conn._h2_conn._obj.end_stream = mock.Mock(return_value=None) # type: ignore[method-assign] |
| 198 | |
| 199 | with open("foo") as body: |
| 200 | conn.putrequest("GET", "/") |
| 201 | conn.endheaders(message_body=body) |
| 202 | conn.send(body) |
| 203 | |
| 204 | conn._h2_conn._obj.data_to_send.assert_called_with() |
| 205 | conn.sock.sendall.assert_called_with(b"foo") |
| 206 | conn._h2_conn._obj.send_data.assert_called_with( |
| 207 | 1, b"foo\r\nbar\r\n", end_stream=False |
| 208 | ) |
| 209 | conn._h2_conn._obj.end_stream.assert_called_with(1) |
| 210 | |
| 211 | def test_send_file_bytes(self) -> None: |
| 212 | conn = HTTP2Connection("example.com") |
nothing calls this directly
no test coverage detected