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.

35 lines
1.5 KiB

  1. # -*- coding: utf-8 -*-
  2. # See README.rst file on addon root folder for license details
  3. from openerp.tests.common import TransactionCase
  4. class BaseCase(TransactionCase):
  5. def setUp(self):
  6. super(BaseCase, self).setUp()
  7. m_partner_category = self.env['res.partner.category']
  8. m_mailing_list = self.env['mail.mass_mailing.list']
  9. self.company_id = self.env.ref('base.main_company')
  10. self.company = self.env['res.company'].browse(self.company_id)
  11. self.partner = self.create_partner({'name': 'Partner test',
  12. 'email': 'partner@test.com'})
  13. partner_category = m_partner_category.create({'name': 'Category Test'})
  14. self.mailing_list = m_mailing_list.create({'name': 'List test'})
  15. self.mailing_list2 = m_mailing_list.create(
  16. {'name': 'List test 2', 'partner_mandatory': True,
  17. 'partner_category': partner_category.id})
  18. def create_partner(self, vals):
  19. m_partner = self.env['res.partner']
  20. return m_partner.create(vals)
  21. def create_mailing_contact(self, vals):
  22. m_mailing_contact = self.env['mail.mass_mailing.contact']
  23. return m_mailing_contact.create(vals)
  24. def check_mailing_contact_partner(self, mailing_contact):
  25. if mailing_contact.partner_id:
  26. self.assertEqual(mailing_contact.partner_id.email,
  27. mailing_contact.email)
  28. self.assertEqual(mailing_contact.partner_id.name,
  29. mailing_contact.name)