|
8 | 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 | 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 | 13 | import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib |
| 14 | +import rfc822 |
14 | 15 |
|
15 | 16 | # Note: Should parse emails according to RFC2822 instead of performing a |
16 | 17 | # literal string comparision. Parsing the messages allows the tests to work for |
|
20 | 21 | #except ImportError : |
21 | 22 | # import rfc822 as email |
22 | 23 |
|
23 | | -from roundup.mailgw import MailGW, Unauthorized |
| 24 | +from roundup.mailgw import MailGW, Unauthorized, uidFromAddress |
24 | 25 | from roundup import init, instance |
25 | 26 |
|
26 | 27 | # TODO: make this output only enough equal lines for context, not all of |
@@ -909,6 +910,14 @@ def innerTestQuoting(self, expect): |
909 | 910 |
|
910 | 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='[email protected]') |
| 915 | + self. assertEqual( uidFromAddress( self. db, ( '', '[email protected]'), 0), i) |
| 916 | + self. assertEqual( uidFromAddress( self. db, ( '', '[email protected]'), 0), i) |
| 917 | + i = self. db. user. create( username='user2', address='[email protected]') |
| 918 | + self. assertEqual( uidFromAddress( self. db, ( '', '[email protected]'), 0), i) |
| 919 | + self. assertEqual( uidFromAddress( self. db, ( '', '[email protected]'), 0), i) |
| 920 | + |
912 | 921 | def suite(): |
913 | 922 | l = [unittest.makeSuite(MailgwTestCase), |
914 | 923 | ] |
|
0 commit comments