MCPcopy
hub / github.com/mitmproxy/mitmproxy / test_commands_exist

Function test_commands_exist

test/mitmproxy/tools/console/test_defaultkeys.py:5–20  ·  view source on GitHub ↗
(console)

Source from the content-addressed store, hash-verified

3
4
5async def test_commands_exist(console):
6 await console.load_flow(tflow())
7
8 for binding in console.keymap.bindings:
9 try:
10 parsed, _ = console.commands.parse_partial(binding.command.strip())
11
12 cmd = parsed[0].value
13 args = [a.value for a in parsed[1:] if a.type != mitmproxy.types.Space]
14
15 assert cmd in console.commands.commands
16
17 cmd_obj = console.commands.commands[cmd]
18 cmd_obj.prepare_args(args)
19 except Exception as e:
20 raise ValueError(f"Invalid binding: {binding.command}") from e

Callers

nothing calls this directly

Calls 4

tflowFunction · 0.90
parse_partialMethod · 0.80
prepare_argsMethod · 0.80
load_flowMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…