1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-11-22 02:17:26 +00:00

test_dns: handle case where a DNS record is missing (vs incorrect)

This commit is contained in:
Joshua Tauberer 2014-05-10 07:11:26 -04:00
parent d5971e383b
commit bdadf3017d

View File

@ -42,7 +42,11 @@ def test2(tests, server, description):
resolver.nameservers = [server] resolver.nameservers = [server]
for qname, rtype, expected_answer in tests: for qname, rtype, expected_answer in tests:
# do the query and format the result as a string # do the query and format the result as a string
try:
response = dns.resolver.query(qname, rtype) response = dns.resolver.query(qname, rtype)
except dns.resolver.NXDOMAIN:
# host did not have an answer for this query
response = ["NOT SET"]
response = ";".join(str(r) for r in response) response = ";".join(str(r) for r in response)
response = re.sub(r"(\"p=).*(\")", r"\1__KEY__\2", response) # normalize DKIM key response = re.sub(r"(\"p=).*(\")", r"\1__KEY__\2", response) # normalize DKIM key