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.

41 lines
1.4 KiB

  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 MailMassMailingListCase(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. with self.assertRaises(ValidationError):
  16. self.create_mailing_list({
  17. 'name': 'List test 3',
  18. 'contact_ids': [(6, 0, (contact_test_1 | contact_test_2).ids)]
  19. })
  20. def test_create_mass_mailing_list_with_subscription(self):
  21. contact_test_1 = self.create_mailing_contact({
  22. 'name': 'Contact test 1',
  23. 'partner_id': self.partner.id,
  24. })
  25. contact_test_2 = self.create_mailing_contact({
  26. 'name': 'Contact test 2',
  27. 'partner_id': self.partner.id,
  28. })
  29. with self.assertRaises(ValidationError):
  30. self.create_mailing_list({
  31. 'name': 'List test 3',
  32. 'subscription_contact_ids': [
  33. (0, 0, {'contact_id': contact_test_1.id}),
  34. (0, 0, {'contact_id': contact_test_2.id}),
  35. ]
  36. })