mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-11-26 02:57:04 +00:00
test_dns: handle case where a DNS record is missing (vs incorrect)
This commit is contained in:
parent
d5971e383b
commit
bdadf3017d
@ -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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user