MCPcopy
hub / github.com/mitmproxy/mitmproxy / test_simple

Method test_simple

test/mitmproxy/addons/test_script.py:66–84  ·  view source on GitHub ↗
(self, tdata, caplog_async)

Source from the content-addressed store, hash-verified

64 assert '"' not in s.fullpath
65
66 async def test_simple(self, tdata, caplog_async):
67 caplog_async.set_level("DEBUG")
68 sc = script.Script(
69 tdata.path("mitmproxy/data/addonscripts/recorder/recorder.py"),
70 True,
71 )
72 with taddons.context(sc) as tctx:
73 tctx.configure(sc)
74 await caplog_async.await_log("recorder configure")
75 rec = tctx.master.addons.get("recorder")
76
77 assert rec.call_log[0][0:2] == ("recorder", "load")
78
79 rec.call_log = []
80 f = tflow.tflow(resp=True)
81 tctx.master.addons.trigger(HttpRequestHook(f))
82
83 assert rec.call_log[0][1] == "request"
84 sc.done()
85
86 async def test_reload(self, tmp_path, caplog_async):
87 caplog_async.set_level("INFO")

Callers

nothing calls this directly

Calls 9

doneMethod · 0.95
HttpRequestHookClass · 0.90
set_levelMethod · 0.80
contextMethod · 0.80
await_logMethod · 0.80
triggerMethod · 0.80
pathMethod · 0.45
configureMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected