diff options
author | Maximilian Hils <git@maximilianhils.com> | 2014-03-10 17:02:09 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2014-03-10 17:02:09 +0100 |
commit | b59013f6e3d80fa6bbf5640f2652559457f07d0e (patch) | |
tree | bba552a4d7f089dc422df2aff2a9095153118311 /test/test_proxy.py | |
parent | 982da23e9a219d055c2137f56b885c06006ca098 (diff) | |
parent | 9cc10630c8e0b0f249ed852299d3316ba42f128d (diff) | |
download | mitmproxy-b59013f6e3d80fa6bbf5640f2652559457f07d0e.tar.gz mitmproxy-b59013f6e3d80fa6bbf5640f2652559457f07d0e.tar.bz2 mitmproxy-b59013f6e3d80fa6bbf5640f2652559457f07d0e.zip |
Merge branch 'absolutely_relative_proxying'
Diffstat (limited to 'test/test_proxy.py')
-rw-r--r-- | test/test_proxy.py | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/test/test_proxy.py b/test/test_proxy.py index f53aa762..0f438482 100644 --- a/test/test_proxy.py +++ b/test/test_proxy.py @@ -43,28 +43,15 @@ class TestServerConnection: sc.finish() -class MockParser: - def __init__(self): - self.err = None - - def error(self, e): - self.err = e - - def __repr__(self): - return "ParseError(%s)"%self.err - - class TestProcessProxyOptions: def p(self, *args): - parser = argparse.ArgumentParser() + parser = tutils.MockParser() cmdline.common_options(parser) opts = parser.parse_args(args=args) - m = MockParser() - return m, process_proxy_options(m, opts) + return parser, process_proxy_options(parser, opts) def assert_err(self, err, *args): - m, p = self.p(*args) - assert err.lower() in m.err.lower() + tutils.raises(err, self.p, *args) def assert_noerr(self, *args): m, p = self.p(*args) @@ -84,11 +71,10 @@ class TestProcessProxyOptions: @mock.patch("libmproxy.platform.resolver") def test_transparent_reverse(self, o): - self.assert_err("can't set both", "-P", "reverse", "-T") + self.assert_err("mutually exclusive", "-R", "http://localhost", "-T") self.assert_noerr("-T") - assert o.call_count == 1 - self.assert_err("invalid reverse proxy", "-P", "reverse") - self.assert_noerr("-P", "http://localhost") + self.assert_err("Invalid server specification", "-R", "reverse") + self.assert_noerr("-R", "http://localhost") def test_client_certs(self): with tutils.tmpdir() as confdir: |