MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / test_late_hook_reply

Method test_late_hook_reply

test/mitmproxy/proxy/test_layer.py:108–130  ·  view source on GitHub ↗

Properly handle case where we receive an additional event while we are waiting for a reply from the proxy core.

(self, tctx: Context)

Source from the content-addressed store, hash-verified

106 )
107
108 def test_late_hook_reply(self, tctx: Context):
109 """
110 Properly handle case where we receive an additional event while we are waiting for
111 a reply from the proxy core.
112 """
113 nl = layer.NextLayer(tctx)
114 playbook = tutils.Playbook(nl)
115
116 assert (
117 playbook
118 >> events.DataReceived(tctx.client, b"foo")
119 << layer.NextLayerHook(nl)
120 >> events.DataReceived(tctx.client, b"bar")
121 )
122 assert nl.data_client() == b"foo" # "bar" is paused.
123 nl.layer = tutils.EchoLayer(tctx)
124
125 assert (
126 playbook
127 >> tutils.reply(to=-2)
128 << commands.SendData(tctx.client, b"foo")
129 << commands.SendData(tctx.client, b"bar")
130 )
131
132 @pytest.mark.parametrize("layer_found", [True, False])
133 def test_receive_close(self, tctx: Context, layer_found: bool):

Callers

nothing calls this directly

Calls 1

data_clientMethod · 0.95

Tested by

no test coverage detected