88# but WITHOUT ANY WARRANTY; without even the implied warranty of
99# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1010#
11- # $Id: test_mailgw.py,v 1.61 2003-11-11 00:35:14 richard Exp $
11+ # $Id: test_mailgw.py,v 1.62 2003-11-13 03:41:38 richard Exp $
1212
1313import unittest , tempfile , os , shutil , errno , imp , sys , difflib , rfc822
1414
@@ -99,13 +99,13 @@ def setUp(self):
9999
100100 # and open the database
101101 self .db = self .instance .open ('admin' )
102- self .
db .
user .
create (
username = 'Chef' , address = '[email protected] ',
103- realname = 'Bork, Chef' , roles = 'User' )
104- self .db .user .create (username = 'richard' , address = 'richard@test ' ,
105- roles = 'User' )
106- self .db .user .create (username = 'mary' , address = 'mary@test' ,
102+ self .chef_id = self . db .user .create (username = 'Chef' ,
103+ address = '[email protected] ' , realname = 'Bork, Chef' ,
roles = 'User' )
104+ self .richard_id = self . db .user .create (username = 'richard' ,
105+ address = 'richard@test' , roles = 'User' )
106+ self .mary_id = self . db .user .create (username = 'mary' , address = 'mary@test' ,
107107 roles = 'User' , realname = 'Contrary, Mary' )
108- self .db .user .create (username = 'john' , address = 'john@test' ,
108+ self .john_id = self . db .user .create (username = 'john' , address = 'john@test' ,
109109 alternate_addresses = 'jondoe@test\n john.doe@test' , roles = 'User' ,
110110 realname = 'John Doe' )
111111
@@ -157,7 +157,7 @@ def doNewIssue(self):
157157 assert not os .path .exists (SENDMAILDEBUG )
158158 l = self .db .issue .get (nodeid , 'nosy' )
159159 l .sort ()
160- self .assertEqual (l , ['3' , '4' ])
160+ self .assertEqual (l , [self . chef_id , self . richard_id ])
161161 return nodeid
162162
163163 def testNewIssue (self ):
@@ -178,7 +178,7 @@ def testNewIssueNosy(self):
178178 assert not os .path .exists (SENDMAILDEBUG )
179179 l = self .db .issue .get (nodeid , 'nosy' )
180180 l .sort ()
181- self .assertEqual (l , ['3' , '4' ])
181+ self .assertEqual (l , [self . chef_id , self . richard_id ])
182182
183183 def testAlternateAddress (self ):
184184 self ._send_mail ('''Content-Type: text/plain;
@@ -315,7 +315,8 @@ def testFollowup(self):
315315''' )
316316 l = self .db .issue .get ('1' , 'nosy' )
317317 l .sort ()
318- self .assertEqual (l , ['3' , '4' , '5' , '6' ])
318+ self .assertEqual (l , [self .chef_id , self .richard_id , self .mary_id ,
319+ self .john_id ])
319320
320321 self .compareMessages (self ._get_mail (),
321322@@ -620,7 +621,8 @@ def testFollowupEmptyMessage(self):
620621''' )
621622 l = self .db .issue .get ('1' , 'nosy' )
622623 l .sort ()
623- self .assertEqual (l , ['3' , '4' , '5' , '6' ])
624+ self .assertEqual (l , [self .chef_id , self .richard_id , self .mary_id ,
625+ self .john_id ])
624626
625627 # should be no file created (ie. no message)
626628 assert not os .path .exists (SENDMAILDEBUG )
@@ -639,7 +641,7 @@ def testNosyRemove(self):
639641''' )
640642 l = self .db .issue .get ('1' , 'nosy' )
641643 l .sort ()
642- self .assertEqual (l , ['3' ])
644+ self .assertEqual (l , [self . chef_id ])
643645
644646 # NO NOSY MESSAGE SHOULD BE SENT!
645647 assert not os .path .exists (SENDMAILDEBUG )
@@ -941,6 +943,24 @@ def testFollowupOnNonIssue(self):
941943
942944''' )
943945 self .assertEqual (self .db .keyword .get ('1' , 'name' ), 'Bar' )
946+
947+ def testResentFrom (self ):
948+ nodeid = self ._send_mail ('''Content-Type: text/plain;
949+ charset="iso-8859-1"
950+ 951+ Resent-From: mary <mary@test>
952+ 953+ Cc: richard@test
954+ Message-Id: <dummy_test_message_id>
955+ Subject: [issue] Testing...
956+
957+ This is a test submission of a new issue.
958+ ''' )
959+ assert not os .path .exists (SENDMAILDEBUG )
960+ l = self .db .issue .get (nodeid , 'nosy' )
961+ l .sort ()
962+ self .assertEqual (l , [self .richard_id , self .mary_id ])
963+ return nodeid
944964
945965def test_suite ():
946966 suite = unittest .TestSuite ()
0 commit comments