comparison test/test_mailgw.py @ 5125:410e565b5c1f

adding test for issue934009. Code coverage shows no test for MAILGW_LEAVE_BODY_UNCHANGED=yes. Adding that for new issue creation and followup.
author John Rouillard <rouilj@ieee.org>
date Sun, 03 Jul 2016 20:44:26 -0400
parents a927f9549af0
children 0c9eed9c4029
comparison
equal deleted inserted replaced
5124:a927f9549af0 5125:410e565b5c1f
2604 msgs = self.db.issue.get(nodeid, 'messages') 2604 msgs = self.db.issue.get(nodeid, 'messages')
2605 # check second message for accuracy 2605 # check second message for accuracy
2606 content = self.db.msg.get(msgs[1], 'content') 2606 content = self.db.msg.get(msgs[1], 'content')
2607 summary = self.db.msg.get(msgs[1], 'summary') 2607 summary = self.db.msg.get(msgs[1], 'summary')
2608 self.assertEqual(content, '''This is a followup''') 2608 self.assertEqual(content, '''This is a followup''')
2609 self.assertEqual(summary, '''This is a followup''')
2610
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')
2609 self.assertEqual(summary, '''This is a followup''') 2656 self.assertEqual(summary, '''This is a followup''')
2610 2657
2611 def testEmailReplaceBodyNewIsNew(self): 2658 def testEmailReplaceBodyNewIsNew(self):
2612 mysig = "--\nmy sig\n\n" 2659 mysig = "--\nmy sig\n\n"
2613 self.instance.config.EMAIL_LEAVE_BODY_UNCHANGED = 'new' 2660 self.instance.config.EMAIL_LEAVE_BODY_UNCHANGED = 'new'

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