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

Method test_order

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

Source from the content-addressed store, hash-verified

242 assert not sl.addons
243
244 async def test_order(self, tdata, caplog_async):
245 caplog_async.set_level("DEBUG")
246 rec = tdata.path("mitmproxy/data/addonscripts/recorder")
247 sc = script.ScriptLoader()
248 sc.is_running = True
249 with taddons.context(sc) as tctx:
250 tctx.configure(
251 sc,
252 scripts=[
253 "%s/a.py" % rec,
254 "%s/b.py" % rec,
255 "%s/c.py" % rec,
256 ],
257 )
258 await caplog_async.await_log("configure")
259 debug = [
260 i.msg for i in caplog_async.caplog.records if i.levelname == "DEBUG"
261 ]
262 assert debug == [
263 "a load",
264 "a configure",
265 "a running",
266 "b load",
267 "b configure",
268 "b running",
269 "c load",
270 "c configure",
271 "c running",
272 ]
273
274 caplog_async.clear()
275 tctx.configure(
276 sc,
277 scripts=[
278 "%s/c.py" % rec,
279 "%s/a.py" % rec,
280 "%s/b.py" % rec,
281 ],
282 )
283
284 await caplog_async.await_log("b configure")
285 debug = [
286 i.msg for i in caplog_async.caplog.records if i.levelname == "DEBUG"
287 ]
288 assert debug == [
289 "c configure",
290 "a configure",
291 "b configure",
292 ]
293
294 caplog_async.clear()
295 tctx.configure(
296 sc,
297 scripts=[
298 "%s/e.py" % rec,
299 "%s/a.py" % rec,
300 ],
301 )

Callers

nothing calls this directly

Calls 6

set_levelMethod · 0.80
contextMethod · 0.80
await_logMethod · 0.80
pathMethod · 0.45
configureMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected