mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-01-30 23:09:44 +00:00
remove output of dumper during tests
This commit is contained in:
parent
a196493a7a
commit
24751965f9
@ -30,12 +30,14 @@ class Options(options.Options):
|
||||
|
||||
class DumpMaster(master.Master):
|
||||
|
||||
def __init__(self, options, server):
|
||||
def __init__(self, options, server, with_termlog=True, with_dumper=True):
|
||||
master.Master.__init__(self, options, server)
|
||||
self.has_errored = False
|
||||
self.addons.add(termlog.TermLog())
|
||||
if with_termlog:
|
||||
self.addons.add(termlog.TermLog())
|
||||
self.addons.add(*addons.default_addons())
|
||||
self.addons.add(dumper.Dumper())
|
||||
if with_dumper:
|
||||
self.addons.add(dumper.Dumper())
|
||||
# This line is just for type hinting
|
||||
self.options = self.options # type: Options
|
||||
|
||||
|
@ -15,7 +15,7 @@ from mitmproxy.tools.web import app
|
||||
|
||||
|
||||
class WebMaster(master.Master):
|
||||
def __init__(self, options, server):
|
||||
def __init__(self, options, server, with_termlog=True):
|
||||
super().__init__(options, server)
|
||||
self.view = view.View()
|
||||
self.view.sig_view_add.connect(self._sig_view_add)
|
||||
@ -34,8 +34,9 @@ class WebMaster(master.Master):
|
||||
intercept.Intercept(),
|
||||
self.view,
|
||||
self.events,
|
||||
termlog.TermLog(),
|
||||
)
|
||||
if with_termlog:
|
||||
self.addons.add(termlog.TermLog())
|
||||
self.app = app.Application(
|
||||
self, self.options.wdebug
|
||||
)
|
||||
|
@ -11,7 +11,8 @@ from . import mastertest
|
||||
class TestDumpMaster(mastertest.MasterTest):
|
||||
def mkmaster(self, flt, **options):
|
||||
o = dump.Options(filtstr=flt, verbosity=-1, flow_detail=0, **options)
|
||||
return dump.DumpMaster(o, proxy.DummyServer())
|
||||
m = dump.DumpMaster(o, proxy.DummyServer(), with_termlog=False, with_dumper=False)
|
||||
return m
|
||||
|
||||
def test_read(self):
|
||||
with tutils.tmpdir() as t:
|
||||
|
@ -19,8 +19,7 @@ def json(resp: httpclient.HTTPResponse):
|
||||
class TestApp(tornado.testing.AsyncHTTPTestCase):
|
||||
def get_app(self):
|
||||
o = options.Options()
|
||||
m = webmaster.WebMaster(o, proxy.DummyServer())
|
||||
m.addons.remove(m.addons.get('termlog'))
|
||||
m = webmaster.WebMaster(o, proxy.DummyServer(), with_termlog=False)
|
||||
f = tflow.tflow(resp=True)
|
||||
f.id = "42"
|
||||
m.view.add(f)
|
||||
|
Loading…
Reference in New Issue
Block a user