From: Peter van Dijk Date: Tue, 7 Feb 2023 13:46:01 +0000 (+0100) Subject: ixfrdist tests: refactor one function a bit X-Git-Tag: auth-4.9.0-alpha1^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ada9a63171911d56f378552b4c3a74133ff948bf;p=thirdparty%2Fpdns.git ixfrdist tests: refactor one function a bit --- diff --git a/regression-tests.auth-py/test_ALIAS.py b/regression-tests.auth-py/test_ALIAS.py index 789b387473..a9ff3ae1bd 100644 --- a/regression-tests.auth-py/test_ALIAS.py +++ b/regression-tests.auth-py/test_ALIAS.py @@ -179,32 +179,33 @@ class AliasUDPResponder(DatagramProtocol): response.use_edns(edns=False) response.flags |= dns.flags.RA - if request.question[0].name == dns.name.from_text( - 'noerror.example.com.'): + question = request.question[0] + name = question.name + name_text = name.to_text() + + if name_text == 'noerror.example.com.': response.set_rcode(dns.rcode.NOERROR) - if request.question[0].rdtype in [dns.rdatatype.A, + if question.rdtype in [dns.rdatatype.A, dns.rdatatype.ANY]: response.answer.append( dns.rrset.from_text( - request.question[0].name, + name, 0, dns.rdataclass.IN, 'A', '192.0.2.1')) - if request.question[0].rdtype in [dns.rdatatype.AAAA, + if question.rdtype in [dns.rdatatype.AAAA, dns.rdatatype.ANY]: response.answer.append( - dns.rrset.from_text(request.question[0].name, + dns.rrset.from_text(name, 0, dns.rdataclass.IN, 'AAAA', '2001:DB8::1')) - if request.question[0].name == dns.name.from_text( - 'nxd.example.com.'): + if name_text == 'nxd.example.com.': response.set_rcode(dns.rcode.NXDOMAIN) response.authority.append( dns.rrset.from_text( 'example.com.', 0, dns.rdataclass.IN, 'SOA', 'ns1.example.com. hostmaster.example.com. 2018062101 1 2 3 4')) - if request.question[0].name == dns.name.from_text( - 'servfail.example.com.'): + if name_text == 'servfail.example.com.': response.set_rcode(dns.rcode.SERVFAIL) self.transport.write(response.to_wire(max_size=65535), address)