(caplog, monkeypatch)
| 36 | |
| 37 | |
| 38 | async def test_name_servers(caplog, monkeypatch): |
| 39 | dr = dns_resolver.DnsResolver() |
| 40 | with taddons.context(dr) as tctx: |
| 41 | assert dr.name_servers() == mitmproxy_rs.dns.get_system_dns_servers() |
| 42 | |
| 43 | tctx.options.dns_name_servers = ["1.1.1.1"] |
| 44 | assert dr.name_servers() == ["1.1.1.1"] |
| 45 | |
| 46 | monkeypatch.setattr(mitmproxy_rs.dns, "get_system_dns_servers", _err) |
| 47 | tctx.options.dns_name_servers = [] |
| 48 | assert dr.name_servers() == [] |
| 49 | assert "Failed to get system dns servers" in caplog.text |
| 50 | |
| 51 | |
| 52 | async def lookup(name: str): |
nothing calls this directly
no test coverage detected
searching dependent graphs…