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

Function test_simple

test/mitmproxy/addons/test_save.py:136–164  ·  view source on GitHub ↗
(tmp_path)

Source from the content-addressed store, hash-verified

134
135
136def test_simple(tmp_path):
137 sa = save.Save()
138 with taddons.context(sa) as tctx:
139 p = str(tmp_path / "foo")
140
141 tctx.configure(sa, save_stream_file=p)
142
143 f = tflow.tflow(resp=True)
144 sa.request(f)
145 sa.response(f)
146 tctx.configure(sa, save_stream_file=None)
147 assert rd(p)[0].response
148
149 tctx.configure(sa, save_stream_file="+" + p)
150 f = tflow.tflow(err=True)
151 sa.request(f)
152 sa.error(f)
153 tctx.configure(sa, save_stream_file=None)
154 assert rd(p)[1].error
155
156 tctx.configure(sa, save_stream_file="+" + p)
157 f = tflow.tflow()
158 sa.request(f)
159 tctx.configure(sa, save_stream_file=None)
160 assert not rd(p)[2].response
161
162 f = tflow.tflow()
163 sa.response(f)
164 assert len(rd(p)) == 3
165
166
167def test_rotate_stream(tmp_path):

Callers

nothing calls this directly

Calls 6

requestMethod · 0.95
responseMethod · 0.95
errorMethod · 0.95
contextMethod · 0.80
rdFunction · 0.70
configureMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…