From a570caccbda28f19e637231df10b28550e8919af Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 30 Apr 2017 21:44:52 +1200 Subject: commands: view.load Plus replace the flow list keybinding. --- test/mitmproxy/addons/test_view.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/mitmproxy/addons/test_view.py b/test/mitmproxy/addons/test_view.py index 979f0aa1..eddcb04c 100644 --- a/test/mitmproxy/addons/test_view.py +++ b/test/mitmproxy/addons/test_view.py @@ -5,6 +5,7 @@ from mitmproxy.test import tflow from mitmproxy.addons import view from mitmproxy import flowfilter from mitmproxy import exceptions +from mitmproxy import io from mitmproxy.test import taddons @@ -130,10 +131,28 @@ def test_filter(): assert len(v) == 4 -def test_load(): +def tdump(path, flows): + w = io.FlowWriter(open(path, "wb")) + for i in flows: + w.add(i) + + +def test_load(tmpdir): + path = str(tmpdir.join("path")) v = view.View() with taddons.context() as tctx: tctx.master.addons.add(v) + tdump( + path, + [ + tflow.tflow(resp=True), + tflow.tflow(resp=True) + ] + ) + v.load_file(path) + assert len(v) == 2 + v.load_file(path) + assert len(v) == 4 def test_resolve(): -- cgit v1.2.3