aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShadab Zafar <dufferzafar0@gmail.com>2016-07-15 17:02:08 +0530
committerShadab Zafar <dufferzafar0@gmail.com>2016-07-16 10:15:38 +0530
commit8c49f0e784a0470a45616d631483c5aeeb1f7937 (patch)
tree91ab6487f202d27db2a8ca3530f99e1ba9a43ae8
parent6a2668d8651b52a688ce5771d9a834473d334a64 (diff)
downloadmitmproxy-8c49f0e784a0470a45616d631483c5aeeb1f7937.tar.gz
mitmproxy-8c49f0e784a0470a45616d631483c5aeeb1f7937.tar.bz2
mitmproxy-8c49f0e784a0470a45616d631483c5aeeb1f7937.zip
Add tests for TCPFlow.match
-rw-r--r--test/mitmproxy/test_flow.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/mitmproxy/test_flow.py b/test/mitmproxy/test_flow.py
index c58a9703..67aa1302 100644
--- a/test/mitmproxy/test_flow.py
+++ b/test/mitmproxy/test_flow.py
@@ -293,7 +293,7 @@ class TestServerPlaybackState:
assert s._hash(r) == s._hash(r2)
-class TestFlow(object):
+class TestHTTPFlow(object):
def test_copy(self):
f = tutils.tflow(resp=True)
@@ -443,6 +443,20 @@ class TestFlow(object):
assert f.response.content == b"abarb"
+class TestTCPFlow:
+
+ def test_match(self):
+ f = tutils.ttcpflow()
+ assert not f.match("~b nonexistent")
+ assert f.match(None)
+ assert not f.match("~b nonexistent")
+
+ f = tutils.ttcpflow(err=True)
+ assert f.match("~e")
+
+ tutils.raises(ValueError, f.match, "~")
+
+
class TestState:
def test_backup(self):