mirror of
https://github.com/vee1e/mitmproxy.git
synced 2026-09-03 03:07:18 +00:00
fix mitmweb master shutdown, tests++
This commit is contained in:
parent
80d149f7bf
commit
ca3e98640c
3 changed files with 28 additions and 1 deletions
|
|
@ -12,7 +12,6 @@ from mitmproxy.addons import readfile
|
|||
from mitmproxy.addons import termlog
|
||||
from mitmproxy.addons import view
|
||||
from mitmproxy.addons import termstatus
|
||||
from mitmproxy.options import Options # noqa
|
||||
from mitmproxy.tools.web import app, webaddons, static_viewer
|
||||
|
||||
|
||||
|
|
@ -130,6 +129,10 @@ class WebMaster(master.Master):
|
|||
except KeyboardInterrupt:
|
||||
self.shutdown()
|
||||
|
||||
def shutdown(self):
|
||||
tornado.ioloop.IOLoop.instance().stop()
|
||||
super().shutdown()
|
||||
|
||||
|
||||
def open_browser(url: str) -> bool:
|
||||
"""
|
||||
|
|
|
|||
5
test/mitmproxy/data/addonscripts/shutdown.py
Normal file
5
test/mitmproxy/data/addonscripts/shutdown.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
from mitmproxy import ctx
|
||||
|
||||
|
||||
def running():
|
||||
ctx.master.shutdown()
|
||||
19
test/mitmproxy/tools/test_main.py
Normal file
19
test/mitmproxy/tools/test_main.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
from mitmproxy.test import tutils
|
||||
from mitmproxy.tools import main
|
||||
|
||||
shutdown_script = tutils.test_data.path("mitmproxy/data/addonscripts/shutdown.py")
|
||||
|
||||
|
||||
def test_mitmweb():
|
||||
main.mitmweb([
|
||||
"--no-web-open-browser",
|
||||
"-q",
|
||||
"-s", shutdown_script
|
||||
])
|
||||
|
||||
|
||||
def test_mitmdump():
|
||||
main.mitmdump([
|
||||
"-q",
|
||||
"-s", shutdown_script
|
||||
])
|
||||
Loading…
Add table
Add a link
Reference in a new issue