MCPcopy Create free account
hub / github.com/mitmproxy/mitmproxy / test_simple

Method test_simple

test/mitmproxy/proxy/test_layer.py:82–106  ·  view source on GitHub ↗
(self, tctx: Context)

Source from the content-addressed store, hash-verified

80
81class TestNextLayer:
82 def test_simple(self, tctx: Context):
83 nl = layer.NextLayer(tctx, ask_on_start=True)
84 nl.debug = " "
85 playbook = tutils.Playbook(nl, hooks=True)
86
87 assert (
88 playbook
89 << layer.NextLayerHook(nl)
90 >> tutils.reply()
91 >> events.DataReceived(tctx.client, b"foo")
92 << layer.NextLayerHook(nl)
93 >> tutils.reply()
94 >> events.DataReceived(tctx.client, b"bar")
95 << layer.NextLayerHook(nl)
96 )
97 assert nl.data_client() == b"foobar"
98 assert nl.data_server() == b""
99
100 nl.layer = tutils.EchoLayer(tctx)
101 assert (
102 playbook
103 >> tutils.reply()
104 << commands.SendData(tctx.client, b"foo")
105 << commands.SendData(tctx.client, b"bar")
106 )
107
108 def test_late_hook_reply(self, tctx: Context):
109 """

Callers 1

test_bench_tcp_roundtripFunction · 0.45

Calls 2

data_clientMethod · 0.95
data_serverMethod · 0.95

Tested by

no test coverage detected