(ws_testdata)
| 288 | |
| 289 | |
| 290 | def test_unfragmented(ws_testdata): |
| 291 | tctx, playbook, flow = ws_testdata |
| 292 | assert ( |
| 293 | playbook |
| 294 | << websocket.WebsocketStartHook(flow) |
| 295 | >> reply() |
| 296 | >> DataReceived(tctx.server, b"\x81\x06foo") |
| 297 | ) |
| 298 | # This already triggers wsproto to emit a wsproto.events.Message, see |
| 299 | # https://github.com/mitmproxy/mitmproxy/issues/4701 |
| 300 | assert ( |
| 301 | playbook |
| 302 | >> DataReceived(tctx.server, b"bar") |
| 303 | << websocket.WebsocketMessageHook(flow) |
| 304 | >> reply() |
| 305 | << SendData(tctx.client, b"\x81\x06foobar") |
| 306 | ) |
| 307 | assert flow.websocket.messages[-1].content == b"foobar" |
| 308 | |
| 309 | |
| 310 | def test_protocol_error(ws_testdata): |
nothing calls this directly
no test coverage detected
searching dependent graphs…