You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.1 KiB

  1. # Copyright 2015 Pedro M. Baeza <pedro.baeza@tecnativa.com>
  2. # Copyright 2015 Antonio Espinosa <antonio.espinosa@tecnativa.com>
  3. # Copyright 2015 Javier Iniesta <javieria@antiun.com>
  4. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  5. from . import base
  6. class MailMailStatisticsCase(base.BaseCase):
  7. def test_link_partner(self):
  8. partner = self.create_partner(
  9. {'name': 'Test partner'})
  10. stat = self.env['mail.mail.statistics'].create({
  11. 'model': 'res.partner',
  12. 'res_id': partner.id,
  13. })
  14. self.assertEqual(partner.id, stat.partner_id.id)
  15. def test_link_mail_contact(self):
  16. partner = self.create_partner(
  17. {'name': 'Test partner', 'email': 'test@domain.com'})
  18. contact_vals = {
  19. 'partner_id': partner.id,
  20. 'list_ids': [[6, 0, [self.mailing_list.id]]]
  21. }
  22. contact = self.create_mailing_contact(contact_vals)
  23. stat = self.env['mail.mail.statistics'].create({
  24. 'model': 'mail.mass_mailing.contact',
  25. 'res_id': contact.id,
  26. })
  27. self.assertEqual(partner.id, stat.partner_id.id)