From fe58c1c6eb16fdc14bd24843cb896b3d8a4eefc8 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Mon, 10 Mar 2014 05:11:51 +0100 Subject: add advanced proxying options, add SSL-terminating capability to mitmproxy --- test/test_proxy.py | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) (limited to 'test/test_proxy.py') 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: -- cgit v1.2.3