(ws_testdata)
| 348 | |
| 349 | |
| 350 | def test_close_normal(ws_testdata): |
| 351 | tctx, playbook, flow = ws_testdata |
| 352 | masked_close = Placeholder(bytes) |
| 353 | close = Placeholder(bytes) |
| 354 | assert ( |
| 355 | playbook |
| 356 | << websocket.WebsocketStartHook(flow) |
| 357 | >> reply() |
| 358 | >> DataReceived(tctx.client, masked_bytes(b"\x88\x00")) |
| 359 | << SendData(tctx.server, masked_close) |
| 360 | << CloseConnection(tctx.server) |
| 361 | << SendData(tctx.client, close) |
| 362 | << CloseConnection(tctx.client) |
| 363 | << websocket.WebsocketEndHook(flow) |
| 364 | >> reply() |
| 365 | ) |
| 366 | # wsproto currently handles this inconsistently, see |
| 367 | # https://github.com/python-hyper/wsproto/pull/153/files |
| 368 | assert masked_close() == masked(b"\x88\x02\x03\xe8") or masked_close() == masked( |
| 369 | b"\x88\x00" |
| 370 | ) |
| 371 | assert close() == b"\x88\x02\x03\xe8" or close() == b"\x88\x00" |
| 372 | |
| 373 | assert flow.websocket.close_code == 1005 |
| 374 | assert not flow.live |
| 375 | |
| 376 | |
| 377 | def test_close_disconnect(ws_testdata): |
nothing calls this directly
no test coverage detected
searching dependent graphs…