[IMP]mail: add test for download attachments

bzr revid: chm@openerp.com-20121210134932-wtu43jtpor386zab
This commit is contained in:
Christophe Matthieu
2012-12-10 14:49:32 +01:00
parent ce54a91dee
commit 782cd23937
+4
View File
@@ -421,6 +421,10 @@ class test_mail(test_mail_mockup.TestMailMockups):
self.assertEqual(attach.res_id, self.group_pigs_id, 'mail.message attachment res_id incorrect')
self.assertIn((attach.name, attach.datas.decode('base64')), _attachments,
'mail.message attachment name / data incorrect')
# Test: download attachments
for attach in message.attachment_ids:
dl_attach = self.mail_message.download_attachment(cr, uid, id_message=message.id, attachment_id=attach.id)
self.assertIn(( dl_attach['filename'], dl_attach['base64'].decode('base64') ), _attachments, 'mail.message download_attachment is incorrect')
# 3. Reply to the last message, check that its parent will be the first message
msg_id3 = self.mail_group.message_post(cr, uid, self.group_pigs_id, body='Test', parent_id=msg_id2)