mirror of
https://gitlab.nic.cz/knot/knot-dns.git
synced 2026-06-08 16:12:37 -04:00
tests-extra: add simple transfer response check
This commit is contained in:
parent
048e83a9e5
commit
5c9c501f2d
2 changed files with 22 additions and 0 deletions
|
|
@ -17,6 +17,7 @@ t.start()
|
|||
serial_init = knot.zone_wait(zone)
|
||||
|
||||
resp = knot.dig("example.com", "IXFR", serial=serial_init + 1)
|
||||
resp.check_xfr()
|
||||
|
||||
compare(resp.msg_count(), 1, "Only one message")
|
||||
compare(resp.count("SOA"), 1, "Only one RR in Answer section")
|
||||
|
|
|
|||
|
|
@ -139,6 +139,27 @@ class Response(object):
|
|||
self.check_record(section="answer", rtype=self.rtype, ttl=ttl,
|
||||
rdata=rdata, nordata=nordata)
|
||||
|
||||
def check_xfr(self, rcode="NOERROR"):
|
||||
'''Checks XFR message'''
|
||||
|
||||
self.resp, iter_copy = itertools.tee(self.resp)
|
||||
|
||||
# Get the first message.
|
||||
for msg in iter_copy:
|
||||
question = msg.question[0]
|
||||
compare(question.rdclass, self.rclass, "QCLASS")
|
||||
compare(question.rdtype, self.rtype, "QTYPE")
|
||||
|
||||
# Check rcode.
|
||||
if type(rcode) is not str:
|
||||
rc = dns.rcode.to_text(rcode)
|
||||
else:
|
||||
rc = rcode
|
||||
compare(dns.rcode.to_text(msg.rcode()), rc, "RCODE")
|
||||
|
||||
# Check the first message only.
|
||||
break
|
||||
|
||||
def check_edns(self, nsid=None, buff_size=None):
|
||||
compare(self.resp.edns, 0, "EDNS VERSION")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue