[IMP] project_todo: write test for the create_todo_activity command
We check that both an activity and a task has been created by the create_todo_activity call We check that the task has the same description as the activity.todo.create note We check that the activity and the task have the same: - name - user - deadline Task-3492155 closes odoo/odoo#135134 Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import test_access_rights
|
||||
from . import test_mail_activity_todo_create
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import datetime
|
||||
from markupsafe import Markup
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestMailActivityTodo(TransactionCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.mail_activity = cls.env['mail.activity.todo.create'].create({
|
||||
'summary': 'test_summary',
|
||||
'date_deadline': datetime.date.today(),
|
||||
'note': Markup('<p>details</p>'),
|
||||
'user_id': cls.env.ref('base.user_admin').id,
|
||||
})
|
||||
cls.mail_activity.create_todo_activity()
|
||||
|
||||
def test_create_todo_activity(self):
|
||||
todo_1 = self.env['project.task'].search([('name', 'ilike', 'test_summary')], limit=1)
|
||||
activity_1 = self.env['mail.activity'].search([('summary', 'ilike', 'test_summary')], limit=1)
|
||||
self.assertTrue(todo_1.exists(), 'A Todo should have been created')
|
||||
self.assertEqual(todo_1.description, Markup('<p>details</p>'), 'The Todo description should be the same as the mail.activity.todo.create note')
|
||||
self.assertTrue(activity_1.exists(), 'An Activity should have been created')
|
||||
self.assertEqual(activity_1.summary, todo_1.name, 'The Todo and The Activity should have the same name/summary')
|
||||
self.assertEqual(activity_1.user_id, todo_1.user_ids, 'The Todo and The Activity should have the same user')
|
||||
self.assertEqual(activity_1.date_deadline, todo_1.date_deadline, 'The Todo and The Activity should have the same date deadline')
|
||||
Reference in New Issue
Block a user