aboutsummaryrefslogtreecommitdiffstats
path: root/test/tservers.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/tservers.py')
-rw-r--r--test/tservers.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/tservers.py b/test/tservers.py
index 5963667b..dbc9f7d0 100644
--- a/test/tservers.py
+++ b/test/tservers.py
@@ -1,6 +1,5 @@
import os.path
import threading
-import shutil
import tempfile
import flask
import mock
@@ -11,7 +10,6 @@ import libpathod.test
import libpathod.pathoc
from libmproxy import flow, controller
from libmproxy.cmdline import APP_HOST, APP_PORT
-import tutils
testapp = flask.Flask(__name__)
@@ -31,6 +29,7 @@ def errapp(environ, start_response):
class TestMaster(flow.FlowMaster):
+
def __init__(self, config):
config.port = 0
s = ProxyServer(config)
@@ -57,6 +56,7 @@ class TestMaster(flow.FlowMaster):
class ProxyThread(threading.Thread):
+
def __init__(self, tmaster):
threading.Thread.__init__(self)
self.tmaster = tmaster
@@ -133,6 +133,7 @@ class ProxTestBase(object):
class HTTPProxTest(ProxTestBase):
+
def pathoc_raw(self):
return libpathod.pathoc.Pathoc(("127.0.0.1", self.proxy.port), fp=None)
@@ -174,12 +175,14 @@ class HTTPProxTest(ProxTestBase):
class TResolver:
+
def __init__(self, port):
self.port = port
def original_addr(self, sock):
return ("127.0.0.1", self.port)
+
class TransparentProxTest(ProxTestBase):
ssl = None
resolver = TResolver
@@ -265,6 +268,7 @@ class ReverseProxTest(ProxTestBase):
class SocksModeTest(HTTPProxTest):
+
@classmethod
def get_proxy_config(cls):
d = ProxTestBase.get_proxy_config()
@@ -273,6 +277,7 @@ class SocksModeTest(HTTPProxTest):
class ChainProxTest(ProxTestBase):
+
"""
Chain three instances of mitmproxy in a row to test upstream mode.
Proxy order is cls.proxy -> cls.chain[0] -> cls.chain[1]