diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-02-15 16:34:22 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-02-15 16:34:22 +0100 |
commit | d7158f975e671b78f0a064dd873cfa7805667528 (patch) | |
tree | 9b40f263c4f613a0dc49f5d8628c371164afd546 /test/pathod/test_pathod_cmdline.py | |
parent | 5fe473fb431699c71aa74bb715c2cb5b0500f044 (diff) | |
download | mitmproxy-d7158f975e671b78f0a064dd873cfa7805667528.tar.gz mitmproxy-d7158f975e671b78f0a064dd873cfa7805667528.tar.bz2 mitmproxy-d7158f975e671b78f0a064dd873cfa7805667528.zip |
move tests into shared folder
Diffstat (limited to 'test/pathod/test_pathod_cmdline.py')
-rw-r--r-- | test/pathod/test_pathod_cmdline.py | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/test/pathod/test_pathod_cmdline.py b/test/pathod/test_pathod_cmdline.py new file mode 100644 index 00000000..829c4b32 --- /dev/null +++ b/test/pathod/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() |