Mercurial > p > roundup > code
comparison test/test_mailgw.py @ 1859:492a962b6d6f
Make signature matching more precise: only match '-- '...
(note the space) as a signature starter [SF#827775].
| author | Johannes Gijsbers <jlgijsbers@users.sourceforge.net> |
|---|---|
| date | Fri, 24 Oct 2003 14:59:38 +0000 |
| parents | 08a6f2549438 |
| children | cac778217c0c |
comparison
equal
deleted
inserted
replaced
| 1857:dc6f2155e5b4 | 1859:492a962b6d6f |
|---|---|
| 6 # | 6 # |
| 7 # This module is distributed in the hope that it will be useful, | 7 # This module is distributed in the hope that it will be useful, |
| 8 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 8 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 10 # | 10 # |
| 11 # $Id: test_mailgw.py,v 1.53 2003-09-15 19:37:28 jlgijsbers Exp $ | 11 # $Id: test_mailgw.py,v 1.54 2003-10-24 14:59:38 jlgijsbers Exp $ |
| 12 | 12 |
| 13 import unittest, tempfile, os, shutil, errno, imp, sys, difflib, rfc822 | 13 import unittest, tempfile, os, shutil, errno, imp, sys, difflib, rfc822 |
| 14 | 14 |
| 15 from cStringIO import StringIO | 15 from cStringIO import StringIO |
| 16 | 16 |
| 17 from roundup.mailgw import MailGW, Unauthorized, uidFromAddress | 17 from roundup.mailgw import MailGW, Unauthorized, uidFromAddress, parseContent |
| 18 from roundup import init, instance, rfc2822 | 18 from roundup import init, instance, rfc2822 |
| 19 | 19 |
| 20 NEEDS_INSTANCE = 1 | 20 NEEDS_INSTANCE = 1 |
| 21 | 21 |
| 22 class Message(rfc822.Message): | 22 class Message(rfc822.Message): |
| 991 handler = self.instance.MailGW(self.instance, self.db) | 991 handler = self.instance.MailGW(self.instance, self.db) |
| 992 handler.trapExceptions = 0 | 992 handler.trapExceptions = 0 |
| 993 handler.main(message) | 993 handler.main(message) |
| 994 | 994 |
| 995 self.db.user.lookup('johannes') | 995 self.db.user.lookup('johannes') |
| 996 | 996 |
| 997 | |
| 998 class ParseContentTestCase(unittest.TestCase): | |
| 999 def testSignatureRemoval(self): | |
| 1000 summary, content = parseContent('''Testing, testing. | |
| 1001 | |
| 1002 -- | |
| 1003 Signature''', 1, 0) | |
| 1004 self.assertEqual(content, 'Testing, testing.') | |
| 1005 | |
| 1006 def testKeepMultipleHyphens(self): | |
| 1007 body = '''Testing, testing. | |
| 1008 | |
| 1009 ---- | |
| 1010 Testing, testing.''' | |
| 1011 summary, content = parseContent(body, 1, 0) | |
| 1012 self.assertEqual(body, content) | |
| 1013 | |
| 997 def suite(): | 1014 def suite(): |
| 998 l = [unittest.makeSuite(MailgwTestCase), | 1015 l = [#unittest.makeSuite(MailgwTestCase), |
| 999 ] | 1016 unittest.makeSuite(ParseContentTestCase)] |
| 1000 return unittest.TestSuite(l) | 1017 return unittest.TestSuite(l) |
| 1001 | 1018 |
| 1002 | 1019 |
| 1003 # vim: set filetype=python ts=4 sw=4 et si | 1020 # vim: set filetype=python ts=4 sw=4 et si |
