~abompard/mailman/moderation_reasons

« back to all changes in this revision

Viewing changes to src/mailman/app/tests/test_templates.py

  • Committer: Barry Warsaw
  • Date: 2014-04-14 18:00:23 UTC
  • mfrom: (7226.2.3 abompard)
  • Revision ID: barry@list.org-20140414180023-v26bi1l2xb9v08m2
 * Greatly improve the fidelity of the Mailman 2.1 list importer functionality
   (i.e. ``mailman import21``).  [Aurélien Bompard].

 * Fixed a typo in the IMailingList interface.

Show diffs side-by-side

added added

removed removed

Lines of Context:
126
126
        with self.assertRaises(urllib2.URLError) as cm:
127
127
            self._loader.get('mailman:///missing@example.com/en/foo/demo.txt')
128
128
        self.assertEqual(cm.exception.reason, 'No such file')
 
129
 
 
130
    def test_non_ascii(self):
 
131
        # mailman://demo.txt with non-ascii content.
 
132
        test_text = b'\xe4\xb8\xad'
 
133
        path = os.path.join(self.var_dir, 'templates', 'site', 'it')
 
134
        os.makedirs(path)
 
135
        with open(os.path.join(path, 'demo.txt'), 'w') as fp:
 
136
            print(test_text, end='', file=fp)
 
137
        content = self._loader.get('mailman:///it/demo.txt')
 
138
        self.assertTrue(isinstance(content, unicode))
 
139
        self.assertEqual(content, test_text.decode('utf-8'))