aboutsummaryrefslogtreecommitdiffstats
path: root/test/tservers.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2013-02-23 16:34:59 +1300
committerAldo Cortesi <aldo@nullcube.com>2013-02-23 16:34:59 +1300
commit269780c57780d155c4d8bd95fcc2af2104effa5b (patch)
tree48df9108a2378cd87dfe2893adcafc88afe52ca5 /test/tservers.py
parentf203881b0d7f81a7f8ecbc44b7030060242af01b (diff)
downloadmitmproxy-269780c57780d155c4d8bd95fcc2af2104effa5b.tar.gz
mitmproxy-269780c57780d155c4d8bd95fcc2af2104effa5b.tar.bz2
mitmproxy-269780c57780d155c4d8bd95fcc2af2104effa5b.zip
Unit test dummy response functions.
Diffstat (limited to 'test/tservers.py')
-rw-r--r--test/tservers.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/test/tservers.py b/test/tservers.py
index 4cbdc942..3fdb8d13 100644
--- a/test/tservers.py
+++ b/test/tservers.py
@@ -29,16 +29,20 @@ class TestMaster(flow.FlowMaster):
flow.FlowMaster.__init__(self, s, state)
self.testq = testq
- def handle(self, m):
- flow.FlowMaster.handle(self, m)
+ def handle_request(self, m):
+ flow.FlowMaster.handle_request(self, m)
+ m.reply()
+
+ def handle_response(self, m):
+ flow.FlowMaster.handle_response(self, m)
m.reply()
class ProxyThread(threading.Thread):
- def __init__(self, testq, config):
- self.tmaster = TestMaster(testq, config)
- controller.should_exit = False
+ def __init__(self, tmaster):
threading.Thread.__init__(self)
+ self.tmaster = tmaster
+ controller.should_exit = False
@property
def port(self):
@@ -52,6 +56,7 @@ class ProxyThread(threading.Thread):
class ProxTestBase:
+ masterclass = TestMaster
@classmethod
def setupAll(cls):
cls.tqueue = Queue.Queue()
@@ -61,7 +66,8 @@ class ProxTestBase:
certfile=tutils.test_data.path("data/testkey.pem"),
**pconf
)
- cls.proxy = ProxyThread(cls.tqueue, config)
+ tmaster = cls.masterclass(cls.tqueue, config)
+ cls.proxy = ProxyThread(tmaster)
cls.proxy.start()
@property