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.

25 lines
1.1 KiB

  1. # -*- coding: utf-8 -*-
  2. # See README.rst file on addon root folder for license details
  3. from . import base
  4. from openerp.exceptions import ValidationError
  5. class ResPartnerCase(base.BaseCase):
  6. def test_count_mass_mailing_contacts(self):
  7. self.create_mailing_contact({'email': 'partner@test.com',
  8. 'list_id': self.mailing_list.id})
  9. self.create_mailing_contact({'email': 'partner@test.com',
  10. 'list_id': self.mailing_list2.id})
  11. self.partner._count_mass_mailing_contacts()
  12. self.assertEqual(self.partner.mass_mailing_contacts_count, 2)
  13. def test_write_res_partner(self):
  14. contact = self.create_mailing_contact(
  15. {'email': 'partner@test.com', 'list_id': self.mailing_list.id})
  16. self.partner.write({'name': 'Changed', 'email': 'partner@changed.com'})
  17. self.assertEqual(contact.name, self.partner.name)
  18. self.assertEqual(contact.email, self.partner.email)
  19. with self.assertRaises(ValidationError):
  20. self.partner.write({'email': False})