MCPcopy Create free account
hub / github.com/mitmproxy/mitmproxy / test_name_servers

Function test_name_servers

test/mitmproxy/addons/test_dns_resolver.py:38–49  ·  view source on GitHub ↗
(caplog, monkeypatch)

Source from the content-addressed store, hash-verified

36
37
38async 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
52async def lookup(name: str):

Callers

nothing calls this directly

Calls 2

name_serversMethod · 0.95
contextMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…