fixed mistake, updated test with real response possibility

This commit is contained in:
Spitap
2022-09-05 13:54:08 +02:00
parent 4a1f1dc5d3
commit 8ae289ad31
2 changed files with 2 additions and 2 deletions
@@ -81,7 +81,7 @@ class CheckMXRecords(BaseCommand):
result = socket.gethostbyname(pattern)
#result from dnsbl is in ipv4 format
splited_result = result.split(".")
if int(splited_result[-1]) <= 15:
if int(splited_result[-1]) > 15:
#Typical dnsbl result : 127.0.0.[1-15] (depends on services)
result = False
except socket.gaierror:
+1 -1
View File
@@ -217,7 +217,7 @@ class DNSBLTestCase(ModoTestCase):
"""Check notifications."""
mock_query.side_effect = utils.mock_dns_query_result
mock_getaddrinfo.side_effect = utils.mock_ip_query_result
mock_g_gethostbyname.return_value = "1.2.3.4"
mock_g_gethostbyname.return_value = "127.0.0.4"
management.call_command(
"modo", "check_mx", "--email", "user@example.test")
self.assertEqual(len(mail.outbox), 2)