From 767457fda9bbfb1bb478daac7250b2d89fee2e04 Mon Sep 17 00:00:00 2001 From: Shadab Zafar Date: Wed, 13 Jul 2016 15:37:13 +0530 Subject: Add tests for HTTPFlow only filters --- test/mitmproxy/test_filt.py | 50 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/test/mitmproxy/test_filt.py b/test/mitmproxy/test_filt.py index 3f670423..2d2b87e6 100644 --- a/test/mitmproxy/test_filt.py +++ b/test/mitmproxy/test_filt.py @@ -268,6 +268,12 @@ class TestMatchingTCPFlow: assert self.q("~b hello", f) assert self.q("~b me", f) + # Request Body + assert not self.q("~bq whatever", f) + + # Response Body + assert not self.q("~bs whatever", f) + def test_src(self): f = self.flow() assert self.q("~src address", f) @@ -309,6 +315,50 @@ class TestMatchingTCPFlow: assert self.q("!~src :99 !~src :99", f) assert not self.q("!~src :99 !~src :22", f) + def test_request(self): + f = self.flow() + assert not self.q("~q", f) + + def test_response(self): + f = self.flow() + assert not self.q("~s", f) + + def test_headers(self): + f = self.flow() + assert not self.q("~h whatever", f) + + # Request headers + assert not self.q("~hq whatever", f) + + # Response headers + assert not self.q("~hs whatever", f) + + def test_content_type(self): + f = self.flow() + assert not self.q("~t whatever", f) + + # Request content-type + assert not self.q("~tq whatever", f) + + # Response content-type + assert not self.q("~ts whatever", f) + + def test_code(self): + f = self.flow() + assert not self.q("~c 200", f) + + def test_domain(self): + f = self.flow() + assert not self.q("~d whatever", f) + + def test_method(self): + f = self.flow() + assert not self.q("~m whatever", f) + + def test_url(self): + f = self.flow() + assert not self.q("~u whatever", f) + @patch('traceback.extract_tb') def test_pyparsing_bug(extract_tb): -- cgit v1.2.3