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.

35 lines
1.3 KiB

  1. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  2. from odoo.tests.common import TransactionCase
  3. from datetime import date
  4. class TestMailActivityDoneMethods(TransactionCase):
  5. def setUp(self):
  6. super(TestMailActivityDoneMethods, self).setUp()
  7. self.employee = self.env['res.users'].create({
  8. 'company_id': self.env.ref("base.main_company").id,
  9. 'name': "Test User",
  10. 'login': "testuser",
  11. 'groups_id': [(6, 0, [self.env.ref('base.group_user').id])]
  12. })
  13. activity_type = self.env['mail.activity.type'].search(
  14. [('name', '=', 'Meeting')], limit=1)
  15. self.act1 = self.env['mail.activity'].create({
  16. 'activity_type_id': activity_type.id,
  17. 'res_id': self.env.ref("base.res_partner_1").id,
  18. 'res_model_id': self.env['ir.model']._get('res.partner').id,
  19. 'user_id': self.employee.id,
  20. 'date_deadline': date.today(),
  21. })
  22. def test_mail_activity_done(self):
  23. self.act1.done = True
  24. self.assertEquals(self.act1.state, 'done')
  25. def test_activity_user_count(self):
  26. act_count = self.employee.sudo(self.employee).activity_user_count()
  27. self.assertEqual(len(act_count), 1,
  28. "Number of activities should be equal to one")