diff options
| author | Mark Sapiro | 2016-12-30 23:17:47 -0800 |
|---|---|---|
| committer | Mark Sapiro | 2016-12-30 23:17:47 -0800 |
| commit | bb7da041fc63696c272ef296acb10a8cedb297a5 (patch) | |
| tree | 6131b02273eb432826c6a95b8486c188f333b3c2 /src/mailman/rules/docs | |
| parent | 876a267b856659931eb791c61a100bb89fb682ed (diff) | |
| download | mailman-bb7da041fc63696c272ef296acb10a8cedb297a5.tar.gz mailman-bb7da041fc63696c272ef296acb10a8cedb297a5.tar.zst mailman-bb7da041fc63696c272ef296acb10a8cedb297a5.zip | |
Added test data for organizational domains and a mock to use it.
Made a few test coverage tweaks.
Diffstat (limited to 'src/mailman/rules/docs')
| -rw-r--r-- | src/mailman/rules/docs/dmarc-mitigation.rst | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/mailman/rules/docs/dmarc-mitigation.rst b/src/mailman/rules/docs/dmarc-mitigation.rst index 7118a5be4..9a6fa5b9b 100644 --- a/src/mailman/rules/docs/dmarc-mitigation.rst +++ b/src/mailman/rules/docs/dmarc-mitigation.rst @@ -20,6 +20,12 @@ This returns p=reject for the example.biz domain and not for any others. >>> from mailman.rules.tests.test_dmarc import get_dns_resolver >>> patcher = get_dns_resolver() +And we do a similar thing to mock the organizational domain data. + + >>> from mailman.rules.tests.test_dmarc import get_org_data + >>> patcher2 = get_org_data() + + A message From: a domain without a DMARC policy does not set any flags. >>> from mailman.interfaces.mailinglist import DMARCMitigateAction @@ -31,7 +37,7 @@ A message From: a domain without a DMARC policy does not set any flags. ... ... """) >>> msgdata = {} - >>> with patcher as Resolver: + >>> with patcher as Resolver, patcher2 as urlopen: ... rule.check(mlist, msg, msgdata) False >>> msgdata == {} @@ -48,7 +54,7 @@ action is no_mitigation. ... ... """) >>> msgdata = {} - >>> with patcher as Resolver: + >>> with patcher as Resolver, patcher2 as urlopen: ... rule.check(mlist, msg, msgdata) False >>> msgdata == {} @@ -64,7 +70,7 @@ But with a different list setting, the message is flagged. ... ... """) >>> msgdata = {} - >>> with patcher as Resolver: + >>> with patcher as Resolver, patcher2 as urlopen: ... rule.check(mlist, msg, msgdata) False >>> msgdata['dmarc'] @@ -79,7 +85,7 @@ Subdomains which don't have a policy will check the organizational domain. ... ... """) >>> msgdata = {} - >>> with patcher as Resolver: + >>> with patcher as Resolver, patcher2 as urlopen: ... rule.check(mlist, msg, msgdata) False >>> msgdata['dmarc'] @@ -97,7 +103,7 @@ message. ... ... """) >>> msgdata = {} - >>> with patcher as Resolver: + >>> with patcher as Resolver, patcher2 as urlopen: ... rule.check(mlist, msg, msgdata) True >>> msgdata['dmarc'] @@ -116,7 +122,7 @@ We can reject the message with a default reason. ... ... """) >>> msgdata = {} - >>> with patcher as Resolver: + >>> with patcher as Resolver, patcher2 as urlopen: ... rule.check(mlist, msg, msgdata) True >>> msgdata['dmarc'] @@ -137,7 +143,7 @@ And, we can reject with a custom message. ... ... """) >>> msgdata = {} - >>> with patcher as Resolver: + >>> with patcher as Resolver, patcher2 as urlopen: ... rule.check(mlist, msg, msgdata) True >>> msgdata['dmarc'] |
