diff options
| author | Barry Warsaw | 2016-07-16 15:44:07 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2016-07-16 15:44:07 -0400 |
| commit | dbde6231ec897379ed38ed4cd015b8ab20ed5fa1 (patch) | |
| tree | 1226d06a238314262a1d04d0bbf9c4dc0b72c309 /src/mailman/utilities/tests/test_templates.py | |
| parent | 3387791beb7112dbe07664041f117fdcc20df53d (diff) | |
| download | mailman-dbde6231ec897379ed38ed4cd015b8ab20ed5fa1.tar.gz mailman-dbde6231ec897379ed38ed4cd015b8ab20ed5fa1.tar.zst mailman-dbde6231ec897379ed38ed4cd015b8ab20ed5fa1.zip | |
Diffstat (limited to 'src/mailman/utilities/tests/test_templates.py')
| -rw-r--r-- | src/mailman/utilities/tests/test_templates.py | 64 |
1 files changed, 1 insertions, 63 deletions
diff --git a/src/mailman/utilities/tests/test_templates.py b/src/mailman/utilities/tests/test_templates.py index fcb0ecc1c..4e05f13c6 100644 --- a/src/mailman/utilities/tests/test_templates.py +++ b/src/mailman/utilities/tests/test_templates.py @@ -26,7 +26,7 @@ from mailman.app.lifecycle import create_list from mailman.config import config from mailman.interfaces.languages import ILanguageManager from mailman.testing.layers import ConfigLayer -from mailman.utilities.i18n import TemplateNotFoundError, find, make, search +from mailman.utilities.i18n import TemplateNotFoundError, find, search from pkg_resources import resource_filename from zope.component import getUtility @@ -219,65 +219,3 @@ class TestFind(unittest.TestCase): with self.assertRaises(TemplateNotFoundError) as cm: find('missing.txt', self.mlist) self.assertEqual(cm.exception.template_file, 'missing.txt') - - -class TestMake(unittest.TestCase): - """Test template interpolation.""" - - layer = ConfigLayer - - def setUp(self): - self.var_dir = tempfile.mkdtemp() - self.addCleanup(shutil.rmtree, self.var_dir) - config.push('template config', """\ - [paths.testing] - var_dir: {} - """.format(self.var_dir)) - self.addCleanup(config.pop, 'template config') - # The following MUST happen AFTER the push() above since pushing a new - # config also clears out the language manager. - getUtility(ILanguageManager).add('xx', 'utf-8', 'Xlandia') - self.mlist = create_list('test@example.com') - self.mlist.preferred_language = 'xx' - # Populate the template directories with a few fake templates. - path = os.path.join(self.var_dir, 'templates', 'site', 'xx') - os.makedirs(path) - with open(os.path.join(path, 'nosub.txt'), 'w') as fp: - print("""\ -This is a global template. -It has no substitutions. -It will be wrapped. -""", file=fp) - with open(os.path.join(path, 'subs.txt'), 'w') as fp: - print("""\ -This is a $kind template. -It has $howmany substitutions. -It will be wrapped. -""", file=fp) - with open(os.path.join(path, 'nowrap.txt'), 'w') as fp: - print("""\ -This is a $kind template. -It has $howmany substitutions. -It will not be wrapped. -""", file=fp) - - def test_no_substitutions(self): - self.assertEqual(make('nosub.txt', self.mlist), """\ -This is a global template. It has no substitutions. It will be -wrapped.""") - - def test_substitutions(self): - self.assertEqual(make('subs.txt', self.mlist, - kind='very nice', - howmany='a few'), """\ -This is a very nice template. It has a few substitutions. It will be -wrapped.""") - - def test_substitutions_no_wrap(self): - self.assertEqual(make('nowrap.txt', self.mlist, wrap=False, - kind='very nice', - howmany='a few'), """\ -This is a very nice template. -It has a few substitutions. -It will not be wrapped. -""") |
