diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2017-12-10 17:35:59 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2017-12-10 18:26:24 +1300 |
commit | aeefcd08a40a8bd886d3bca6eca00ec5ace325ee (patch) | |
tree | ac97862c0c2f8fbce0ff10fd5e26783d7bd96936 /test | |
parent | 5067438ec178643ac6ffe9ce518f502bc680dc99 (diff) | |
download | mitmproxy-aeefcd08a40a8bd886d3bca6eca00ec5ace325ee.tar.gz mitmproxy-aeefcd08a40a8bd886d3bca6eca00ec5ace325ee.tar.bz2 mitmproxy-aeefcd08a40a8bd886d3bca6eca00ec5ace325ee.zip |
browser addon: start an isolated browser attached to the proxy
A simple addon that starts an instance of Chrome attached to the current
proxy. The instance is isolated in its own user data directory, and addons are
turned off.
Future work:
- I wasn't able to test the Windows executable path - a Windows dev should
confirm this for us.
- In future it would be nice to support other browsers like Firefox.
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/addons/test_browser.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/mitmproxy/addons/test_browser.py b/test/mitmproxy/addons/test_browser.py new file mode 100644 index 00000000..d1b32186 --- /dev/null +++ b/test/mitmproxy/addons/test_browser.py @@ -0,0 +1,20 @@ +from unittest import mock + +from mitmproxy.addons import browser +from mitmproxy.test import taddons + + +def test_browser(): + with mock.patch("subprocess.Popen") as po: + b = browser.Browser() + with taddons.context() as tctx: + b.start() + assert po.called + b.start() + + assert not tctx.master.has_log("already running") + b.browser.poll = lambda: None + b.start() + assert tctx.master.has_log("already running") + b.done() + assert not b.browser |