aboutsummaryrefslogtreecommitdiffstats
path: root/test/mitmproxy/mastertest.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/mitmproxy/mastertest.py')
-rw-r--r--test/mitmproxy/mastertest.py21
1 files changed, 6 insertions, 15 deletions
diff --git a/test/mitmproxy/mastertest.py b/test/mitmproxy/mastertest.py
index dcc0dc48..08659d19 100644
--- a/test/mitmproxy/mastertest.py
+++ b/test/mitmproxy/mastertest.py
@@ -1,5 +1,3 @@
-import mock
-
from . import tutils
import netlib.tutils
@@ -8,26 +6,19 @@ from mitmproxy import flow, proxy, models, controller
class MasterTest:
- def invoke(self, master, handler, *message):
- with master.handlecontext():
- func = getattr(master, handler)
- func(*message)
- if message:
- message[0].reply = controller.DummyReply()
def cycle(self, master, content):
f = tutils.tflow(req=netlib.tutils.treq(content=content))
l = proxy.Log("connect")
- l.reply = mock.MagicMock()
+ l.reply = controller.DummyReply()
master.log(l)
- self.invoke(master, "clientconnect", f.client_conn)
- self.invoke(master, "clientconnect", f.client_conn)
- self.invoke(master, "serverconnect", f.server_conn)
- self.invoke(master, "request", f)
+ master.clientconnect(f.client_conn)
+ master.serverconnect(f.server_conn)
+ master.request(f)
if not f.error:
f.response = models.HTTPResponse.wrap(netlib.tutils.tresp(content=content))
- self.invoke(master, "response", f)
- self.invoke(master, "clientdisconnect", f)
+ master.response(f)
+ master.clientdisconnect(f)
return f
def dummy_cycle(self, master, n, content):