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

Method test_all

test/mitmproxy/test_flow.py:127–148  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

125 assert s.flows[0].request.host == "use-this-domain"
126
127 async def test_all(self):
128 opts = options.Options(mode=["reverse:https://use-this-domain"])
129 s = State()
130 with taddons.context(s, options=opts) as ctx:
131 f = tflow.tflow(req=None)
132 await ctx.master.addons.handle_lifecycle(
133 server_hooks.ClientConnectedHook(f.client_conn)
134 )
135 f.request = mitmproxy.test.tutils.treq()
136 await ctx.master.addons.handle_lifecycle(layers.http.HttpRequestHook(f))
137 assert len(s.flows) == 1
138
139 f.response = mitmproxy.test.tutils.tresp()
140 await ctx.master.addons.handle_lifecycle(layers.http.HttpResponseHook(f))
141 assert len(s.flows) == 1
142
143 await ctx.master.addons.handle_lifecycle(
144 server_hooks.ClientDisconnectedHook(f.client_conn)
145 )
146
147 f.error = flow.Error("msg")
148 await ctx.master.addons.handle_lifecycle(layers.http.HttpErrorHook(f))
149
150
151class TestError:

Callers

nothing calls this directly

Calls 3

contextMethod · 0.80
handle_lifecycleMethod · 0.80
StateClass · 0.70

Tested by

no test coverage detected