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

Method test_script_run

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

Source from the content-addressed store, hash-verified

176
177class TestScriptLoader:
178 async def test_script_run(self, tdata, caplog_async):
179 caplog_async.set_level("DEBUG")
180 rp = tdata.path("mitmproxy/data/addonscripts/recorder/recorder.py")
181 sc = script.ScriptLoader()
182 with taddons.context(sc):
183 sc.script_run([tflow.tflow(resp=True)], rp)
184 await caplog_async.await_log("recorder response")
185 debug = [
186 i.msg for i in caplog_async.caplog.records if i.levelname == "DEBUG"
187 ]
188 assert debug == [
189 "recorder configure",
190 "recorder running",
191 "recorder requestheaders",
192 "recorder request",
193 "recorder responseheaders",
194 "recorder response",
195 ]
196
197 async def test_script_run_nonexistent(self, caplog):
198 sc = script.ScriptLoader()

Callers

nothing calls this directly

Calls 5

script_runMethod · 0.95
set_levelMethod · 0.80
contextMethod · 0.80
await_logMethod · 0.80
pathMethod · 0.45

Tested by

no test coverage detected