Merge pull request #101 from p-l-/fix-tests

Fix DNS tests after Scapy 2.5.0 release
This commit is contained in:
_Frky 2022-12-30 16:02:19 +01:00 committed by GitHub
commit 047e15a579
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,11 +70,11 @@ def test_ipv4_udp_dns_in_a():
dns_req.qd[0] dns_req.qd[0]
), "query in request and response do not match" ), "query in request and response do not match"
assert raw(dns_rep.qd[0].qname) == raw( assert raw(dns_rep.qd[0].qname) == raw(
dns_req.qd[0].qname + b"." dns_req.qd[0].qname
), "if this test fails, it may mean that scapy fixed the bug in dns.py L134 - if that is so, remove \" + b'.'\" in the test" ), "qname query in request and response do not match"
assert ( assert (
dns_rep.an[0].rrname == dns_req.qd[0].qname + b"." dns_rep.an[0].rrname == dns_req.qd[0].qname
), "if this test fails, it may mean that scapy fixed the bug in dns.py L134 - if that is so, remove \" + b'.'\" in the test" ), "rrname in answer does not match qname in request"
assert ( assert (
dns_rep.an[0].rclass == dns_req.qd[0].qclass dns_rep.an[0].rclass == dns_req.qd[0].qclass
), "class in answer does not match query" ), "class in answer does not match query"
@ -132,17 +132,17 @@ def test_ipv4_udp_dns_in_a_multiple_queries():
for i, q in enumerate(qd): for i, q in enumerate(qd):
assert raw(dns_rep.qd[i]) == raw( assert raw(dns_rep.qd[i]) == raw(
dns_req.qd[i] dns_req.qd[i]
), "query in request and response do not match" ), f"query in request and response do not match ({i})"
assert raw(dns_rep.qd[i].qname) == raw( assert raw(dns_rep.qd[i].qname) == raw(
dns_req.qd[i].qname + b"." dns_req.qd[i].qname
), "if this test fails, it may mean that scapy fixed the bug in dns.py L134 - if that is so, remove \" + b'.'\" in the test" ), f"qname query in request and response do not match ({i})"
assert ( assert (
dns_rep.an[i].rrname == dns_req.qd[i].qname + b"." dns_rep.an[i].rrname == dns_req.qd[i].qname
), "if this test fails, it may mean that scapy fixed the bug in dns.py L134 - if that is so, remove \" + b'.'\" in the test" ), f"rrname in answer does not match qname in request ({i})"
assert ( assert (
dns_rep.an[i].rclass == dns_req.qd[i].qclass dns_rep.an[i].rclass == dns_req.qd[i].qclass
), "class in answer does not match query" ), f"class in answer does not match query ({i})"
assert ( assert (
dns_rep.an[i].type == dns_req.qd[i].qtype dns_rep.an[i].type == dns_req.qd[i].qtype
), "type in answer does not match query" ), f"type in answer does not match query ({i})"
assert dns_rep.an[i].rdata == IPV4_ADDR assert dns_rep.an[i].rdata == IPV4_ADDR