Mercurial > p > roundup > code
comparison test/test_mailgw.py @ 6941:bd2c3b2010c3
issue2551232 - modify in-reply-to threading when multiple matches
if an email is missing an issue designator, in-reply-to threading is
attempted. In this change if in-reply-to threading matches multiple
issues, fall back to matching on subject. It used to just arbitrairly
choose the first matching issue.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Thu, 08 Sep 2022 18:49:46 -0400 |
| parents | 68f7acd67298 |
| children | 3359dc1dabb0 |
comparison
equal
deleted
inserted
replaced
| 6940:3d2ec36541b9 | 6941:bd2c3b2010c3 |
|---|---|
| 4202 ''') | 4202 ''') |
| 4203 | 4203 |
| 4204 self.assertEqual(nodeid, nodeid2) | 4204 self.assertEqual(nodeid, nodeid2) |
| 4205 self.assertEqual(nodeid, nodeid3) | 4205 self.assertEqual(nodeid, nodeid3) |
| 4206 | 4206 |
| 4207 | |
| 4208 def testReplytoMultiMatch(self): | |
| 4209 """ If an in reply-to header matches more than 1 issue: | |
| 4210 Try a subject match, if that fails create a new issue. | |
| 4211 """ | |
| 4212 | |
| 4213 # create two issues with the same initial message/messgage-id. | |
| 4214 nodeid1 = self.doNewIssue() | |
| 4215 nodeid2 = self.doNewIssue() | |
| 4216 | |
| 4217 # set unique title/subject for second issue. | |
| 4218 self.db.issue.set("2", title="Testing1...") | |
| 4219 | |
| 4220 # Send an email that will match both issue1 and issue2 by | |
| 4221 # in-reply-to. As a result we fall back to Subject match, but | |
| 4222 # the Subject doesn't match issue1 or 2. So it creates a new | |
| 4223 # issue. | |
| 4224 nodeid3 = self._handle_mail('''Content-Type: text/plain; | |
| 4225 charset="iso-8859-1" | |
| 4226 From: Chef <chef@bork.bork.bork> | |
| 4227 To: issue_tracker@your.tracker.email.domain.example | |
| 4228 Message-Id: <dummy_test_message_id2> | |
| 4229 In-Reply-To: <dummy_test_message_id> | |
| 4230 Subject: Testing2... | |
| 4231 | |
| 4232 Followup message. | |
| 4233 ''') | |
| 4234 # this will be added to issue3 because of in-reply-to. | |
| 4235 nodeid4 = self._handle_mail('''Content-Type: text/plain; | |
| 4236 charset="iso-8859-1" | |
| 4237 From: Chef <chef@bork.bork.bork> | |
| 4238 To: issue_tracker@your.tracker.email.domain.example | |
| 4239 Message-Id: <dummy_test_message_id3> | |
| 4240 In-Reply-To: <dummy_test_message_id2> | |
| 4241 Subject: Testing... | |
| 4242 | |
| 4243 Yet another message in the same thread/issue. | |
| 4244 ''') | |
| 4245 | |
| 4246 # this message gets added to issue 2 by subject match. | |
| 4247 nodeid5 = self._handle_mail('''Content-Type: text/plain; | |
| 4248 charset="iso-8859-1" | |
| 4249 From: Chef <chef@bork.bork.bork> | |
| 4250 To: issue_tracker@your.tracker.email.domain.example | |
| 4251 Message-Id: <dummy_test_message_id4> | |
| 4252 In-Reply-To: <dummy_test_message_id> | |
| 4253 Subject: Testing1... | |
| 4254 | |
| 4255 Yet another message in the same thread/issue. | |
| 4256 ''') | |
| 4257 | |
| 4258 self.assertEqual(nodeid3, nodeid4) | |
| 4259 self.assertEqual(nodeid2, nodeid5) | |
| 4260 | |
| 4207 def testHelpSubject(self): | 4261 def testHelpSubject(self): |
| 4208 message = '''Content-Type: text/plain; | 4262 message = '''Content-Type: text/plain; |
| 4209 charset="iso-8859-1" | 4263 charset="iso-8859-1" |
| 4210 From: Chef <chef@bork.bork.bork> | 4264 From: Chef <chef@bork.bork.bork> |
| 4211 To: issue_tracker@your.tracker.email.domain.example | 4265 To: issue_tracker@your.tracker.email.domain.example |
