diff options
author | Maximilian Hils <git@maximilianhils.com> | 2020-04-09 08:37:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-09 08:37:57 +0200 |
commit | 0d9e517c064ca3992fac83c3a1ec6e4284221e72 (patch) | |
tree | c1472652ee95cf8c41b91d544e89f3b0d64c0323 /test/mitmproxy/addons/test_command_history.py | |
parent | 4d6886a0f4ebbf6bc66b74fa548ff724ba2ad660 (diff) | |
parent | b5e3f736c0c6654c3ef0d1f280a4eacdb5ca91de (diff) | |
download | mitmproxy-0d9e517c064ca3992fac83c3a1ec6e4284221e72.tar.gz mitmproxy-0d9e517c064ca3992fac83c3a1ec6e4284221e72.tar.bz2 mitmproxy-0d9e517c064ca3992fac83c3a1ec6e4284221e72.zip |
Merge pull request #3767 from mitmproxy/fix-ci
re-add missing CI steps and fix linting
Diffstat (limited to 'test/mitmproxy/addons/test_command_history.py')
-rw-r--r-- | test/mitmproxy/addons/test_command_history.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/test/mitmproxy/addons/test_command_history.py b/test/mitmproxy/addons/test_command_history.py index df20fba7..245bbc26 100644 --- a/test/mitmproxy/addons/test_command_history.py +++ b/test/mitmproxy/addons/test_command_history.py @@ -5,15 +5,22 @@ from mitmproxy.test import taddons class TestCommandHistory: - def test_load_from_file(self, tmpdir): - commands = ['cmd1', 'cmd2', 'cmd3'] - with open(tmpdir.join('command_history'), 'w') as f: + def test_load_and_save(self, tmpdir): + history_file = tmpdir.join('command_history') + commands = ["cmd1", "cmd2", "cmd3"] + with open(history_file, 'w') as f: f.write("\n".join(commands)) ch = command_history.CommandHistory() + ch.VACUUM_SIZE = 4 with taddons.context(ch) as tctx: tctx.options.confdir = str(tmpdir) assert ch.history == commands + ch.add_command("cmd4") + ch.done() + + with open(history_file, "r") as f: + assert f.read() == "cmd3\ncmd4\n" def test_add_command(self): history = command_history.CommandHistory() |