aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_pathod_cmdline.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2015-06-18 16:16:40 +1200
committerAldo Cortesi <aldo@nullcube.com>2015-06-18 16:16:40 +1200
commit274d0333f8bbd0bf88214747beeead991f36b72a (patch)
tree590d684d8ab9277cab441ffb07a79cc36412e4c7 /test/test_pathod_cmdline.py
parent78cb5fe573ffcc06e700bb2193f9aef212be267e (diff)
parent408b4ffef0a784bea7ec08c252e757bca6e28134 (diff)
downloadmitmproxy-274d0333f8bbd0bf88214747beeead991f36b72a.tar.gz
mitmproxy-274d0333f8bbd0bf88214747beeead991f36b72a.tar.bz2
mitmproxy-274d0333f8bbd0bf88214747beeead991f36b72a.zip
Merge pull request #27 from Kriechi/http2-wip
HTTP/2: add initial support
Diffstat (limited to 'test/test_pathod_cmdline.py')
-rw-r--r--test/test_pathod_cmdline.py85
1 files changed, 85 insertions, 0 deletions
diff --git a/test/test_pathod_cmdline.py b/test/test_pathod_cmdline.py
new file mode 100644
index 00000000..829c4b32
--- /dev/null
+++ b/test/test_pathod_cmdline.py
@@ -0,0 +1,85 @@
+from libpathod import pathod_cmdline as cmdline
+import tutils
+import cStringIO
+import mock
+
+
+@mock.patch("argparse.ArgumentParser.error")
+def test_pathod(perror):
+ assert cmdline.args_pathod(["pathod"])
+
+ a = cmdline.args_pathod(
+ [
+ "pathod",
+ "--cert",
+ tutils.test_data.path("data/testkey.pem")
+ ]
+ )
+ assert a.ssl_certs
+
+ a = cmdline.args_pathod(
+ [
+ "pathod",
+ "--cert",
+ "nonexistent"
+ ]
+ )
+ assert perror.called
+ perror.reset_mock()
+
+ a = cmdline.args_pathod(
+ [
+ "pathod",
+ "-a",
+ "foo=200"
+ ]
+ )
+ assert a.anchors
+
+ a = cmdline.args_pathod(
+ [
+ "pathod",
+ "-a",
+ "foo=" + tutils.test_data.path("data/response")
+ ]
+ )
+ assert a.anchors
+
+ a = cmdline.args_pathod(
+ [
+ "pathod",
+ "-a",
+ "?=200"
+ ]
+ )
+ assert perror.called
+ perror.reset_mock()
+
+ a = cmdline.args_pathod(
+ [
+ "pathod",
+ "-a",
+ "foo"
+ ]
+ )
+ assert perror.called
+ perror.reset_mock()
+
+ a = cmdline.args_pathod(
+ [
+ "pathod",
+ "--limit-size",
+ "200k"
+ ]
+ )
+ assert a.sizelimit
+
+ a = cmdline.args_pathod(
+ [
+ "pathod",
+ "--limit-size",
+ "q"
+ ]
+ )
+ assert perror.called
+ perror.reset_mock()