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.

30 lines
1.2 KiB

  1. # -*- coding: utf-8 -*-
  2. # © 2017 Therp BV <http://therp.nl>
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from openerp.tests.common import HttpCase
  5. from ..controllers.main import UnquoteRecordset
  6. class TestWebsiteMailQweb(HttpCase):
  7. def test_website_mail_qweb(self):
  8. self.authenticate('admin', 'admin')
  9. result = self.url_open(
  10. '/website_mail/email_designer?model=email.template&res_id=%s' %
  11. self.env.ref('email_template_qweb.email_template_demo1').id
  12. )
  13. self.assertIn('Dear object.name,', result.read())
  14. def test_unquote_recordset(self):
  15. record = UnquoteRecordset(self.env['res.partner'].new(), 'object')
  16. self.assertEqual(record.name, 'object.name')
  17. self.assertEqual(record.parent_id.name, 'object.parent_id.name')
  18. self.assertEqual(record.id, 42)
  19. self.assertEqual(
  20. record.create_date,
  21. self.env['res.partner']._fields['create_date'].null(self.env)
  22. )
  23. self.assertEqual(
  24. record[:1]['create_date'],
  25. self.env['res.partner']._fields['create_date'].null(self.env)
  26. )
  27. self.assertEqual(record._fields, self.env['res.partner']._fields)