(tctx, transport_protocol)
| 248 | |
| 249 | @pytest.mark.parametrize("transport_protocol", ["tcp", "udp"]) |
| 250 | def test_reverse_fail_connection(tctx, transport_protocol): |
| 251 | tctx.client.transport_protocol = transport_protocol |
| 252 | tctx.server.transport_protocol = transport_protocol |
| 253 | |
| 254 | f = Placeholder(DNSFlow) |
| 255 | layer = dns.DNSLayer(tctx) |
| 256 | layer.context.server.address = ("8.8.8.8", 53) |
| 257 | |
| 258 | req = tdnsreq() |
| 259 | |
| 260 | assert ( |
| 261 | Playbook(layer) |
| 262 | >> DataReceived( |
| 263 | tctx.client, dns.pack_message(req, tctx.client.transport_protocol) |
| 264 | ) |
| 265 | << dns.DnsRequestHook(f) |
| 266 | >> reply() |
| 267 | << OpenConnection(tctx.server) |
| 268 | >> reply("UDP no likey today.") |
| 269 | << dns.DnsErrorHook(f) |
| 270 | >> reply() |
| 271 | << SendData( |
| 272 | tctx.client, |
| 273 | dns.pack_message( |
| 274 | req.fail(response_codes.SERVFAIL), tctx.client.transport_protocol |
| 275 | ), |
| 276 | ) |
| 277 | << None |
| 278 | ) |
| 279 | assert f().request |
| 280 | assert not f().response |
| 281 | assert f().error.msg == "UDP no likey today." |
| 282 | req.timestamp = f().request.timestamp |
| 283 | assert f().request == req |
| 284 | |
| 285 | |
| 286 | @pytest.mark.parametrize("transport_protocol", ["tcp", "udp"]) |
nothing calls this directly
no test coverage detected
searching dependent graphs…