From 8c49f0e784a0470a45616d631483c5aeeb1f7937 Mon Sep 17 00:00:00 2001 From: Shadab Zafar Date: Fri, 15 Jul 2016 17:02:08 +0530 Subject: Add tests for TCPFlow.match --- test/mitmproxy/test_flow.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'test') 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): -- cgit v1.2.3