aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2017-04-29 11:52:38 +1200
committerGitHub <noreply@github.com>2017-04-29 11:52:38 +1200
commita32f87fef9589fb09ff9144a459de2ff37ed29ee (patch)
tree44982fa8a8557e2ae15813703bf113a7df10a001 /test
parentc7247e026d3fb57ea063cfe4e5335b914ad15a15 (diff)
parentf908ea220f78754266a54dd57f34dcc24d761f1d (diff)
downloadmitmproxy-a32f87fef9589fb09ff9144a459de2ff37ed29ee.tar.gz
mitmproxy-a32f87fef9589fb09ff9144a459de2ff37ed29ee.tar.bz2
mitmproxy-a32f87fef9589fb09ff9144a459de2ff37ed29ee.zip
Merge pull request #2288 from cortesi/replayfiles
commands: "replay.client.file" and "replay.server.file"
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/addons/test_clientplayback.py10
-rw-r--r--test/mitmproxy/addons/test_serverplayback.py11
2 files changed, 21 insertions, 0 deletions
diff --git a/test/mitmproxy/addons/test_clientplayback.py b/test/mitmproxy/addons/test_clientplayback.py
index 843d7409..7ffda317 100644
--- a/test/mitmproxy/addons/test_clientplayback.py
+++ b/test/mitmproxy/addons/test_clientplayback.py
@@ -48,6 +48,16 @@ class TestClientPlayback:
cp.stop_replay()
assert not cp.flows
+ def test_load_file(self, tmpdir):
+ cp = clientplayback.ClientPlayback()
+ with taddons.context():
+ fpath = str(tmpdir.join("flows"))
+ tdump(fpath, [tflow.tflow(resp=True)])
+ cp.load_file(fpath)
+ assert cp.flows
+ with pytest.raises(exceptions.CommandError):
+ cp.load_file("/nonexistent")
+
def test_configure(self, tmpdir):
cp = clientplayback.ClientPlayback()
with taddons.context() as tctx:
diff --git a/test/mitmproxy/addons/test_serverplayback.py b/test/mitmproxy/addons/test_serverplayback.py
index e0c025fe..3ceab3fa 100644
--- a/test/mitmproxy/addons/test_serverplayback.py
+++ b/test/mitmproxy/addons/test_serverplayback.py
@@ -16,6 +16,17 @@ def tdump(path, flows):
w.add(i)
+def test_load_file(tmpdir):
+ s = serverplayback.ServerPlayback()
+ with taddons.context():
+ fpath = str(tmpdir.join("flows"))
+ tdump(fpath, [tflow.tflow(resp=True)])
+ s.load_file(fpath)
+ assert s.flowmap
+ with pytest.raises(exceptions.CommandError):
+ s.load_file("/nonexistent")
+
+
def test_config(tmpdir):
s = serverplayback.ServerPlayback()
with taddons.context() as tctx: