diff options
author | Kevin Cui <krazycavin@gmail.com> | 2020-04-07 16:10:26 +0200 |
---|---|---|
committer | Kevin Cui <krazycavin@gmail.com> | 2020-04-07 16:10:26 +0200 |
commit | 4d2cb321d6fbbb1813fd9ae4d38568be8d3d4cb4 (patch) | |
tree | 004f7b6e26284c486f5c0ffd32d7d86d6825ca7f /test | |
parent | fbe296aaba774b01348a55a6c9e10097bfd61b60 (diff) | |
download | mitmproxy-4d2cb321d6fbbb1813fd9ae4d38568be8d3d4cb4.tar.gz mitmproxy-4d2cb321d6fbbb1813fd9ae4d38568be8d3d4cb4.tar.bz2 mitmproxy-4d2cb321d6fbbb1813fd9ae4d38568be8d3d4cb4.zip |
#3911 Support keybinding for different contexts with different commands
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/tools/console/test_keymap.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/test/mitmproxy/tools/console/test_keymap.py b/test/mitmproxy/tools/console/test_keymap.py index 0d6f9e88..f2c97ded 100644 --- a/test/mitmproxy/tools/console/test_keymap.py +++ b/test/mitmproxy/tools/console/test_keymap.py @@ -117,6 +117,21 @@ def test_load_path(tmpdir): kmc.load_path(km, dst) assert(km.get("chooser", "key1")) + with open(dst, 'w') as f: + f.write( + """ + - key: key2 + ctx: [flowlist] + cmd: foo + - key: key2 + ctx: [flowview] + cmd: bar + """ + ) + kmc.load_path(km, dst) + assert(km.get("flowlist", "key2")) + assert(km.get("flowview", "key2")) + km.add("key123", "str", ["flowlist", "flowview"]) with open(dst, 'w') as f: f.write( @@ -127,10 +142,9 @@ def test_load_path(tmpdir): """ ) kmc.load_path(km, dst) - for b in km.bindings: - if b.key == "key123": - assert b.contexts == ["options"] - break + assert(km.get("flowlist", "key123")) + assert(km.get("flowview", "key123")) + assert(km.get("options", "key123")) def test_parse(): |