view test/test_mailer.py @ 4468:502a1a8620e6

Tests and fixes. - Factor MailGW message parsing into a separate class, thanks to John Kristensen who did the major work in issue2550576 -- I wouldn't have attempted it without this. Fixes issue2550576. (Ralf) - Now if the -C option to roundup-mailgw specifies "issue" this refers to an issue-like class. The real class is determined from the configured default class, or the -c option to the mailgw, or the class resulting from mail subject parsing. We also accept multiple -S options for the same class now. (Ralf) - Add regression test for message-id generation if message id is missing in a message - Add regression tests for Option parsing (-S and -C options)
author Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
date Thu, 23 Dec 2010 15:42:30 +0000
parents 94ee533613ac
children 182d8c41a3aa
line wrap: on
line source

#-*- encoding: utf8 -*-
import unittest

from roundup import mailer

class EncodingTestCase(unittest.TestCase):
    def test(self):
        a = lambda n, a, c, o: self.assertEquals(mailer.nice_sender_header(n,
            a, c), o)
        a('ascii', 'ascii@test.com', 'latin1', 'ascii <ascii@test.com>')
        a(u'café', 'ascii@test.com', 'latin1',
            '=?latin1?q?caf=E9?= <ascii@test.com>')
        a('as"ii', 'ascii@test.com', 'latin1', '"as\\"ii" <ascii@test.com>')

def test_suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(EncodingTestCase))
    return suite

if __name__ == '__main__':
    runner = unittest.TextTestRunner()
    unittest.main(testRunner=runner)

# vim: set et sts=4 sw=4 :

Roundup Issue Tracker: http://roundup-tracker.org/