aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2017-12-15 09:43:09 +1300
committerAldo Cortesi <aldo@corte.si>2017-12-15 10:07:47 +1300
commit8c0ba71fd8f2e29e8348c88aa6d653d3161ea20a (patch)
tree2f49f2ef13002a228e2b6e6cd4f36548dc1321ed /test
parent4d358c49fbeafe504cc7b9a8b66ea572c8cbb0ee (diff)
downloadmitmproxy-8c0ba71fd8f2e29e8348c88aa6d653d3161ea20a.tar.gz
mitmproxy-8c0ba71fd8f2e29e8348c88aa6d653d3161ea20a.tar.bz2
mitmproxy-8c0ba71fd8f2e29e8348c88aa6d653d3161ea20a.zip
commander: tab completion for command names
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/tools/console/test_commander.py25
1 files changed, 25 insertions, 0 deletions
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):