aboutsummaryrefslogtreecommitdiffstats
path: root/test/mitmproxy/addons/test_core.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2017-04-29 09:58:32 +1200
committerAldo Cortesi <aldo@corte.si>2017-04-29 09:58:32 +1200
commit7317ea134e467dd0bc8ad9129dd8a417b0a0fdfd (patch)
treec1dbff334576f33a0fd3ef0cb4760cb2e878a641 /test/mitmproxy/addons/test_core.py
parentf21a970f294486e47b183472ef9f535e2a661604 (diff)
downloadmitmproxy-7317ea134e467dd0bc8ad9129dd8a417b0a0fdfd.tar.gz
mitmproxy-7317ea134e467dd0bc8ad9129dd8a417b0a0fdfd.tar.bz2
mitmproxy-7317ea134e467dd0bc8ad9129dd8a417b0a0fdfd.zip
command: flow.kill, flow.replay
Plus the matching bindings in the flow list.
Diffstat (limited to 'test/mitmproxy/addons/test_core.py')
-rw-r--r--test/mitmproxy/addons/test_core.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/mitmproxy/addons/test_core.py b/test/mitmproxy/addons/test_core.py
index 2d9ee751..9501fb22 100644
--- a/test/mitmproxy/addons/test_core.py
+++ b/test/mitmproxy/addons/test_core.py
@@ -3,6 +3,7 @@ from mitmproxy.test import taddons
from mitmproxy.test import tflow
from mitmproxy import exceptions
import pytest
+from unittest import mock
def test_set():
@@ -40,3 +41,22 @@ def test_mark():
assert not f.marked
sa.mark_toggle([f])
assert f.marked
+
+
+def test_replay():
+ sa = core.Core()
+ with taddons.context():
+ f = tflow.tflow()
+ with mock.patch("mitmproxy.master.Master.replay_request") as rp:
+ sa.replay(f)
+ assert rp.called
+
+
+def test_kill():
+ sa = core.Core()
+ with taddons.context():
+ f = tflow.tflow()
+ f.intercept()
+ assert f.killable
+ sa.kill([f])
+ assert not f.killable