Skip to content

Commit ffc525f

Browse files
committed
adding test for issue934009. Code coverage shows no test for MAILGW_LEAVE_BODY_UNCHANGED=yes. Adding that for new issue creation and followup.
1 parent 8c10b31 commit ffc525f

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

test/test_mailgw.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2608,6 +2608,53 @@ def testEmailQuotingNewIsFollowup(self):
26082608
self.assertEqual(content, '''This is a followup''')
26092609
self.assertEqual(summary, '''This is a followup''')
26102610

2611+
def testEmailBodyUnchangedNewIsYes(self):
2612+
mysig = "--\nmy sig\n\n"
2613+
self.instance.config.EMAIL_LEAVE_BODY_UNCHANGED = 'yes'
2614+
# create the message, remove the prefix from subject
2615+
testmessage=self.firstquotingtest.replace(" Re: [issue1]", "") + mysig
2616+
nodeid = self._handle_mail(testmessage)
2617+
2618+
msgs = self.db.issue.get(nodeid, 'messages')
2619+
# validate content and summary
2620+
content = self.db.msg.get(msgs[0], 'content')
2621+
self.assertEqual(content, '''Blah blah wrote:
2622+
> Blah bklaskdfj sdf asdf jlaskdf skj sdkfjl asdf
2623+
> skdjlkjsdfalsdkfjasdlfkj dlfksdfalksd fj
2624+
>
2625+
2626+
This is a followup\n''' + mysig[:-2])
2627+
# the :-2 requrement to strip the trailing newlines is probably a bug
2628+
# somewhere mailgw has right content maybe trailing \n are stripped by
2629+
# msg or something.
2630+
2631+
summary = self.db.msg.get(msgs[0], 'summary')
2632+
self.assertEqual(summary, '''This is a followup''')
2633+
2634+
def testEmailBodyUnchangedFollowupIsYes(self):
2635+
mysig = "--\nmy sig\n\n"
2636+
self.instance.config.EMAIL_LEAVE_BODY_UNCHANGED = 'yes'
2637+
2638+
# create issue1 that we can followup on
2639+
self.doNewIssue()
2640+
testmessage=self.firstquotingtest + mysig
2641+
nodeid = self._handle_mail(testmessage)
2642+
msgs = self.db.issue.get(nodeid, 'messages')
2643+
# validate content and summary
2644+
content = self.db.msg.get(msgs[1], 'content')
2645+
self.assertEqual(content, '''Blah blah wrote:
2646+
> Blah bklaskdfj sdf asdf jlaskdf skj sdkfjl asdf
2647+
> skdjlkjsdfalsdkfjasdlfkj dlfksdfalksd fj
2648+
>
2649+
2650+
This is a followup\n''' + mysig[:-2])
2651+
# the :-2 requrement to strip the trailing newlines is probably a bug
2652+
# somewhere mailgw has right content maybe trailing \n are stripped by
2653+
# msg or something.
2654+
2655+
summary = self.db.msg.get(msgs[1], 'summary')
2656+
self.assertEqual(summary, '''This is a followup''')
2657+
26112658
def testEmailReplaceBodyNewIsNew(self):
26122659
mysig = "--\nmy sig\n\n"
26132660
self.instance.config.EMAIL_LEAVE_BODY_UNCHANGED = 'new'

0 commit comments

Comments
 (0)