diff --git a/portal_welcome_email_template/tests/__init__.py b/portal_welcome_email_template/tests/__init__.py new file mode 100644 index 00000000..e0deade8 --- /dev/null +++ b/portal_welcome_email_template/tests/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# (c) 2015 Incaser Informatica S.L. - Sergio Teruel +# (c) 2015 Incaser Informatica S.L. - Carlos Dauden +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from . import test_portal_welcome_email_template diff --git a/portal_welcome_email_template/tests/test_portal_welcome_email_template.py b/portal_welcome_email_template/tests/test_portal_welcome_email_template.py new file mode 100644 index 00000000..cbc00a6b --- /dev/null +++ b/portal_welcome_email_template/tests/test_portal_welcome_email_template.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# (c) 2015 Incaser Informatica S.L. - Sergio Teruel +# (c) 2015 Incaser Informatica S.L. - Carlos Dauden +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from openerp.tests.common import TransactionCase + + +class TestWelcomeEmailTemplate(TransactionCase): + + def setUp(self): + super(TestWelcomeEmailTemplate, self).setUp() + self.partner_obj = self.env['res.partner'] + self.partner = self.env.ref('base.res_partner_address_4') + + self.wiz_portal_access = self.env['portal.wizard'].create({ + 'user_ids': [(0, 0, { + 'partner_id': self.partner.id, + 'in_portal': True, + })], + }) + + def test_send_mail(self): + self.wiz_portal_access.user_ids.action_apply() + portal_user = self.env['res.users'].search( + [('partner_id', '=', self.partner.id)]) + self.assertTrue(portal_user) + mail = self.env['mail.mail'].search([ + ('model', '=', 'res.users'), + ('res_id', '=', portal_user.id) + ]) + self.assertTrue(mail)