comparison test/test_mailgw.py @ 4547:d9d7319afffa

Add config-option "nosy" to messages_to_author setting in [nosy] section... ...of config: This will send a message to the author only in the case where the author is on the nosy-list (either added earlier or via the add_author setting). Current config-options for this setting will send / not send to author without considering the nosy list. [[Posted on behalf of Dr. Schlatterbeck during the git conversion.]] committer: Eric S. Raymond <esr@thyrsus.com>
author Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
date Wed, 19 Oct 2011 11:32:20 -0400
parents 46239c21a1eb
children 6e3e4f24c753
comparison
equal deleted inserted replaced
4546:d39c37fd2940 4547:d9d7319afffa
288 ''', (('-c', 'issue'),)) 288 ''', (('-c', 'issue'),))
289 self.assertEqual(self.db.issue.get(nodeid, 'title'), 'Testing...') 289 self.assertEqual(self.db.issue.get(nodeid, 'title'), 'Testing...')
290 self.assertEqual(self.db.issue.get(nodeid, 'status'), '3') 290 self.assertEqual(self.db.issue.get(nodeid, 'status'), '3')
291 self.assertEqual(self.db.issue.get(nodeid, 'priority'), '1') 291 self.assertEqual(self.db.issue.get(nodeid, 'priority'), '1')
292 292
293 newmsg = '''Content-Type: text/plain;
294 charset="iso-8859-1"
295 From: Chef <chef@bork.bork.bork>
296 To: issue_tracker@your.tracker.email.domain.example
297 Cc: richard@test.test
298 Message-Id: <dummy_test_message_id>
299 Subject: [issue] Testing...
300
301 This is a test submission of a new issue.
302 '''
303
293 def doNewIssue(self): 304 def doNewIssue(self):
294 nodeid = self._handle_mail('''Content-Type: text/plain; 305 nodeid = self._handle_mail(self.newmsg)
295 charset="iso-8859-1"
296 From: Chef <chef@bork.bork.bork>
297 To: issue_tracker@your.tracker.email.domain.example
298 Cc: richard@test.test
299 Message-Id: <dummy_test_message_id>
300 Subject: [issue] Testing...
301
302 This is a test submission of a new issue.
303 ''')
304 assert not os.path.exists(SENDMAILDEBUG) 306 assert not os.path.exists(SENDMAILDEBUG)
305 l = self.db.issue.get(nodeid, 'nosy') 307 l = self.db.issue.get(nodeid, 'nosy')
306 l.sort() 308 l.sort()
307 self.assertEqual(l, [self.chef_id, self.richard_id]) 309 self.assertEqual(l, [self.chef_id, self.richard_id])
308 return nodeid 310 return nodeid
310 def testNewIssue(self): 312 def testNewIssue(self):
311 self.doNewIssue() 313 self.doNewIssue()
312 314
313 def testNewIssueNosy(self): 315 def testNewIssueNosy(self):
314 self.instance.config.ADD_AUTHOR_TO_NOSY = 'yes' 316 self.instance.config.ADD_AUTHOR_TO_NOSY = 'yes'
315 nodeid = self._handle_mail('''Content-Type: text/plain; 317 nodeid = self.doNewIssue()
316 charset="iso-8859-1" 318 m = self.db.issue.get(nodeid, 'messages')
317 From: Chef <chef@bork.bork.bork> 319 self.assertEqual(len(m), 1)
318 To: issue_tracker@your.tracker.email.domain.example 320 recv = self.db.msg.get(m[0], 'recipients')
319 Cc: richard@test.test 321 self.assertEqual(recv, [self.richard_id])
320 Message-Id: <dummy_test_message_id> 322
321 Subject: [issue] Testing... 323 def testNewIssueNosyAuthor(self):
322 324 self.instance.config.ADD_AUTHOR_TO_NOSY = 'no'
323 This is a test submission of a new issue. 325 self.instance.config.MESSAGES_TO_AUTHOR = 'nosy'
324 ''') 326 nodeid = self._handle_mail(self.newmsg)
325 assert not os.path.exists(SENDMAILDEBUG) 327 assert not os.path.exists(SENDMAILDEBUG)
326 l = self.db.issue.get(nodeid, 'nosy') 328 l = self.db.issue.get(nodeid, 'nosy')
327 l.sort() 329 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])
329 336
330 def testAlternateAddress(self): 337 def testAlternateAddress(self):
331 self._handle_mail('''Content-Type: text/plain; 338 self._handle_mail('''Content-Type: text/plain;
332 charset="iso-8859-1" 339 charset="iso-8859-1"
333 From: John Doe <john.doe@test.test> 340 From: John Doe <john.doe@test.test>
354 This is a test submission of a new issue. 361 This is a test submission of a new issue.
355 ''') 362 ''')
356 assert not os.path.exists(SENDMAILDEBUG) 363 assert not os.path.exists(SENDMAILDEBUG)
357 364
358 def testNewIssueAuthMsg(self): 365 def testNewIssueAuthMsg(self):
359 # TODO: fix the damn config - this is apalling
360 self.db.config.MESSAGES_TO_AUTHOR = 'yes' 366 self.db.config.MESSAGES_TO_AUTHOR = 'yes'
361 self._handle_mail('''Content-Type: text/plain; 367 self._handle_mail('''Content-Type: text/plain;
362 charset="iso-8859-1" 368 charset="iso-8859-1"
363 From: Chef <chef@bork.bork.bork> 369 From: Chef <chef@bork.bork.bork>
364 To: issue_tracker@your.tracker.email.domain.example 370 To: issue_tracker@your.tracker.email.domain.example
1451 Subject: Re: Testing... 1457 Subject: Re: Testing...
1452 1458
1453 This is a followup 1459 This is a followup
1454 '''), nodeid) 1460 '''), nodeid)
1455 1461
1462 simple_followup = '''Content-Type: text/plain;
1463 charset="iso-8859-1"
1464 From: john@test.test
1465 To: issue_tracker@your.tracker.email.domain.example
1466 Message-Id: <followup_dummy_id>
1467 In-Reply-To: <dummy_test_message_id>
1468 Subject: [issue1] Testing...
1469
1470 This is a followup
1471 '''
1456 1472
1457 def testFollowupNosyAuthor(self): 1473 def testFollowupNosyAuthor(self):
1458 self.doNewIssue() 1474 self.doNewIssue()
1459 self.db.config.ADD_AUTHOR_TO_NOSY = 'yes' 1475 self.db.config.ADD_AUTHOR_TO_NOSY = 'yes'
1460 self._handle_mail('''Content-Type: text/plain; 1476 self._handle_mail(self.simple_followup)
1461 charset="iso-8859-1"
1462 From: john@test.test
1463 To: issue_tracker@your.tracker.email.domain.example
1464 Message-Id: <followup_dummy_id>
1465 In-Reply-To: <dummy_test_message_id>
1466 Subject: [issue1] Testing...
1467
1468 This is a followup
1469 ''')
1470
1471 self.compareMessages(self._get_mail(), 1477 self.compareMessages(self._get_mail(),
1472 '''FROM: roundup-admin@your.tracker.email.domain.example 1478 '''FROM: roundup-admin@your.tracker.email.domain.example
1473 TO: chef@bork.bork.bork, richard@test.test 1479 TO: chef@bork.bork.bork, richard@test.test
1474 Content-Type: text/plain; charset="utf-8" 1480 Content-Type: text/plain; charset="utf-8"
1475 Subject: [issue1] Testing... 1481 Subject: [issue1] Testing...
1503 1509
1504 def testFollowupNosyRecipients(self): 1510 def testFollowupNosyRecipients(self):
1505 self.doNewIssue() 1511 self.doNewIssue()
1506 self.db.config.ADD_RECIPIENTS_TO_NOSY = 'yes' 1512 self.db.config.ADD_RECIPIENTS_TO_NOSY = 'yes'
1507 self._handle_mail('''Content-Type: text/plain; 1513 self._handle_mail('''Content-Type: text/plain;
1508 charset="iso-8859-1" 1514 charset="iso-8859-1"
1509 From: richard@test.test 1515 From: richard@test.test
1510 To: issue_tracker@your.tracker.email.domain.example 1516 To: issue_tracker@your.tracker.email.domain.example
1511 Cc: john@test.test 1517 Cc: john@test.test
1512 Message-Id: <followup_dummy_id> 1518 Message-Id: <followup_dummy_id>
1513 In-Reply-To: <dummy_test_message_id> 1519 In-Reply-To: <dummy_test_message_id>
1550 1556
1551 def testFollowupNosyAuthorAndCopy(self): 1557 def testFollowupNosyAuthorAndCopy(self):
1552 self.doNewIssue() 1558 self.doNewIssue()
1553 self.db.config.ADD_AUTHOR_TO_NOSY = 'yes' 1559 self.db.config.ADD_AUTHOR_TO_NOSY = 'yes'
1554 self.db.config.MESSAGES_TO_AUTHOR = 'yes' 1560 self.db.config.MESSAGES_TO_AUTHOR = 'yes'
1555 self._handle_mail('''Content-Type: text/plain; 1561 self._handle_mail(self.simple_followup)
1556 charset="iso-8859-1"
1557 From: john@test.test
1558 To: issue_tracker@your.tracker.email.domain.example
1559 Message-Id: <followup_dummy_id>
1560 In-Reply-To: <dummy_test_message_id>
1561 Subject: [issue1] Testing...
1562
1563 This is a followup
1564 ''')
1565 self.compareMessages(self._get_mail(), 1562 self.compareMessages(self._get_mail(),
1566 '''FROM: roundup-admin@your.tracker.email.domain.example 1563 '''FROM: roundup-admin@your.tracker.email.domain.example
1567 TO: chef@bork.bork.bork, john@test.test, richard@test.test 1564 TO: chef@bork.bork.bork, john@test.test, richard@test.test
1568 Content-Type: text/plain; charset="utf-8" 1565 Content-Type: text/plain; charset="utf-8"
1569 Subject: [issue1] Testing... 1566 Subject: [issue1] Testing...
1593 <http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1> 1590 <http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>
1594 _______________________________________________________________________ 1591 _______________________________________________________________________
1595 1592
1596 ''') 1593 ''')
1597 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)
1600 self.compareMessages(self._get_mail(),
1601 '''FROM: roundup-admin@your.tracker.email.domain.example
1602 TO: chef@bork.bork.bork, john@test.test, richard@test.test
1603 Content-Type: text/plain; charset="utf-8"
1604 Subject: [issue1] Testing...
1605 To: chef@bork.bork.bork, john@test.test, richard@test.test
1606 From: John Doe <issue_tracker@your.tracker.email.domain.example>
1607 Reply-To: Roundup issue tracker
1608 <issue_tracker@your.tracker.email.domain.example>
1609 MIME-Version: 1.0
1610 Message-Id: <followup_dummy_id>
1611 In-Reply-To: <dummy_test_message_id>
1612 X-Roundup-Name: Roundup issue tracker
1613 X-Roundup-Loop: hello
1614 X-Roundup-Issue-Status: chatting
1615 Content-Transfer-Encoding: quoted-printable
1616
1617
1618 John Doe <john@test.test> added the comment:
1619
1620 This is a followup
1621
1622 ----------
1623 nosy: +john
1624 status: unread -> chatting
1625
1626 _______________________________________________________________________
1627 Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
1628 <http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>
1629 _______________________________________________________________________
1630
1631 ''')
1632
1598 def testFollowupNoNosyAuthor(self): 1633 def testFollowupNoNosyAuthor(self):
1599 self.doNewIssue() 1634 self.doNewIssue()
1600 self.instance.config.ADD_AUTHOR_TO_NOSY = 'no' 1635 self.instance.config.ADD_AUTHOR_TO_NOSY = 'no'
1601 self._handle_mail('''Content-Type: text/plain; 1636 self._handle_mail(self.simple_followup)
1602 charset="iso-8859-1"
1603 From: john@test.test
1604 To: issue_tracker@your.tracker.email.domain.example
1605 Message-Id: <followup_dummy_id>
1606 In-Reply-To: <dummy_test_message_id>
1607 Subject: [issue1] Testing...
1608
1609 This is a followup
1610 ''')
1611 self.compareMessages(self._get_mail(), 1637 self.compareMessages(self._get_mail(),
1612 '''FROM: roundup-admin@your.tracker.email.domain.example 1638 '''FROM: roundup-admin@your.tracker.email.domain.example
1613 TO: chef@bork.bork.bork, richard@test.test 1639 TO: chef@bork.bork.bork, richard@test.test
1614 Content-Type: text/plain; charset="utf-8" 1640 Content-Type: text/plain; charset="utf-8"
1615 Subject: [issue1] Testing... 1641 Subject: [issue1] Testing...
1616 To: chef@bork.bork.bork, richard@test.test 1642 To: chef@bork.bork.bork, richard@test.test
1643 From: John Doe <issue_tracker@your.tracker.email.domain.example>
1644 Reply-To: Roundup issue tracker
1645 <issue_tracker@your.tracker.email.domain.example>
1646 MIME-Version: 1.0
1647 Message-Id: <followup_dummy_id>
1648 In-Reply-To: <dummy_test_message_id>
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 <john@test.test> added the comment:
1656
1657 This is a followup
1658
1659 ----------
1660 status: unread -> chatting
1661
1662 _______________________________________________________________________
1663 Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
1664 <http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>
1665 _______________________________________________________________________
1666
1667 ''')
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)
1674 self.compareMessages(self._get_mail(),
1675 '''FROM: roundup-admin@your.tracker.email.domain.example
1676 TO: chef@bork.bork.bork, richard@test.test
1677 Content-Type: text/plain; charset="utf-8"
1678 Subject: [issue1] Testing...
1679 To: chef@bork.bork.bork, richard@test.test
1680 From: John Doe <issue_tracker@your.tracker.email.domain.example>
1681 Reply-To: Roundup issue tracker
1682 <issue_tracker@your.tracker.email.domain.example>
1683 MIME-Version: 1.0
1684 Message-Id: <followup_dummy_id>
1685 In-Reply-To: <dummy_test_message_id>
1686 X-Roundup-Name: Roundup issue tracker
1687 X-Roundup-Loop: hello
1688 X-Roundup-Issue-Status: chatting
1689 Content-Transfer-Encoding: quoted-printable
1690
1691
1692 John Doe <john@test.test> added the comment:
1693
1694 This is a followup
1695
1696 ----------
1697 status: unread -> chatting
1698
1699 _______________________________________________________________________
1700 Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
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 '''FROM: roundup-admin@your.tracker.email.domain.example
1715 TO: chef@bork.bork.bork, john@test.test, richard@test.test
1716 Content-Type: text/plain; charset="utf-8"
1717 Subject: [issue1] Testing...
1718 To: chef@bork.bork.bork, john@test.test, richard@test.test
1617 From: John Doe <issue_tracker@your.tracker.email.domain.example> 1719 From: John Doe <issue_tracker@your.tracker.email.domain.example>
1618 Reply-To: Roundup issue tracker 1720 Reply-To: Roundup issue tracker
1619 <issue_tracker@your.tracker.email.domain.example> 1721 <issue_tracker@your.tracker.email.domain.example>
1620 MIME-Version: 1.0 1722 MIME-Version: 1.0
1621 Message-Id: <followup_dummy_id> 1723 Message-Id: <followup_dummy_id>

Roundup Issue Tracker: http://roundup-tracker.org/