MCPcopy
hub / github.com/mitmproxy/mitmproxy / test_dns

Function test_dns

test/mitmproxy/addons/test_dumper.py:224–243  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

222
223
224def test_dns():
225 sio = io.StringIO()
226 d = dumper.Dumper(sio)
227 with taddons.context(d) as ctx:
228 ctx.configure(d, flow_detail=3, showhost=True)
229
230 f = tflow.tdnsflow(resp=True)
231 d.dns_response(f)
232 assert "8.8.8.8" in sio.getvalue()
233 sio.truncate(0)
234
235 f = tflow.tdnsflow()
236 f.response = f.request.fail(response_codes.NOTIMP)
237 d.dns_response(f)
238 assert "NOTIMP" in sio.getvalue()
239 sio.truncate(0)
240
241 f = tflow.tdnsflow(err=True)
242 d.dns_error(f)
243 assert "error" in sio.getvalue()
244
245
246def test_websocket():

Callers

nothing calls this directly

Calls 6

dns_responseMethod · 0.95
dns_errorMethod · 0.95
contextMethod · 0.80
getvalueMethod · 0.80
failMethod · 0.80
configureMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…