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.

30 lines
1017 B

  1. # Copyright 2018 Tecnativa - Ernesto tejeda
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  3. from . import base
  4. from odoo.exceptions import ValidationError
  5. class MailMassMailingListContactRelCase(base.BaseCase):
  6. def test_create_mass_mailing_list(self):
  7. contact_test_1 = self.create_mailing_contact({
  8. 'name': 'Contact test 1',
  9. 'partner_id': self.partner.id,
  10. })
  11. contact_test_2 = self.create_mailing_contact({
  12. 'name': 'Contact test 2',
  13. 'partner_id': self.partner.id,
  14. })
  15. list_3 = self.create_mailing_list({'name': 'List test 3'})
  16. self.env['mail.mass_mailing.list_contact_rel'].create({
  17. 'list_id': list_3.id,
  18. 'contact_id': contact_test_1.id,
  19. })
  20. with self.assertRaises(ValidationError):
  21. self.env['mail.mass_mailing.list_contact_rel'].create({
  22. 'list_id': list_3.id,
  23. 'contact_id': contact_test_2.id,
  24. })