summaryrefslogtreecommitdiff
path: root/src/mailman/rules/tests/test_dmarc.py
diff options
context:
space:
mode:
authorMark Sapiro2017-01-01 22:18:09 -0800
committerMark Sapiro2017-01-01 22:18:09 -0800
commit9f2bba71bc52388b339e2e7167b86c8f88033e64 (patch)
treed1eab4ffdb8ce6765988abc3b88bb015e2fc18d2 /src/mailman/rules/tests/test_dmarc.py
parentf9cf79290eb7a22c4d52622dbef50367a086234d (diff)
parentc870e3cffce626ce85efa906e72a627e123edd6a (diff)
downloadmailman-9f2bba71bc52388b339e2e7167b86c8f88033e64.tar.gz
mailman-9f2bba71bc52388b339e2e7167b86c8f88033e64.tar.zst
mailman-9f2bba71bc52388b339e2e7167b86c8f88033e64.zip
Merge branch 'mr215-review' of gitlab.com:warsaw/mailman into dmarc
Diffstat (limited to '')
-rw-r--r--src/mailman/rules/tests/test_dmarc.py21
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: