aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_proxy.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_proxy.py')
-rw-r--r--test/test_proxy.py31
1 files changed, 10 insertions, 21 deletions
diff --git a/test/test_proxy.py b/test/test_proxy.py
index 6ab19e02..301ce2ca 100644
--- a/test/test_proxy.py
+++ b/test/test_proxy.py
@@ -1,8 +1,7 @@
-import argparse
from libmproxy import cmdline
-from libmproxy.proxy import ProxyConfig, process_proxy_options
+from libmproxy.proxy import ProxyConfig
+from libmproxy.proxy.config import process_proxy_options
from libmproxy.proxy.connection import ServerConnection
-from libmproxy.proxy.primitives import ProxyError
from libmproxy.proxy.server import DummyServer, ProxyServer, ConnectionHandler
import tutils
from libpathod import test
@@ -12,11 +11,6 @@ import mock
from OpenSSL import SSL
-def test_proxy_error():
- p = ProxyError(111, "msg")
- assert str(p)
-
-
class TestServerConnection:
def setUp(self):
self.d = test.Daemon()
@@ -97,13 +91,7 @@ class TestProcessProxyOptions:
self.assert_err("expected one argument", "-U")
self.assert_err("Invalid server specification", "-U", "upstream")
- self.assert_noerr("--spoof")
- self.assert_noerr("--ssl-spoof")
-
- self.assert_noerr("--spoofed-port", "443")
- self.assert_err("expected one argument", "--spoofed-port")
-
- self.assert_err("mutually exclusive", "-R", "http://localhost", "-T")
+ self.assert_err("not allowed with", "-R", "http://localhost", "-T")
def test_client_certs(self):
with tutils.tmpdir() as cadir:
@@ -181,13 +169,14 @@ class TestDummyServer:
class TestConnectionHandler:
def test_fatal_error(self):
config = mock.Mock()
- config.mode.get_upstream_server.side_effect = RuntimeError
+ root_layer = mock.Mock()
+ root_layer.side_effect = RuntimeError
+ config.mode.return_value = root_layer
c = ConnectionHandler(
- config,
mock.MagicMock(),
- ("127.0.0.1",
- 8080),
- None,
- mock.MagicMock())
+ ("127.0.0.1", 8080),
+ config,
+ mock.MagicMock()
+ )
with tutils.capture_stderr(c.handle) as output:
assert "mitmproxy has crashed" in output