diff options
| author | Mark Sapiro | 2016-12-31 10:15:28 -0800 |
|---|---|---|
| committer | Mark Sapiro | 2016-12-31 10:15:28 -0800 |
| commit | 5954094c36d1a0227ea21165f30085db4f424afe (patch) | |
| tree | f4a95031aad62d02d50ed2d17eb661b37e8dceff | |
| parent | 192d76f1330041336a1f5793646df36a932210f0 (diff) | |
| download | mailman-5954094c36d1a0227ea21165f30085db4f424afe.tar.gz mailman-5954094c36d1a0227ea21165f30085db4f424afe.tar.zst mailman-5954094c36d1a0227ea21165f30085db4f424afe.zip | |
| -rw-r--r-- | src/mailman/rules/tests/test_dmarc.py | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/src/mailman/rules/tests/test_dmarc.py b/src/mailman/rules/tests/test_dmarc.py index 1ff1f0bec..a870130f4 100644 --- a/src/mailman/rules/tests/test_dmarc.py +++ b/src/mailman/rules/tests/test_dmarc.py @@ -102,21 +102,15 @@ def get_org_data(): """Create a mock to load the organizational domain data from our local test data. """ - class oururlopen: - def __init__(self): - pass - - def open(url): - datapath = os.path.join( - os.path.split(dmarc.__file__)[0], - 'data', - 'org_domain', - ) - org_data_url = 'file:///{}'.format(datapath) - # Ensure we load the data. - dmarc.s_dict.clear() - return urlopen(org_data_url) - return patch('mailman.rules.dmarc.request.urlopen', oururlopen.open) + def ouropen(url): + datapath = os.path.join( + os.path.split(dmarc.__file__)[0], + 'data', + 'org_domain', + ) + org_data_url = 'file:///{}'.format(datapath) + return urlopen(org_data_url) + return patch('mailman.rules.dmarc.request.urlopen', ouropen) class TestDMARCRules(TestCase): @@ -195,7 +189,7 @@ To: ant@example.com self.assertFalse(rule.check(mlist, msg, {})) line = mark.readline() self.assertEqual( - line[-117:], + line[-132:], 'DNSException: Unable to query DMARC policy for ' 'anne@example.info (_dmarc.example.info). ' - 'The DNS operation timed out.\n') + 'All nameservers failed to answer the query.\n') |
