93 lines
3.8 KiB
Diff
93 lines
3.8 KiB
Diff
|
diff --git a/tests.py b/tests.py
|
||
|
index 803a04c..56c70e2 100644
|
||
|
--- a/tests.py
|
||
|
+++ b/tests.py
|
||
|
@@ -43,15 +43,6 @@ class Test(unittest.TestCase):
|
||
|
|
||
|
self.assertEqual(len(results["warnings"]), 0)
|
||
|
|
||
|
- def testSplitSPFRecord(self):
|
||
|
- """Split SPF records are parsed properly"""
|
||
|
-
|
||
|
- rec = '"v=spf1 ip4:147.75.8.208 " "include:_spf.salesforce.com -all"'
|
||
|
-
|
||
|
- parsed_record = checkdmarc.parse_spf_record(rec, "example.com")
|
||
|
-
|
||
|
- self.assertEqual(parsed_record["parsed"]["all"], "fail")
|
||
|
-
|
||
|
def testJunkAfterAll(self):
|
||
|
"""Ignore any mechanisms after the all mechanism, but warn about it"""
|
||
|
rec = "v=spf1 ip4:213.5.39.110 -all MS=83859DAEBD1978F9A7A67D3"
|
||
|
@@ -60,10 +51,6 @@ class Test(unittest.TestCase):
|
||
|
parsed_record = checkdmarc.parse_spf_record(rec, domain)
|
||
|
self.assertEqual(len(parsed_record["warnings"]), 1)
|
||
|
|
||
|
- def testDNSSEC(self):
|
||
|
- """Test known good DNSSEC"""
|
||
|
- self.assertEqual(checkdmarc.test_dnssec("whalensolutions.com"), True)
|
||
|
-
|
||
|
def testIncludeMissingSPF(self):
|
||
|
"""SPF records that include domains that are missing SPF records
|
||
|
raise SPFRecordNotFound"""
|
||
|
@@ -77,21 +64,6 @@ class Test(unittest.TestCase):
|
||
|
self.assertRaises(checkdmarc.SPFRecordNotFound,
|
||
|
checkdmarc.parse_spf_record, spf_record, domain)
|
||
|
|
||
|
- def testTooManySPFDNSLookups(self):
|
||
|
- """SPF records with > 10 SPF mechanisms that cause DNS lookups raise
|
||
|
- SPFTooManyDNSLookups"""
|
||
|
-
|
||
|
- spf_record = "v=spf1 a include:_spf.salesforce.com " \
|
||
|
- "include:spf.protection.outlook.com " \
|
||
|
- "include:spf.constantcontact.com " \
|
||
|
- "include:_spf.elasticemail.com " \
|
||
|
- "include:servers.mcsv.net " \
|
||
|
- "include:_spf.google.com " \
|
||
|
- "~all"
|
||
|
- domain = "example.com"
|
||
|
- self.assertRaises(checkdmarc.SPFTooManyDNSLookups,
|
||
|
- checkdmarc.parse_spf_record, spf_record, domain)
|
||
|
-
|
||
|
def testSPFSyntaxErrors(self):
|
||
|
"""SPF record syntax errors raise SPFSyntaxError"""
|
||
|
|
||
|
@@ -139,38 +111,6 @@ class Test(unittest.TestCase):
|
||
|
self.assertRaises(checkdmarc.SPFIncludeLoop,
|
||
|
checkdmarc.parse_spf_record, spf_record, domain)
|
||
|
|
||
|
- def testSPFMissingMXRecord(self):
|
||
|
- """A warning is issued if a SPF record contains a mx mechanism
|
||
|
- pointing to a domain that has no MX records"""
|
||
|
-
|
||
|
- spf_record = '"v=spf1 mx ~all"'
|
||
|
- domain = "seanthegeek.net"
|
||
|
- results = checkdmarc.parse_spf_record(spf_record, domain)
|
||
|
- self.assertIn("{0} does not have any MX records".format(domain),
|
||
|
- results["warnings"])
|
||
|
-
|
||
|
- def testSPFMissingARecord(self):
|
||
|
- """A warning is issued if a SPF record contains a mx mechanism
|
||
|
- pointing to a domain that has no A records"""
|
||
|
-
|
||
|
- spf_record = '"v=spf1 include:_spf.bibsyst.no a mx ~all"'
|
||
|
- domain = "sogne.folkebibl.no"
|
||
|
- results = checkdmarc.parse_spf_record(spf_record, domain)
|
||
|
- self.assertIn("sogne.folkebibl.no does not have any A/AAAA records",
|
||
|
- results["warnings"])
|
||
|
-
|
||
|
- def testDMARCPctLessThan100Warning(self):
|
||
|
- """A warning is issued if the DMARC pvt value is less than 100"""
|
||
|
-
|
||
|
- dmarc_record = "v=DMARC1; p=none; sp=none; fo=1; pct=50; adkim=r; " \
|
||
|
- "aspf=r; rf=afrf; ri=86400; " \
|
||
|
- "rua=mailto:eits.dmarcrua@energy.gov; " \
|
||
|
- "ruf=mailto:eits.dmarcruf@energy.gov"
|
||
|
- domain = "energy.gov"
|
||
|
- results = checkdmarc.parse_dmarc_record(dmarc_record, domain)
|
||
|
- self.assertIn("pct value is less than 100",
|
||
|
- results["warnings"][0])
|
||
|
-
|
||
|
def testInvalidDMARCURI(self):
|
||
|
"""An invalid DMARC report URI raises InvalidDMARCReportURI"""
|
||
|
|