From 8c0ba71fd8f2e29e8348c88aa6d653d3161ea20a Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Fri, 15 Dec 2017 09:43:09 +1300 Subject: commander: tab completion for command names --- test/mitmproxy/tools/console/test_commander.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test') diff --git a/test/mitmproxy/tools/console/test_commander.py b/test/mitmproxy/tools/console/test_commander.py index 9ef4a318..1ac4c5c6 100644 --- a/test/mitmproxy/tools/console/test_commander.py +++ b/test/mitmproxy/tools/console/test_commander.py @@ -2,6 +2,31 @@ from mitmproxy.tools.console.commander import commander from mitmproxy.test import taddons +class TestListCompleter: + def test_cycle(self): + tests = [ + [ + "", + ["a", "b", "c"], + ["a", "b", "c", "a"] + ], + [ + "xxx", + ["a", "b", "c"], + ["xxx", "xxx", "xxx"] + ], + [ + "b", + ["a", "b", "ba", "bb", "c"], + ["b", "ba", "bb", "b"] + ], + ] + for start, options, cycle in tests: + c = commander.ListCompleter(start, options) + for expected in cycle: + assert c.cycle() == expected + + class TestCommandBuffer: def test_backspace(self): -- cgit v1.2.3