diff options
| author | Abhilash Raj | 2016-10-21 23:54:56 -0700 |
|---|---|---|
| committer | Barry Warsaw | 2016-11-25 11:45:06 -0500 |
| commit | 1f4919ab99bc6ca15553e2e4f569313b91b4a752 (patch) | |
| tree | 522c47983c6fbdacc0f89963c7139f25fcd3fd85 | |
| parent | 5a02cc713f9897cd9ec0df48dd7718f019a6e510 (diff) | |
| download | mailman-1f4919ab99bc6ca15553e2e4f569313b91b4a752.tar.gz mailman-1f4919ab99bc6ca15553e2e4f569313b91b4a752.tar.zst mailman-1f4919ab99bc6ca15553e2e4f569313b91b4a752.zip | |
| -rw-r--r-- | src/mailman/rest/tests/data/__init__.py | 0 | ||||
| -rw-r--r-- | src/mailman/rest/tests/data/bad_email.eml (renamed from src/mailman/rest/tests/data/bad_email) | 0 | ||||
| -rw-r--r-- | src/mailman/rest/tests/test_moderation.py | 10 |
3 files changed, 6 insertions, 4 deletions
diff --git a/src/mailman/rest/tests/data/__init__.py b/src/mailman/rest/tests/data/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/mailman/rest/tests/data/__init__.py diff --git a/src/mailman/rest/tests/data/bad_email b/src/mailman/rest/tests/data/bad_email.eml index 83f9337dd..83f9337dd 100644 --- a/src/mailman/rest/tests/data/bad_email +++ b/src/mailman/rest/tests/data/bad_email.eml diff --git a/src/mailman/rest/tests/test_moderation.py b/src/mailman/rest/tests/test_moderation.py index 03d52dfc4..628b79e52 100644 --- a/src/mailman/rest/tests/test_moderation.py +++ b/src/mailman/rest/tests/test_moderation.py @@ -33,6 +33,7 @@ from mailman.testing.helpers import ( call_api, get_queue_messages, set_preferred, specialized_message_from_string as mfs) from mailman.testing.layers import RESTLayer +from pkg_resources import resource_filename from urllib.error import HTTPError from zope.component import getUtility @@ -210,10 +211,11 @@ class TestSubscriptionModeration(unittest.TestCase): def test_view_malformed_held_message(self): # Opening a bad (i.e. bad structure) email and holding it. - pwd = os.path.dirname(os.path.realpath(__file__)) - email_path = os.path.join(pwd, 'data/bad_email') - msg = message_from_binary_file(open(email_path, 'rb')) - msg.sender = 'bogussender@example.com' + email_path = resource_filename('mailman.rest.tests.data', + 'bad_email.eml') + with open(email_path, 'rb') as f: + msg = message_from_binary_file(f) + msg.sender = 'aperson@example.com' with transaction(): hold_message(self._mlist, msg) # Now trying to access held messages from REST API should not give |
