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.

38 lines
1.7 KiB

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2015 Pedro M. Baeza <pedro.baeza@tecnativa.com>
  3. # Copyright 2015 Antonio Espinosa <antonio.espinosa@tecnativa.com>
  4. # Copyright 2015 Javier Iniesta <javieria@antiun.com>
  5. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  6. from odoo.tests.common import TransactionCase
  7. class BaseCase(TransactionCase):
  8. def setUp(self):
  9. super(BaseCase, self).setUp()
  10. m_partner_category = self.env['res.partner.category']
  11. m_mailing_list = self.env['mail.mass_mailing.list']
  12. self.company_id = self.env.ref('base.main_company')
  13. self.company = self.env['res.company'].browse(self.company_id)
  14. self.partner = self.create_partner({'name': 'Partner test',
  15. 'email': 'partner@test.com'})
  16. partner_category = m_partner_category.create({'name': 'Category Test'})
  17. self.mailing_list = m_mailing_list.create({'name': 'List test'})
  18. self.mailing_list2 = m_mailing_list.create(
  19. {'name': 'List test 2', 'partner_mandatory': True,
  20. 'partner_category': partner_category.id})
  21. def create_partner(self, vals):
  22. m_partner = self.env['res.partner']
  23. return m_partner.create(vals)
  24. def create_mailing_contact(self, vals):
  25. m_mailing_contact = self.env['mail.mass_mailing.contact']
  26. return m_mailing_contact.create(vals)
  27. def check_mailing_contact_partner(self, mailing_contact):
  28. if mailing_contact.partner_id:
  29. self.assertEqual(mailing_contact.partner_id.email,
  30. mailing_contact.email)
  31. self.assertEqual(mailing_contact.partner_id.name,
  32. mailing_contact.name)