MCPcopy
hub / github.com/mitmproxy/mitmproxy / test_cut_save

Function test_cut_save

test/mitmproxy/addons/test_cut.py:117–136  ·  view source on GitHub ↗
(tmpdir)

Source from the content-addressed store, hash-verified

115
116
117def test_cut_save(tmpdir):
118 f = str(tmpdir.join("path"))
119 v = view.View()
120 c = cut.Cut()
121 with taddons.context() as tctx:
122 tctx.master.addons.add(v, c)
123 v.add([tflow.tflow(resp=True)])
124
125 tctx.command(c.save, "@all", "request.method", f)
126 assert qr(f) == b"GET"
127 tctx.command(c.save, "@all", "request.content", f)
128 assert qr(f) == b"content"
129 tctx.command(c.save, "@all", "request.content", "+" + f)
130 assert qr(f) == b"content\ncontent"
131
132 v.add([tflow.tflow(resp=True)])
133 tctx.command(c.save, "@all", "request.method", f)
134 assert qr(f).splitlines() == [b"GET", b"GET"]
135 tctx.command(c.save, "@all", "request.method,request.content", f)
136 assert qr(f).splitlines() == [b"GET,b'content'", b"GET,b'content'"]
137
138
139@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 6

addMethod · 0.95
contextMethod · 0.80
commandMethod · 0.80
qrFunction · 0.70
joinMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…