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