MCPcopy
hub / github.com/mitmproxy/mitmproxy / test_regular_hook_err

Function test_regular_hook_err

test/mitmproxy/proxy/layers/test_dns.py:179–206  ·  view source on GitHub ↗
(tctx)

Source from the content-addressed store, hash-verified

177
178
179def test_regular_hook_err(tctx):
180 f = Placeholder(DNSFlow)
181
182 req = tdnsreq()
183
184 def err(flow: DNSFlow):
185 flow.error = terr()
186
187 assert (
188 Playbook(dns.DNSLayer(tctx))
189 >> DataReceived(
190 tctx.client, dns.pack_message(req, tctx.client.transport_protocol)
191 )
192 << dns.DnsRequestHook(f)
193 >> reply(side_effect=err)
194 << dns.DnsErrorHook(f)
195 >> reply()
196 << SendData(
197 tctx.client,
198 dns.pack_message(
199 req.fail(response_codes.SERVFAIL), tctx.client.transport_protocol
200 ),
201 )
202 >> ConnectionClosed(tctx.client)
203 << None
204 )
205 assert f().error
206 assert not f().live
207
208
209@pytest.mark.parametrize("transport_protocol", ["tcp", "udp"])

Callers

nothing calls this directly

Calls 9

DataReceivedClass · 0.90
SendDataClass · 0.90
ConnectionClosedClass · 0.90
PlaceholderFunction · 0.85
tdnsreqFunction · 0.85
PlaybookClass · 0.85
replyClass · 0.85
failMethod · 0.80
fFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…