@@ -290,8 +290,7 @@ def testOptionClass(self):
290290 self .assertEqual (self .db .issue .get (nodeid , 'status' ), '3' )
291291 self .assertEqual (self .db .issue .get (nodeid , 'priority' ), '1' )
292292
293- def doNewIssue (self ):
294- nodeid = self ._handle_mail ('''Content-Type: text/plain;
293+ newmsg = '''Content-Type: text/plain;
295294 charset="iso-8859-1"
296295297296@@ -300,7 +299,10 @@ def doNewIssue(self):
300299Subject: [issue] Testing...
301300
302301This is a test submission of a new issue.
303- ''' )
302+ '''
303+
304+ def doNewIssue (self ):
305+ nodeid = self ._handle_mail (self .newmsg )
304306 assert not os .path .exists (SENDMAILDEBUG )
305307 l = self .db .issue .get (nodeid , 'nosy' )
306308 l .sort ()
@@ -312,20 +314,25 @@ def testNewIssue(self):
312314
313315 def testNewIssueNosy (self ):
314316 self .instance .config .ADD_AUTHOR_TO_NOSY = 'yes'
315- nodeid = self ._handle_mail ('''Content-Type: text/plain;
316- charset="iso-8859-1"
317- 318- 319- 320- Message-Id: <dummy_test_message_id>
321- Subject: [issue] Testing...
317+ nodeid = self .doNewIssue ()
318+ m = self .db .issue .get (nodeid , 'messages' )
319+ self .assertEqual (len (m ), 1 )
320+ recv = self .db .msg .get (m [0 ], 'recipients' )
321+ self .assertEqual (recv , [self .richard_id ])
322322
323- This is a test submission of a new issue.
324- ''' )
323+ def testNewIssueNosyAuthor (self ):
324+ self .instance .config .ADD_AUTHOR_TO_NOSY = 'no'
325+ self .instance .config .MESSAGES_TO_AUTHOR = 'nosy'
326+ nodeid = self ._handle_mail (self .newmsg )
325327 assert not os .path .exists (SENDMAILDEBUG )
326328 l = self .db .issue .get (nodeid , 'nosy' )
327329 l .sort ()
328- self .assertEqual (l , [self .chef_id , self .richard_id ])
330+ self .assertEqual (l , [self .richard_id ])
331+ m = self .db .issue .get (nodeid , 'messages' )
332+ self .assertEqual (len (m ), 1 )
333+ recv = self .db .msg .get (m [0 ], 'recipients' )
334+ recv .sort ()
335+ self .assertEqual (recv , [self .richard_id ])
329336
330337 def testAlternateAddress (self ):
331338 self ._handle_mail ('''Content-Type: text/plain;
@@ -356,7 +363,6 @@ def testNewIssueNoClass(self):
356363 assert not os .path .exists (SENDMAILDEBUG )
357364
358365 def testNewIssueAuthMsg (self ):
359- # TODO: fix the damn config - this is apalling
360366 self .db .config .MESSAGES_TO_AUTHOR = 'yes'
361367 self ._handle_mail ('''Content-Type: text/plain;
362368 charset="iso-8859-1"
@@ -1453,11 +1459,7 @@ def testFollowupTitleMatchInterval(self):
14531459This is a followup
14541460''' ), nodeid )
14551461
1456-
1457- def testFollowupNosyAuthor (self ):
1458- self .doNewIssue ()
1459- self .db .config .ADD_AUTHOR_TO_NOSY = 'yes'
1460- self ._handle_mail ('''Content-Type: text/plain;
1462+ simple_followup = '''Content-Type: text/plain;
14611463 charset="iso-8859-1"
1462146414631465@@ -1466,8 +1468,12 @@ def testFollowupNosyAuthor(self):
14661468Subject: [issue1] Testing...
14671469
14681470This is a followup
1469- ''' )
1471+ '''
14701472
1473+ def testFollowupNosyAuthor (self ):
1474+ self .doNewIssue ()
1475+ self .db .config .ADD_AUTHOR_TO_NOSY = 'yes'
1476+ self ._handle_mail (self .simple_followup )
14711477 self .compareMessages (self ._get_mail (),
1472147814731479@@ -1505,7 +1511,7 @@ def testFollowupNosyRecipients(self):
15051511 self .doNewIssue ()
15061512 self .db .config .ADD_RECIPIENTS_TO_NOSY = 'yes'
15071513 self ._handle_mail ('''Content-Type: text/plain;
1508- charset="iso-8859-1"
1514+ charset="iso-8859-1"
150915151510151615111517@@ -1552,16 +1558,45 @@ def testFollowupNosyAuthorAndCopy(self):
15521558 self .doNewIssue ()
15531559 self .db .config .ADD_AUTHOR_TO_NOSY = 'yes'
15541560 self .db .config .MESSAGES_TO_AUTHOR = 'yes'
1555- self ._handle_mail ('''Content-Type: text/plain;
1556- charset="iso-8859-1"
1557- 1558- 1561+ self ._handle_mail (self .simple_followup )
1562+ self .compareMessages (self ._get_mail (),
1563+ 1564+ 1565+ Content-Type: text/plain; charset="utf-8"
1566+ Subject: [issue1] Testing...
1567+ 1568+ From: John Doe <[email protected] > 1569+ Reply-To: Roundup issue tracker
1570+ 1571+ MIME-Version: 1.0
15591572Message-Id: <followup_dummy_id>
15601573In-Reply-To: <dummy_test_message_id>
1561- Subject: [issue1] Testing...
1574+ X-Roundup-Name: Roundup issue tracker
1575+ X-Roundup-Loop: hello
1576+ X-Roundup-Issue-Status: chatting
1577+ Content-Transfer-Encoding: quoted-printable
1578+
1579+
1580+ John Doe <[email protected] > added the comment: 15621581
15631582This is a followup
1583+
1584+ ----------
1585+ nosy: +john
1586+ status: unread -> chatting
1587+
1588+ _______________________________________________________________________
1589+ Roundup issue tracker <[email protected] > 1590+ <http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>
1591+ _______________________________________________________________________
1592+
15641593''' )
1594+
1595+ def testFollowupNosyAuthorNosyCopy (self ):
1596+ self .doNewIssue ()
1597+ self .db .config .ADD_AUTHOR_TO_NOSY = 'yes'
1598+ self .db .config .MESSAGES_TO_AUTHOR = 'nosy'
1599+ self ._handle_mail (self .simple_followup )
15651600 self .compareMessages (self ._get_mail (),
1566160115671602@@ -1598,16 +1633,44 @@ def testFollowupNosyAuthorAndCopy(self):
15981633 def testFollowupNoNosyAuthor (self ):
15991634 self .doNewIssue ()
16001635 self .instance .config .ADD_AUTHOR_TO_NOSY = 'no'
1601- self ._handle_mail ('''Content-Type: text/plain;
1602- charset="iso-8859-1"
1603- 1604- 1636+ self ._handle_mail (self .simple_followup )
1637+ self .compareMessages (self ._get_mail (),
1638+ 1639+ 1640+ Content-Type: text/plain; charset="utf-8"
1641+ Subject: [issue1] Testing...
1642+ 1643+ From: John Doe <[email protected] > 1644+ Reply-To: Roundup issue tracker
1645+ 1646+ MIME-Version: 1.0
16051647Message-Id: <followup_dummy_id>
16061648In-Reply-To: <dummy_test_message_id>
1607- Subject: [issue1] Testing...
1649+ X-Roundup-Name: Roundup issue tracker
1650+ X-Roundup-Loop: hello
1651+ X-Roundup-Issue-Status: chatting
1652+ Content-Transfer-Encoding: quoted-printable
1653+
1654+
1655+ John Doe <[email protected] > added the comment: 16081656
16091657This is a followup
1658+
1659+ ----------
1660+ status: unread -> chatting
1661+
1662+ _______________________________________________________________________
1663+ Roundup issue tracker <[email protected] > 1664+ <http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>
1665+ _______________________________________________________________________
1666+
16101667''' )
1668+
1669+ def testFollowupNoNosyAuthorNoCopy (self ):
1670+ self .doNewIssue ()
1671+ self .instance .config .ADD_AUTHOR_TO_NOSY = 'no'
1672+ self .instance .config .MESSAGES_TO_AUTHOR = 'nosy'
1673+ self ._handle_mail (self .simple_followup )
16111674 self .compareMessages (self ._get_mail (),
1612167516131676@@ -1626,6 +1689,45 @@ def testFollowupNoNosyAuthor(self):
16261689Content-Transfer-Encoding: quoted-printable
16271690
16281691
1692+ John Doe <[email protected] > added the comment: 1693+
1694+ This is a followup
1695+
1696+ ----------
1697+ status: unread -> chatting
1698+
1699+ _______________________________________________________________________
1700+ Roundup issue tracker <[email protected] > 1701+ <http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>
1702+ _______________________________________________________________________
1703+
1704+ ''' )
1705+
1706+ # this is a pathological case where the author is *not* on the nosy
1707+ # list but gets the message; test documents existing behaviour
1708+ def testFollowupNoNosyAuthorButCopy (self ):
1709+ self .doNewIssue ()
1710+ self .instance .config .ADD_AUTHOR_TO_NOSY = 'no'
1711+ self .instance .config .MESSAGES_TO_AUTHOR = 'yes'
1712+ self ._handle_mail (self .simple_followup )
1713+ self .compareMessages (self ._get_mail (),
1714+ 1715+ 1716+ Content-Type: text/plain; charset="utf-8"
1717+ Subject: [issue1] Testing...
1718+ 1719+ From: John Doe <[email protected] > 1720+ Reply-To: Roundup issue tracker
1721+ 1722+ MIME-Version: 1.0
1723+ Message-Id: <followup_dummy_id>
1724+ In-Reply-To: <dummy_test_message_id>
1725+ X-Roundup-Name: Roundup issue tracker
1726+ X-Roundup-Loop: hello
1727+ X-Roundup-Issue-Status: chatting
1728+ Content-Transfer-Encoding: quoted-printable
1729+
1730+
16291731John Doe <[email protected] > added the comment: 16301732
16311733This is a followup
0 commit comments