summaryrefslogtreecommitdiff
path: root/src/mailman/handlers/tests
diff options
context:
space:
mode:
authorBarry Warsaw2015-08-30 11:19:57 -0400
committerBarry Warsaw2015-08-30 11:19:57 -0400
commit54c6880facb90aa2591edf5c7735acb3f62831ac (patch)
treea729b4dc81ae0298cdb3e521cdf7fd0bb2e4f1fd /src/mailman/handlers/tests
parent53ab491e6688505a7c39b86826ef5ba319490601 (diff)
downloadmailman-54c6880facb90aa2591edf5c7735acb3f62831ac.tar.gz
mailman-54c6880facb90aa2591edf5c7735acb3f62831ac.tar.zst
mailman-54c6880facb90aa2591edf5c7735acb3f62831ac.zip
Cosmetic fixes for Abhilash's branch.
Diffstat (limited to 'src/mailman/handlers/tests')
-rw-r--r--src/mailman/handlers/tests/test_decorate.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/mailman/handlers/tests/test_decorate.py b/src/mailman/handlers/tests/test_decorate.py
index 03a4cdfb3..c8aba63db 100644
--- a/src/mailman/handlers/tests/test_decorate.py
+++ b/src/mailman/handlers/tests/test_decorate.py
@@ -21,6 +21,7 @@ __all__ = [
'TestDecorate',
]
+
import os
import shutil
import tempfile
@@ -32,13 +33,13 @@ from mailman.handlers import decorate
from mailman.interfaces.archiver import IArchiver
from mailman.testing.helpers import specialized_message_from_string as mfs
from mailman.testing.layers import ConfigLayer
-from unittest.mock import patch
from zope.interface import implementer
+
@implementer(IArchiver)
class TestArchiver:
- "A test archiver"
+ """A test archiver"""
name = 'testarchiver'
is_enabled = False
@@ -48,6 +49,7 @@ class TestArchiver:
return 'http://example.com/link_to_message'
+
class TestDecorate(unittest.TestCase):
"""Test the cook_headers handler."""
@@ -64,26 +66,24 @@ Content-Type: text/plain;
This is a test message.
""")
template_dir = tempfile.mkdtemp()
+ self.addCleanup(shutil.rmtree, template_dir)
site_dir = os.path.join(template_dir, 'site', 'en')
os.makedirs(site_dir)
- config.push('templates', """\
+ config.push('archiver', """\
[paths.testing]
template_dir: {}
- """.format(template_dir))
- config.push('archiver', """
[archiver.testarchiver]
class: mailman.handlers.tests.test_decorate.TestArchiver
enable: yes
- """)
- self.footer_path = os.path.join(site_dir, 'myfooter.txt')
- self.addCleanup(shutil.rmtree, template_dir)
+ """.format(template_dir))
self.addCleanup(config.pop, 'archiver')
+ self.footer_path = os.path.join(site_dir, 'myfooter.txt')
def test_decorate_footer_with_archive_url(self):
- with open(self.footer_path, 'w') as fp:
- print("${testarchiver_url}", file=fp)
+ with open(self.footer_path, 'w', encoding='utf-8') as fp:
+ print('${testarchiver_url}', file=fp)
self._mlist.footer_uri = 'mailman:///myfooter.txt'
self._mlist.preferred_language = 'en'
decorate.process(self._mlist, self._msg, {})
- self.assertIn("http://example.com/link_to_message",
+ self.assertIn('http://example.com/link_to_message',
self._msg.as_string())