(tctx)
| 267 | |
| 268 | |
| 269 | def test_upstream_error(tctx): |
| 270 | playbook, cff = start_h2_client(tctx) |
| 271 | flow = Placeholder(HTTPFlow) |
| 272 | server = Placeholder(Server) |
| 273 | err = Placeholder(bytes) |
| 274 | assert ( |
| 275 | playbook |
| 276 | >> DataReceived( |
| 277 | tctx.client, |
| 278 | cff.build_headers_frame( |
| 279 | example_request_headers, flags=["END_STREAM"] |
| 280 | ).serialize(), |
| 281 | ) |
| 282 | << http.HttpRequestHeadersHook(flow) |
| 283 | >> reply() |
| 284 | << http.HttpRequestHook(flow) |
| 285 | >> reply() |
| 286 | << OpenConnection(server) |
| 287 | >> reply("oops server <> error") |
| 288 | << http.HttpErrorHook(flow) |
| 289 | >> reply() |
| 290 | << SendData(tctx.client, err) |
| 291 | ) |
| 292 | frames = decode_frames(err()) |
| 293 | assert [type(x) for x in frames] == [ |
| 294 | hyperframe.frame.HeadersFrame, |
| 295 | hyperframe.frame.DataFrame, |
| 296 | ] |
| 297 | d = frames[1] |
| 298 | assert isinstance(d, hyperframe.frame.DataFrame) |
| 299 | assert b"502 Bad Gateway" in d.data |
| 300 | assert b"server <> error" in d.data |
| 301 | |
| 302 | |
| 303 | @pytest.mark.parametrize("trailers", ["trailers", ""]) |
nothing calls this directly
no test coverage detected
searching dependent graphs…