Mercurial > p > roundup > code
comparison test/test_mailgw.py @ 1549:a53a7e197360
fixed rdbms email address lookup (case insensitivity)
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 24 Mar 2003 04:47:44 +0000 |
| parents | 9b93d140b8e6 |
| children | 54f7717ece32 |
comparison
equal
deleted
inserted
replaced
| 1548:c36df13925f9 | 1549:a53a7e197360 |
|---|---|
| 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.41 2003-03-13 09:27:24 kedder Exp $ | 11 # $Id: test_mailgw.py,v 1.42 2003-03-24 04:47:44 richard Exp $ |
| 12 | 12 |
| 13 import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib | 13 import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib |
| 14 import rfc822 | |
| 14 | 15 |
| 15 # Note: Should parse emails according to RFC2822 instead of performing a | 16 # Note: Should parse emails according to RFC2822 instead of performing a |
| 16 # literal string comparision. Parsing the messages allows the tests to work for | 17 # literal string comparision. Parsing the messages allows the tests to work for |
| 17 # any legal serialization of an email. | 18 # any legal serialization of an email. |
| 18 #try : | 19 #try : |
| 19 # import email | 20 # import email |
| 20 #except ImportError : | 21 #except ImportError : |
| 21 # import rfc822 as email | 22 # import rfc822 as email |
| 22 | 23 |
| 23 from roundup.mailgw import MailGW, Unauthorized | 24 from roundup.mailgw import MailGW, Unauthorized, uidFromAddress |
| 24 from roundup import init, instance | 25 from roundup import init, instance |
| 25 | 26 |
| 26 # TODO: make this output only enough equal lines for context, not all of | 27 # TODO: make this output only enough equal lines for context, not all of |
| 27 # them | 28 # them |
| 28 class DiffHelper: | 29 class DiffHelper: |
| 907 newmessages.remove(msg) | 908 newmessages.remove(msg) |
| 908 messageid = newmessages[0] | 909 messageid = newmessages[0] |
| 909 | 910 |
| 910 self.compareStrings(self.db.msg.get(messageid, 'content'), expect) | 911 self.compareStrings(self.db.msg.get(messageid, 'content'), expect) |
| 911 | 912 |
| 913 def testUserLookup(self): | |
| 914 i = self.db.user.create(username='user1', address='user1@foo.com') | |
| 915 self.assertEqual(uidFromAddress(self.db, ('', 'user1@foo.com'), 0), i) | |
| 916 self.assertEqual(uidFromAddress(self.db, ('', 'USER1@foo.com'), 0), i) | |
| 917 i = self.db.user.create(username='user2', address='USER2@foo.com') | |
| 918 self.assertEqual(uidFromAddress(self.db, ('', 'USER2@foo.com'), 0), i) | |
| 919 self.assertEqual(uidFromAddress(self.db, ('', 'user2@foo.com'), 0), i) | |
| 920 | |
| 912 def suite(): | 921 def suite(): |
| 913 l = [unittest.makeSuite(MailgwTestCase), | 922 l = [unittest.makeSuite(MailgwTestCase), |
| 914 ] | 923 ] |
| 915 return unittest.TestSuite(l) | 924 return unittest.TestSuite(l) |
| 916 | 925 |
