aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorShadab Zafar <dufferzafar0@gmail.com>2016-07-13 15:37:13 +0530
committerShadab Zafar <dufferzafar0@gmail.com>2016-07-16 10:15:38 +0530
commit767457fda9bbfb1bb478daac7250b2d89fee2e04 (patch)
tree7a505ef6c5b14d8487a967cce31bfc134bc0ec27 /test
parentffcdd02e960e20760edfd7bf5a09132c411e26e4 (diff)
downloadmitmproxy-767457fda9bbfb1bb478daac7250b2d89fee2e04.tar.gz
mitmproxy-767457fda9bbfb1bb478daac7250b2d89fee2e04.tar.bz2
mitmproxy-767457fda9bbfb1bb478daac7250b2d89fee2e04.zip
Add tests for HTTPFlow only filters
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_filt.py50
1 files changed, 50 insertions, 0 deletions
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):