Skip to content

Commit 08433d7

Browse files
committed
Add new test new email body unchanged is no.
verify that sig is stipped.
1 parent f94862e commit 08433d7

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

test/test_mailgw.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3333,6 +3333,68 @@ def testEmailQuotingNewIsFollowup(self):
33333333
self.assertEqual(content, '''This is a followup''')
33343334
self.assertEqual(summary, '''This is a followup''')
33353335

3336+
fourthquotingtest = '''Content-Type: text/plain;
3337+
charset="iso-8859-1"
3338+
From: richard <[email protected]>
3339+
3340+
Message-Id: <followup_dummy_id>
3341+
In-Reply-To: <dummy_test_message_id>
3342+
Subject: Re: [issue1] Testing...
3343+
3344+
Blah blah wrote:
3345+
> Blah bklaskdfj sdf asdf jlaskdf skj sdkfjl asdf
3346+
> skdjlkjsdfalsdkfjasdlfkj dlfksdfalksd fj
3347+
>
3348+
3349+
This is a followup
3350+
3351+
> mumble mumble but
3352+
> more mumble mumble
3353+
3354+
I see your mubble and raise you a mumble.
3355+
3356+
But I also have a full house which beats your
3357+
>mumbler
3358+
3359+
so I win.
3360+
'''
3361+
def testEmailBodyUnchangedNewIsNo(self):
3362+
"""verify that only the signature is stripped"""
3363+
3364+
mysig = "\n--\nmy sig\n\n"
3365+
self.instance.config.EMAIL_LEAVE_BODY_UNCHANGED = 'no'
3366+
# create the message, remove the prefix from subject
3367+
testmessage=self.fourthquotingtest.replace(" Re: [issue1]", "") + mysig
3368+
print(testmessage)
3369+
print("\n======\n")
3370+
nodeid = self._handle_mail(testmessage)
3371+
3372+
msgs = self.db.issue.get(nodeid, 'messages')
3373+
# validate content and summary
3374+
content = self.db.msg.get(msgs[0], 'content')
3375+
print(content)
3376+
self.assertIn(content, '''Blah blah wrote:
3377+
> Blah bklaskdfj sdf asdf jlaskdf skj sdkfjl asdf
3378+
> skdjlkjsdfalsdkfjasdlfkj dlfksdfalksd fj
3379+
>
3380+
3381+
This is a followup
3382+
3383+
> mumble mumble but
3384+
> more mumble mumble
3385+
3386+
I see your mubble and raise you a mumble.
3387+
3388+
But I also have a full house which beats your
3389+
>mumbler
3390+
3391+
so I win.
3392+
'''
3393+
)
3394+
3395+
summary = self.db.msg.get(msgs[0], 'summary')
3396+
self.assertEqual(summary, '''This is a followup''')
3397+
33363398
def testEmailBodyUnchangedNewIsYes(self):
33373399
mysig = "--\nmy sig\n\n"
33383400
self.instance.config.EMAIL_LEAVE_BODY_UNCHANGED = 'yes'

0 commit comments

Comments
 (0)