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. # © 2017 Therp BV <http://therp.nl>
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from odoo import fields
  5. from openerp.tests.common import TransactionCase
  6. class TestMailActivity(TransactionCase):
  7. def test_mail_activity(self):
  8. partner = self.env['res.partner'].search([], limit=1)
  9. activity = self.env['mail.activity'].with_context(
  10. default_res_model=partner._name,
  11. ).create({
  12. 'res_id': partner.id,
  13. 'activity_type_id': self.env.ref(
  14. 'mail_activity.mail_activity_data_meeting',
  15. ).id,
  16. 'date_deadline': fields.Date.today(),
  17. })
  18. self.assertEqual(activity.res_name, partner.display_name)
  19. self.assertEqual(activity.state, 'today')
  20. self.assertEqual(partner.activity_state, 'today')
  21. activity.write({'user_id': self.env.ref('base.user_demo').id})
  22. activity.action_feedback('feedback')
  23. self.assertIn('feedback', partner.message_ids[:1].body)
  24. self.assertFalse(activity.exists())