()
| 16 | |
| 17 | |
| 18 | def test_open_in_browser(): |
| 19 | url = "http:///www.example.com/some/page.html" |
| 20 | body = ( |
| 21 | b"<html> <head> <title>test page</title> </head> <body>test body</body> </html>" |
| 22 | ) |
| 23 | |
| 24 | def browser_open(burl: str) -> bool: |
| 25 | path = urlparse(burl).path |
| 26 | if not path or not Path(path).exists(): |
| 27 | path = burl.replace("file://", "") |
| 28 | bbody = Path(path).read_bytes() |
| 29 | assert b'<base href="' + to_bytes(url) + b'">' in bbody |
| 30 | return True |
| 31 | |
| 32 | response = HtmlResponse(url, body=body) |
| 33 | assert open_in_browser(response, _openfunc=browser_open), "Browser not called" |
| 34 | |
| 35 | resp = Response(url, body=body) |
| 36 | with pytest.raises(TypeError): |
| 37 | open_in_browser(resp, debug=True) # pylint: disable=unexpected-keyword-arg |
| 38 | |
| 39 | |
| 40 | def test_get_meta_refresh(): |
nothing calls this directly
no test coverage detected