MCPcopy
hub / github.com/mitmproxy/mitmproxy / test_save_command

Function test_save_command

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

Source from the content-addressed store, hash-verified

114
115
116def test_save_command(tmp_path):
117 sa = save.Save()
118 with taddons.context() as tctx:
119 p = str(tmp_path / "foo")
120 sa.save([tflow.tflow(resp=True)], p)
121 assert len(rd(p)) == 1
122 sa.save([tflow.tflow(resp=True)], p)
123 assert len(rd(p)) == 1
124 sa.save([tflow.tflow(resp=True)], "+" + p)
125 assert len(rd(p)) == 2
126
127 with pytest.raises(exceptions.CommandError):
128 sa.save([tflow.tflow(resp=True)], str(tmp_path))
129
130 v = view.View()
131 tctx.master.addons.add(v)
132 tctx.master.addons.add(sa)
133 tctx.master.commands.execute("save.file @shown %s" % p)
134
135
136def test_simple(tmp_path):

Callers

nothing calls this directly

Calls 5

saveMethod · 0.95
contextMethod · 0.80
executeMethod · 0.80
rdFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…