aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2017-12-28 19:50:31 +0100
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2017-12-28 19:50:31 +0100
commita35716a3a7dad9007376ec8df3e62252f945fdf5 (patch)
tree36859953085a1063ee0ca7e2f70e76ddb75e2edf
parentf123fb600dfae40223db44bfda9dba87d8c4eda7 (diff)
downloadmitmproxy-a35716a3a7dad9007376ec8df3e62252f945fdf5.tar.gz
mitmproxy-a35716a3a7dad9007376ec8df3e62252f945fdf5.tar.bz2
mitmproxy-a35716a3a7dad9007376ec8df3e62252f945fdf5.zip
websocket: test killable
-rw-r--r--test/mitmproxy/test_websocket.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/mitmproxy/test_websocket.py b/test/mitmproxy/test_websocket.py
index 0a37f370..fcacec36 100644
--- a/test/mitmproxy/test_websocket.py
+++ b/test/mitmproxy/test_websocket.py
@@ -3,6 +3,7 @@ import pytest
from mitmproxy.io import tnetstring
from mitmproxy import flowfilter
+from mitmproxy.exceptions import Kill, ControlException
from mitmproxy.test import tflow
@@ -42,6 +43,20 @@ class TestWebSocketFlow:
assert f.error.get_state() == f2.error.get_state()
assert f.error is not f2.error
+ def test_kill(self):
+ f = tflow.twebsocketflow()
+ with pytest.raises(ControlException):
+ f.intercept()
+ f.resume()
+ f.kill()
+
+ f = tflow.twebsocketflow()
+ f.intercept()
+ assert f.killable
+ f.kill()
+ assert not f.killable
+ assert f.reply.value == Kill
+
def test_match(self):
f = tflow.twebsocketflow()
assert not flowfilter.match("~b nonexistent", f)