MCPcopy
hub / github.com/mitmproxy/mitmproxy / test_unfragmented

Function test_unfragmented

test/mitmproxy/proxy/layers/test_websocket.py:290–307  ·  view source on GitHub ↗
(ws_testdata)

Source from the content-addressed store, hash-verified

288
289
290def 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
310def test_protocol_error(ws_testdata):

Callers

nothing calls this directly

Calls 3

replyClass · 0.90
DataReceivedClass · 0.90
SendDataClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…