MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / test_dns

Function test_dns

test/mitmproxy/addons/test_save.py:68–95  ·  view source on GitHub ↗
(tmp_path)

Source from the content-addressed store, hash-verified

66
67
68def test_dns(tmp_path):
69 sa = save.Save()
70 with taddons.context(sa) as tctx:
71 p = str(tmp_path / "foo")
72 tctx.configure(sa, save_stream_file=p)
73
74 f = tflow.tdnsflow(resp=True)
75 sa.dns_request(f)
76 sa.dns_response(f)
77 tctx.configure(sa, save_stream_file=None)
78 assert rd(p)[0].response
79
80 tctx.configure(sa, save_stream_file="+" + p)
81 f = tflow.tdnsflow(err=True)
82 sa.dns_request(f)
83 sa.dns_error(f)
84 tctx.configure(sa, save_stream_file=None)
85 assert rd(p)[1].error
86
87 tctx.configure(sa, save_stream_file="+" + p)
88 f = tflow.tdnsflow()
89 sa.dns_request(f)
90 tctx.configure(sa, save_stream_file=None)
91 assert not rd(p)[2].response
92
93 f = tflow.tdnsflow()
94 sa.dns_response(f)
95 assert len(rd(p)) == 3
96
97
98def test_websocket(tmp_path):

Callers

nothing calls this directly

Calls 6

dns_requestMethod · 0.95
dns_responseMethod · 0.95
dns_errorMethod · 0.95
contextMethod · 0.80
rdFunction · 0.70
configureMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…