Browse Source

fixup! [ADD] mail_activity

pull/204/head
Holger Brunn 7 years ago
parent
commit
340f064e08
No known key found for this signature in database GPG Key ID: 1C9760FECA3AE18
  1. 20
      mail_activity/tests/test_mail_activity.py

20
mail_activity/tests/test_mail_activity.py

@ -7,7 +7,7 @@ from openerp.tests.common import TransactionCase
class TestMailActivity(TransactionCase):
def test_mail_activity(self):
partner = self.env['res.partner'].search([], limit=1)
partner = self.env.ref('base.res_partner_address_1')
activity = self.env['mail.activity'].with_context(
default_res_model=partner._name,
).create({
@ -16,11 +16,29 @@ class TestMailActivity(TransactionCase):
'mail_activity.mail_activity_data_meeting',
).id,
'date_deadline': fields.Date.today(),
'summary': 'Hello world',
})
self.assertEqual(activity.res_name, partner.display_name)
self.assertEqual(activity.state, 'today')
self.assertEqual(partner.activity_state, 'today')
activity.write({'user_id': self.env.ref('base.user_demo').id})
self.assertIn(
partner,
self.env['res.partner'].search([
('activity_user_id', '=', activity.user_id.id),
])
)
self.assertIn(
partner,
self.env['res.partner'].search([
('activity_summary', 'like', 'Hello world'),
])
)
activity.action_feedback('feedback')
self.assertIn('feedback', partner.message_ids[:1].body)
self.assertFalse(activity.exists())
partner.unlink()
self.assertFalse(self.env['mail.activity'].search([
('res_model', '=', 'res.partner'),
('res_id', '=', partner.id),
]))
Loading…
Cancel
Save