From 782cd23937a27faba8b60c7a93e1194de25c0984 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Mon, 10 Dec 2012 14:49:32 +0100 Subject: [PATCH] [IMP]mail: add test for download attachments bzr revid: chm@openerp.com-20121210134932-wtu43jtpor386zab --- addons/mail/tests/test_mail.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/mail/tests/test_mail.py b/addons/mail/tests/test_mail.py index bc6df813ef7..3c696b02f38 100644 --- a/addons/mail/tests/test_mail.py +++ b/addons/mail/tests/test_mail.py @@ -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)