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

Function test_loader

test/mitmproxy/test_addonmanager.py:157–174  ·  view source on GitHub ↗
(caplog)

Source from the content-addressed store, hash-verified

155
156
157async def test_loader(caplog):
158 with taddons.context() as tctx:
159 loader = addonmanager.Loader(tctx.master)
160 loader.add_option("custom_option", bool, False, "help")
161 assert "custom_option" in loader.master.options
162
163 # calling this again with the same signature is a no-op.
164 loader.add_option("custom_option", bool, False, "help")
165 assert not caplog.text
166
167 # a different signature should emit a warning though.
168 loader.add_option("custom_option", bool, True, "help")
169 assert "Over-riding existing option" in caplog.text
170
171 def cmd(a: str) -> str:
172 return "foo"
173
174 loader.add_command("test.command", cmd)
175
176
177async def test_simple(caplog):

Callers

nothing calls this directly

Calls 3

add_optionMethod · 0.95
add_commandMethod · 0.95
contextMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…