Permalink
Browse files

remove output of dumper during tests

  • Loading branch information...
1 parent a196493 commit 24751965f99daf83c82d9c1581f712ca24da9d3d @Kriechi Kriechi committed Dec 21, 2016
Showing with 11 additions and 8 deletions.
  1. +5 −3 mitmproxy/tools/dump.py
  2. +3 −2 mitmproxy/tools/web/master.py
  3. +2 −1 test/mitmproxy/test_tools_dump.py
  4. +1 −2 test/mitmproxy/test_web_app.py
@@ -30,12 +30,14 @@ def __init__(
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 @@
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 @@ def __init__(self, options, server):
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 @@
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)

0 comments on commit 2475196

Please sign in to comment.