comparison test/test_mailgw.py @ 5098:99e289359798

issue2550803: Replying to NOSY mail goes to the tracker through reply-to, not original message author. Created new [tracker] replyto_address config.ini option to allow: 1) setting reply-to header to the tracker 2) setting reply-to header to the address of the author of the change 3) setting it to a fixed address (like noreply@some.place) Proposal by Peter Funk (pefu) in discussion with Tom Ekberg (tekberg). I chose to re-retrieve the email address for the author from the database rather than adding a new variable. Also managed to make a test case for each of the three settings.
author John Rouillard <rouilj@ieee.org>
date Sun, 26 Jun 2016 00:36:23 -0400
parents 786f0581bc90
children 37d1e24fb941
comparison
equal deleted inserted replaced
5097:156cbc1d182c 5098:99e289359798
1960 l.sort() 1960 l.sort()
1961 self.assertEqual(l, [self.chef_id]) 1961 self.assertEqual(l, [self.chef_id])
1962 1962
1963 # NO NOSY MESSAGE SHOULD BE SENT! 1963 # NO NOSY MESSAGE SHOULD BE SENT!
1964 assert not os.path.exists(SENDMAILDEBUG) 1964 assert not os.path.exists(SENDMAILDEBUG)
1965
1966 def testNosyReplytoTracker(self):
1967 self.db.config.TRACKER_REPLYTO_ADDRESS = ''
1968 self._handle_mail('''Content-Type: text/plain;
1969 charset="iso-8859-1"
1970 From: Chef <chef@bork.bork.bork>
1971 To: issue_tracker@your.tracker.email.domain.example
1972 Message-Id: <dummy_test_message_id>
1973 Subject: [issue] Testing... [nosy=mary; assignedto=richard]
1974
1975 This is a test submission of a new issue.
1976 ''')
1977 self.compareMessages(self._get_mail(),
1978 '''FROM: roundup-admin@your.tracker.email.domain.example
1979 TO: mary@test.test, richard@test.test
1980 Content-Type: text/plain; charset="utf-8"
1981 Subject: [issue1] Testing...
1982 To: mary@test.test, richard@test.test
1983 From: "Bork, Chef" <issue_tracker@your.tracker.email.domain.example>
1984 Reply-To: Roundup issue tracker
1985 <issue_tracker@your.tracker.email.domain.example>
1986 MIME-Version: 1.0
1987 Message-Id: <dummy_test_message_id>
1988 X-Roundup-Name: Roundup issue tracker
1989 X-Roundup-Loop: hello
1990 X-Roundup-Issue-Status: unread
1991 Content-Transfer-Encoding: quoted-printable
1992
1993
1994 New submission from Bork, Chef <chef@bork.bork.bork>:
1995
1996 This is a test submission of a new issue.
1997
1998 ----------
1999 assignedto: richard
2000 messages: 1
2001 nosy: Chef, mary, richard
2002 status: unread
2003 title: Testing...
2004 tx_Source: email
2005
2006 _______________________________________________________________________
2007 Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
2008 <http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>
2009 _______________________________________________________________________
2010 ''')
2011
2012 def testNosyReplytoSomeaddress(self):
2013 self.db.config.TRACKER_REPLYTO_ADDRESS = 'replyto@me.example.com'
2014 self._handle_mail('''Content-Type: text/plain;
2015 charset="iso-8859-1"
2016 From: Chef <chef@bork.bork.bork>
2017 To: issue_tracker@your.tracker.email.domain.example
2018 Message-Id: <dummy_test_message_id>
2019 Subject: [issue] Testing... [nosy=mary; assignedto=richard]
2020
2021 This is a test submission of a new issue.
2022 ''')
2023 self.compareMessages(self._get_mail(),
2024 '''FROM: roundup-admin@your.tracker.email.domain.example
2025 TO: mary@test.test, richard@test.test
2026 Content-Type: text/plain; charset="utf-8"
2027 Subject: [issue1] Testing...
2028 To: mary@test.test, richard@test.test
2029 From: "Bork, Chef" <issue_tracker@your.tracker.email.domain.example>
2030 Reply-To: replyto@me.example.com
2031 MIME-Version: 1.0
2032 Message-Id: <dummy_test_message_id>
2033 X-Roundup-Name: Roundup issue tracker
2034 X-Roundup-Loop: hello
2035 X-Roundup-Issue-Status: unread
2036 Content-Transfer-Encoding: quoted-printable
2037
2038
2039 New submission from Bork, Chef <chef@bork.bork.bork>:
2040
2041 This is a test submission of a new issue.
2042
2043 ----------
2044 assignedto: richard
2045 messages: 1
2046 nosy: Chef, mary, richard
2047 status: unread
2048 title: Testing...
2049 tx_Source: email
2050
2051 _______________________________________________________________________
2052 Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
2053 <http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>
2054 _______________________________________________________________________
2055 ''')
2056
2057 def testNosyReplytoAuthor(self):
2058 self.db.config.TRACKER_REPLYTO_ADDRESS = 'AUTHOR'
2059 self._handle_mail('''Content-Type: text/plain;
2060 charset="iso-8859-1"
2061 From: Chef <chef@bork.bork.bork>
2062 To: issue_tracker@your.tracker.email.domain.example
2063 Message-Id: <dummy_test_message_id>
2064 Subject: [issue] Testing... [nosy=mary; assignedto=richard]
2065
2066 This is a test submission of a new issue.
2067 ''')
2068 self.compareMessages(self._get_mail(),
2069 '''FROM: roundup-admin@your.tracker.email.domain.example
2070 TO: mary@test.test, richard@test.test
2071 Content-Type: text/plain; charset="utf-8"
2072 Subject: [issue1] Testing...
2073 To: mary@test.test, richard@test.test
2074 From: "Bork, Chef" <issue_tracker@your.tracker.email.domain.example>
2075 Reply-To: "Bork, Chef" <chef@bork.bork.bork>
2076 MIME-Version: 1.0
2077 Message-Id: <dummy_test_message_id>
2078 X-Roundup-Name: Roundup issue tracker
2079 X-Roundup-Loop: hello
2080 X-Roundup-Issue-Status: unread
2081 Content-Transfer-Encoding: quoted-printable
2082
2083
2084 New submission from Bork, Chef <chef@bork.bork.bork>:
2085
2086 This is a test submission of a new issue.
2087
2088 ----------
2089 assignedto: richard
2090 messages: 1
2091 nosy: Chef, mary, richard
2092 status: unread
2093 title: Testing...
2094 tx_Source: email
2095
2096 _______________________________________________________________________
2097 Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
2098 <http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>
2099 _______________________________________________________________________
2100 ''')
1965 2101
1966 def testNewUserAuthor(self): 2102 def testNewUserAuthor(self):
1967 self.db.commit() 2103 self.db.commit()
1968 l = self.db.user.list() 2104 l = self.db.user.list()
1969 l.sort() 2105 l.sort()

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