(body: bytes)
| 166 | ], |
| 167 | ) |
| 168 | def test_inject_base_url(body: bytes) -> None: |
| 169 | url = "http://www.example.com" |
| 170 | |
| 171 | def check_base_url(burl): |
| 172 | path = urlparse(burl).path |
| 173 | if not path or not Path(path).exists(): |
| 174 | path = burl.replace("file://", "") |
| 175 | bbody = Path(path).read_bytes() |
| 176 | assert bbody.count(b'><base href="' + to_bytes(url) + b'">') == 1 |
| 177 | assert b"<head" in bbody |
| 178 | return True |
| 179 | |
| 180 | resp = HtmlResponse(url, body=body) |
| 181 | assert open_in_browser(resp, _openfunc=check_base_url) |
| 182 | |
| 183 | |
| 184 | def test_open_in_browser_redos_comment(): |
nothing calls this directly
no test coverage detected