aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2017-04-30 21:44:52 +1200
committerAldo Cortesi <aldo@nullcube.com>2017-04-30 22:02:29 +1200
commita570caccbda28f19e637231df10b28550e8919af (patch)
tree652761a843614e22674c76496a704adfad7d915b /test
parent3cd93567f5be263f1b40b2545573d024f69d2bdd (diff)
downloadmitmproxy-a570caccbda28f19e637231df10b28550e8919af.tar.gz
mitmproxy-a570caccbda28f19e637231df10b28550e8919af.tar.bz2
mitmproxy-a570caccbda28f19e637231df10b28550e8919af.zip
commands: view.load
Plus replace the flow list keybinding.
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/addons/test_view.py21
1 files changed, 20 insertions, 1 deletions
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():