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.

27 lines
1.2 KiB

  1. # -*- coding: utf-8 -*-
  2. # © 2015 Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
  3. # © 2015 Antonio Espinosa <antonioea@antiun.com>
  4. # © 2015 Javier Iniesta <javieria@antiun.com>
  5. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  6. from . import base
  7. from openerp.exceptions import ValidationError
  8. class ResPartnerCase(base.BaseCase):
  9. def test_count_mass_mailing_contacts(self):
  10. self.create_mailing_contact({'email': 'partner@test.com',
  11. 'list_id': self.mailing_list.id})
  12. self.create_mailing_contact({'email': 'partner@test.com',
  13. 'list_id': self.mailing_list2.id})
  14. self.assertEqual(self.partner.mass_mailing_contacts_count, 2)
  15. def test_write_res_partner(self):
  16. contact = self.create_mailing_contact(
  17. {'email': 'partner@test.com', 'list_id': self.mailing_list.id})
  18. self.partner.write({'name': 'Changed', 'email': 'partner@changed.com'})
  19. self.assertEqual(contact.name, self.partner.name)
  20. self.assertEqual(contact.email, self.partner.email)
  21. with self.assertRaises(ValidationError):
  22. self.partner.write({'email': False})