social/mass_mailing_partner/tests/test_mail_mail_statistics.py
Antonio Espinosa 6e50c7cb37 Link mail statistics to partner (#104)
[IMP] mass_mailing_partner: Link mail statistics to partner
2022-01-01 16:22:46 +01:00

29 lines
999 B
Python

# -*- coding: utf-8 -*-
# © 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import base
class MailMailStatisticsCase(base.BaseCase):
def test_link_partner(self):
partner = self.create_partner(
{'name': 'Test partner'})
stat = self.env['mail.mail.statistics'].create({
'model': 'res.partner',
'res_id': partner.id,
})
self.assertEqual(partner.id, stat.partner_id.id)
def test_link_mail_contact(self):
partner = self.create_partner(
{'name': 'Test partner', 'email': 'test@domain.com'})
contact = self.create_mailing_contact(
{'partner_id': partner.id, 'list_id': self.mailing_list.id})
stat = self.env['mail.mail.statistics'].create({
'model': 'mail.mass_mailing.contact',
'res_id': contact.id,
})
self.assertEqual(partner.id, stat.partner_id.id)