diff options
author | Shadab Zafar <dufferzafar0@gmail.com> | 2016-07-12 17:23:13 +0530 |
---|---|---|
committer | Shadab Zafar <dufferzafar0@gmail.com> | 2016-07-16 10:15:38 +0530 |
commit | 317355a9af6e7f9f12fcbaab96fcc92fbda4c929 (patch) | |
tree | 57a228f0fd3b5b8b75a9d00e62b26c8826a7000c | |
parent | 4e29993c1f3dc4798dc56bc45472758c1c4e61c3 (diff) | |
download | mitmproxy-317355a9af6e7f9f12fcbaab96fcc92fbda4c929.tar.gz mitmproxy-317355a9af6e7f9f12fcbaab96fcc92fbda4c929.tar.bz2 mitmproxy-317355a9af6e7f9f12fcbaab96fcc92fbda4c929.zip |
Add test for operators (& | !)
-rw-r--r-- | test/mitmproxy/test_filt.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/mitmproxy/test_filt.py b/test/mitmproxy/test_filt.py index a910a946..3f670423 100644 --- a/test/mitmproxy/test_filt.py +++ b/test/mitmproxy/test_filt.py @@ -285,6 +285,31 @@ class TestMatchingTCPFlow: assert not self.q("~dst :99", f) assert self.q("~dst address:22", f) + def test_and(self): + f = self.flow() + f.server_conn = tutils.tserver_conn() + assert self.q("~b hello & ~b me", f) + assert not self.q("~src wrongaddress & ~b hello", f) + assert self.q("(~src :22 & ~dst :22) & ~b hello", f) + assert not self.q("(~src address:22 & ~dst :22) & ~b nonexistent", f) + assert not self.q("(~src address:22 & ~dst :99) & ~b hello", f) + + def test_or(self): + f = self.flow() + f.server_conn = tutils.tserver_conn() + assert self.q("~b hello | ~b me", f) + assert self.q("~src :22 | ~b me", f) + assert not self.q("~src :99 | ~dst :99", f) + assert self.q("(~src :22 | ~dst :22) | ~b me", f) + + def test_not(self): + f = self.flow() + assert not self.q("! ~src :22", f) + assert self.q("! ~src :99", f) + assert self.q("!~src :99 !~src :99", f) + assert not self.q("!~src :99 !~src :22", f) + + @patch('traceback.extract_tb') def test_pyparsing_bug(extract_tb): """https://github.com/mitmproxy/mitmproxy/issues/1087""" |