MCPcopy
hub / github.com/mitmproxy/mitmproxy / test_taken

Method test_taken

test/mitmproxy/addons/test_modifybody.py:46–62  ·  view source on GitHub ↗
(self, take)

Source from the content-addressed store, hash-verified

44
45 @pytest.mark.parametrize("take", [True, False])
46 def test_taken(self, take):
47 mb = modifybody.ModifyBody()
48 with taddons.context(mb) as tctx:
49 tctx.configure(mb, modify_body=["/foo/bar"])
50 f = tflow.tflow()
51 f.request.content = b"foo"
52 if take:
53 f.response = tresp()
54 mb.request(f)
55 assert (f.request.content == b"bar") ^ take
56
57 f = tflow.tflow(resp=True)
58 f.response.content = b"foo"
59 if take:
60 f.kill()
61 mb.response(f)
62 assert (f.response.content == b"bar") ^ take
63
64 def test_order(self):
65 mb = modifybody.ModifyBody()

Callers

nothing calls this directly

Calls 6

requestMethod · 0.95
responseMethod · 0.95
trespFunction · 0.90
contextMethod · 0.80
configureMethod · 0.45
killMethod · 0.45

Tested by

no test coverage detected