MCPcopy
hub / github.com/mitmproxy/mitmproxy / test_browser

Function test_browser

test/mitmproxy/addons/test_browser.py:7–27  ·  view source on GitHub ↗
(caplog)

Source from the content-addressed store, hash-verified

5
6
7def test_browser(caplog):
8 caplog.set_level("INFO")
9 with (
10 mock.patch("subprocess.Popen") as po,
11 mock.patch("shutil.which") as which,
12 taddons.context(),
13 ):
14 which.return_value = "chrome"
15 b = browser.Browser()
16 b.start()
17 assert po.called
18
19 b.start()
20 assert "Starting additional browser" in caplog.text
21 assert len(b.browser) == 2
22
23 b.start("unsupported-browser")
24 assert "Invalid browser name." in caplog.text
25 assert len(b.browser) == 2
26 b.done()
27 assert not b.browser
28
29
30async def test_no_browser(caplog):

Callers

nothing calls this directly

Calls 4

startMethod · 0.95
doneMethod · 0.95
set_levelMethod · 0.80
contextMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…