MCPcopy
hub / github.com/mitmproxy/mitmproxy / test_bind

Function test_bind

test/mitmproxy/tools/console/test_keymap.py:14–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12
13
14def test_bind():
15 with taddons.context() as tctx:
16 km = keymap.Keymap(tctx.master)
17 km.executor = mock.Mock()
18
19 with pytest.raises(ValueError):
20 km.add("foo", "bar", ["unsupported"])
21
22 km.add("key", "str", ["options", "commands"])
23 assert km.get("options", "key")
24 assert km.get("commands", "key")
25 assert not km.get("flowlist", "key")
26 assert len(km.list("commands")) == 1
27
28 km.handle("unknown", "unknown")
29 assert not km.executor.called
30
31 km.handle("options", "key")
32 assert km.executor.called
33
34 km.add("glob", "str", ["global"])
35 km.executor = mock.Mock()
36 km.handle("options", "glob")
37 assert km.executor.called
38
39 assert len(km.list("global")) == 1
40
41
42def test_join():

Callers

nothing calls this directly

Calls 5

addMethod · 0.95
getMethod · 0.95
listMethod · 0.95
handleMethod · 0.95
contextMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…