aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2017-12-11 10:00:35 +0100
committerMaximilian Hils <git@maximilianhils.com>2017-12-11 10:46:55 +0100
commit7654ad2d31d294d227e9ed305309c927a2ec0b94 (patch)
treeab402b86540383eb534d1f933fee2c13f421d6d9 /test
parent472a74044024bad63099b113c07fc7190682115b (diff)
downloadmitmproxy-7654ad2d31d294d227e9ed305309c927a2ec0b94.tar.gz
mitmproxy-7654ad2d31d294d227e9ed305309c927a2ec0b94.tar.bz2
mitmproxy-7654ad2d31d294d227e9ed305309c927a2ec0b94.zip
fix browser addon on Windows
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/addons/test_browser.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/mitmproxy/addons/test_browser.py b/test/mitmproxy/addons/test_browser.py
index d1b32186..407a3fe6 100644
--- a/test/mitmproxy/addons/test_browser.py
+++ b/test/mitmproxy/addons/test_browser.py
@@ -5,7 +5,8 @@ from mitmproxy.test import taddons
def test_browser():
- with mock.patch("subprocess.Popen") as po:
+ with mock.patch("subprocess.Popen") as po, mock.patch("shutil.which") as which:
+ which.return_value = "chrome"
b = browser.Browser()
with taddons.context() as tctx:
b.start()
@@ -18,3 +19,13 @@ def test_browser():
assert tctx.master.has_log("already running")
b.done()
assert not b.browser
+
+
+def test_no_browser():
+ with mock.patch("shutil.which") as which:
+ which.return_value = False
+
+ b = browser.Browser()
+ with taddons.context() as tctx:
+ b.start()
+ assert tctx.master.has_log("platform is not supported")