diff options
Diffstat (limited to 'src/mailman/rules/tests/test_dmarc.py')
| -rw-r--r-- | src/mailman/rules/tests/test_dmarc.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/mailman/rules/tests/test_dmarc.py b/src/mailman/rules/tests/test_dmarc.py index 26eab5e56..d2ce28806 100644 --- a/src/mailman/rules/tests/test_dmarc.py +++ b/src/mailman/rules/tests/test_dmarc.py @@ -240,8 +240,7 @@ To: ant@example.com """) rule = dmarc.DMARCMitigation() - with get_dns_resolver( - rdata=b'v=DMARC1; sp=quarantine;'): + with get_dns_resolver(rdata=b'v=DMARC1; sp=quarantine;'): self.assertFalse(rule.check(mlist, msg, {})) def test_org_domain_with_subdomain_policy(self): @@ -254,8 +253,7 @@ To: ant@example.com """) rule = dmarc.DMARCMitigation() - with get_dns_resolver( - rdata=b'v=DMARC1; sp=quarantine;'): + with get_dns_resolver(rdata=b'v=DMARC1; sp=quarantine;'): self.assertTrue(rule.check(mlist, msg, {})) def test_wrong_dmarc_version(self): @@ -268,8 +266,7 @@ To: ant@example.com """) rule = dmarc.DMARCMitigation() - with get_dns_resolver( - rdata=b'v=DMARC01; p=reject;'): + with get_dns_resolver(rdata=b'v=DMARC01; p=reject;'): self.assertFalse(rule.check(mlist, msg, {})) def test_multiple_records(self): @@ -336,6 +333,18 @@ To: ant@example.com with get_dns_resolver(rdata=b'v=DMARC1; pct=100;'): self.assertFalse(rule.check(mlist, msg, {})) + def test_parser(self): + data_file = resource_filename( + 'mailman.rules.tests.data', 'org_domain.txt') + dmarc.parse_suffix_list(data_file) + # There is no entry for example.biz because that line starts with + # whitespace. + self.assertNotIn('biz.example', self.cache) + # The file had !city.kobe.jp so the flag says there's an exception. + self.assertTrue(self.cache['jp.kobe.city']) + # The file had *.kobe.jp so there's no exception. + self.assertFalse(self.cache['jp.kobe.*']) + # New in Python 3.5. try: |
