diff options
author | Henrique <typoon@gmail.com> | 2019-11-22 10:00:17 -0500 |
---|---|---|
committer | Henrique <typoon@gmail.com> | 2019-11-22 10:00:17 -0500 |
commit | 16b55f9476373347a3c2553e070497b383288360 (patch) | |
tree | 46f1bc8b46f6879d5429f7ce9ede834185942b12 /test | |
parent | bbb7eb692f58ebfcf2fb3b0d6d20ec6dc60a99de (diff) | |
download | mitmproxy-16b55f9476373347a3c2553e070497b383288360.tar.gz mitmproxy-16b55f9476373347a3c2553e070497b383288360.tar.bz2 mitmproxy-16b55f9476373347a3c2553e070497b383288360.zip |
Implemented feature to save command history to a file. This allows users
to reuse their commands the next time they open mitmproxy
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/tools/console/test_commander.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/test/mitmproxy/tools/console/test_commander.py b/test/mitmproxy/tools/console/test_commander.py index a77be043..5e11166e 100644 --- a/test/mitmproxy/tools/console/test_commander.py +++ b/test/mitmproxy/tools/console/test_commander.py @@ -97,6 +97,7 @@ class TestCommandEdit: def test_up_and_down(self): with taddons.context() as tctx: history = commander.CommandHistory(tctx.master, size=3) + history.clear_history() edit = commander.CommandEdit(tctx.master, '', history) buf = commander.CommandBuffer(tctx.master, 'cmd1') @@ -112,6 +113,7 @@ class TestCommandEdit: assert edit.get_edit_text() == 'cmd1' history = commander.CommandHistory(tctx.master, size=5) + history.clear_history() edit = commander.CommandEdit(tctx.master, '', history) edit.keypress(1, 'a') edit.keypress(1, 'b') @@ -139,6 +141,7 @@ class TestCommandHistory: def fill_history(self, commands): with taddons.context() as tctx: history = commander.CommandHistory(tctx.master, size=3) + history.clear_history() for c in commands: cbuf = commander.CommandBuffer(tctx.master, c) history.add_command(cbuf) @@ -183,7 +186,7 @@ class TestCommandHistory: for i in range(3): assert history.get_next().text == expected_items[i] # We are at the last item of the history - assert history.get_next() is None + assert history.get_next().text == expected_items[-1] def test_get_prev(self): commands = ["command1", "command2"] @@ -194,7 +197,7 @@ class TestCommandHistory: for i in range(3): assert history.get_prev().text == expected_items[i] # We are at the first item of the history - assert history.get_prev() is None + assert history.get_prev().text == expected_items[-1] class TestCommandBuffer: |