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.

26 lines
1.1 KiB

  1. # -*- coding: utf-8 -*-
  2. # © 2016 Therp BV <http://therp.nl>
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from odoo.tests.common import TransactionCase
  5. class TestMailTemplateQweb(TransactionCase):
  6. def test_email_template_qweb(self):
  7. template = self.env.ref('email_template_qweb.email_template_demo1')
  8. mail_values = template.generate_email([self.env.user.id])
  9. self.assertTrue(
  10. # this comes from the called template if everything worked
  11. '<footer>' in mail_values[self.env.user.id]['body_html'],
  12. 'Did not rcv rendered template in response. Got: \n%s\n' % (
  13. mail_values[self.env.user.id]['body_html']
  14. )
  15. )
  16. # the same method is also called in a non multi mode
  17. mail_values = template.generate_email(self.env.user.id)
  18. self.assertTrue(
  19. # this comes from the called template if everything worked
  20. '<footer>' in mail_values['body_html'],
  21. 'Did not rcv rendered template in response. Got: \n%s\n' % (
  22. mail_values['body_html']
  23. )
  24. )