diff options
| author | Mark Sapiro | 2016-12-31 14:24:32 -0800 |
|---|---|---|
| committer | Mark Sapiro | 2016-12-31 14:24:32 -0800 |
| commit | c786a77c3b82932facd63fabe3144f9099f1ea51 (patch) | |
| tree | 34ef73883abefc575e3072658babe4e01b3a6c4f /src/mailman/rules/tests | |
| parent | 4fb6712f7519ff64d142a51779a40a1eb226cbe4 (diff) | |
| download | mailman-c786a77c3b82932facd63fabe3144f9099f1ea51.tar.gz mailman-c786a77c3b82932facd63fabe3144f9099f1ea51.tar.zst mailman-c786a77c3b82932facd63fabe3144f9099f1ea51.zip | |
Diffstat (limited to 'src/mailman/rules/tests')
| -rw-r--r-- | src/mailman/rules/tests/data/__init__.py | 0 | ||||
| -rw-r--r-- | src/mailman/rules/tests/data/org_domain.txt | 23 | ||||
| -rw-r--r-- | src/mailman/rules/tests/test_dmarc.py | 10 |
3 files changed, 26 insertions, 7 deletions
diff --git a/src/mailman/rules/tests/data/__init__.py b/src/mailman/rules/tests/data/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/mailman/rules/tests/data/__init__.py diff --git a/src/mailman/rules/tests/data/org_domain.txt b/src/mailman/rules/tests/data/org_domain.txt new file mode 100644 index 000000000..4e6f7816e --- /dev/null +++ b/src/mailman/rules/tests/data/org_domain.txt @@ -0,0 +1,23 @@ +// Test data for dmarc organizational domains. + +// There are just a few domain entries here for testing purposes. + +// biz : https://en.wikipedia.org/wiki/.biz +biz + +// com : https://en.wikipedia.org/wiki/.com +com + +// org : https://en.wikipedia.org/wiki/.org +org + +// jp geographic type names +// http://jprs.jp/doc/rule/saisoku-1.html +*.kobe.jp +!city.kobe.jp + +// A line with a trailing comment for testing +co.uk some nonesence + +// A line with leading white space (ignored) + example.biz diff --git a/src/mailman/rules/tests/test_dmarc.py b/src/mailman/rules/tests/test_dmarc.py index e24fa29d0..9af3e9347 100644 --- a/src/mailman/rules/tests/test_dmarc.py +++ b/src/mailman/rules/tests/test_dmarc.py @@ -18,8 +18,6 @@ """Provides support for mocking dnspython calls from dmarc rules and some organizational domain tests.""" -import os - from contextlib import ExitStack from dns.exception import DNSException from dns.rdatatype import TXT @@ -30,6 +28,7 @@ from mailman.rules import dmarc from mailman.testing.helpers import ( LogFileMark, specialized_message_from_string as mfs) from mailman.testing.layers import ConfigLayer +from pkg_resources import resource_filename from public import public from unittest import TestCase from unittest.mock import patch @@ -103,11 +102,8 @@ def get_org_data(): test data. """ def ouropen(url): - datapath = os.path.join( - os.path.split(dmarc.__file__)[0], - 'data', - 'org_domain', - ) + datapath = resource_filename( + 'mailman.rules.tests.data', 'org_domain.txt') org_data_url = 'file:///{}'.format(datapath) return urlopen(org_data_url) return patch('mailman.rules.dmarc.request.urlopen', ouropen) |
