summaryrefslogtreecommitdiff
path: root/src/mailman/handlers/tests
diff options
context:
space:
mode:
authorAbhilash Raj2015-08-28 21:51:35 +0530
committerBarry Warsaw2015-08-30 10:35:26 -0400
commit4fbb1cfb1cc8e7d36205d2476913736716bc852c (patch)
treeeae218827f24fbf1d69430af7d2b82bb2bc57226 /src/mailman/handlers/tests
parente231537551ae7594a658a977995d3dc912d90933 (diff)
downloadmailman-4fbb1cfb1cc8e7d36205d2476913736716bc852c.tar.gz
mailman-4fbb1cfb1cc8e7d36205d2476913736716bc852c.tar.zst
mailman-4fbb1cfb1cc8e7d36205d2476913736716bc852c.zip
Diffstat (limited to 'src/mailman/handlers/tests')
-rw-r--r--src/mailman/handlers/tests/test_decorate.py26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/mailman/handlers/tests/test_decorate.py b/src/mailman/handlers/tests/test_decorate.py
index e6f9143d7..d92d00624 100644
--- a/src/mailman/handlers/tests/test_decorate.py
+++ b/src/mailman/handlers/tests/test_decorate.py
@@ -19,31 +19,32 @@
__all__ = [
'TestDecorate',
-]
+ ]
import os
import tempfile
import unittest
-from mock import patch
from mailman.app.lifecycle import create_list
-from mailman.archiving.prototype import Prototype
from mailman.config import config
from mailman.handlers import decorate
-from mailman.testing.helpers import configuration
+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"
- name = "testarchiver"
+ name = 'testarchiver'
is_enabled = False
@staticmethod
def permalink(mlist, msg):
- return "http://example.com/link_to_message"
+ return 'http://example.com/link_to_message'
class TestDecorate(unittest.TestCase):
@@ -66,14 +67,19 @@ This is a test message.
os.makedirs(site_dir)
config.push('templates', """
[paths.testing]
- template_dir: {0}
+ 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')
+ def cleanUp(self):
+ self.addCleanup(shutil.rmtree, template_dir)
- @patch('mailman.archiving.prototype.Prototype', TestArchiver)
- @configuration('archiver.prototype', enable='yes')
- def test_decorate_footer_with_arcihve_url(self):
+ def test_decorate_footer_with_archive_url(self):
with open(self.footer_path, 'w') as fp:
print("${testarchiver_url}", file=fp)
self._mlist.footer_uri = 'mailman:///myfooter.txt'