mitmproxy/test/test_cmdline.py

35 lines
799 B
Python
Raw Normal View History

2011-03-12 02:14:25 +00:00
import optparse
import libpry
from libmproxy import cmdline
class uAll(libpry.AutoTree):
def test_common(self):
parser = optparse.OptionParser()
cmdline.common_options(parser)
opts, args = parser.parse_args(args=[])
assert cmdline.get_common_options(opts)
opts.stickycookie_all = True
2011-03-20 05:52:16 +00:00
opts.stickyauth_all = True
2011-03-12 02:14:25 +00:00
v = cmdline.get_common_options(opts)
assert v["stickycookie"] == ".*"
2011-03-20 05:52:16 +00:00
assert v["stickyauth"] == ".*"
2011-03-12 02:14:25 +00:00
opts.stickycookie_all = False
2011-03-20 05:52:16 +00:00
opts.stickyauth_all = False
2011-03-12 02:14:25 +00:00
opts.stickycookie_filt = "foo"
2011-03-20 05:52:16 +00:00
opts.stickyauth_filt = "foo"
2011-03-12 02:14:25 +00:00
v = cmdline.get_common_options(opts)
assert v["stickycookie"] == "foo"
2011-03-20 05:52:16 +00:00
assert v["stickyauth"] == "foo"
2011-03-12 02:14:25 +00:00
tests = [
uAll()
]