[IMP] project_acceptance: create test

H11043
This commit is contained in:
Leo Pinedo
2022-10-11 23:42:51 +00:00
parent 6f87dc4ac5
commit 7ff64d5193
2 changed files with 23 additions and 0 deletions

View File

@@ -0,0 +1 @@
from . import test_project_acceptance

View File

@@ -0,0 +1,22 @@
from odoo.addons.project.tests.test_access_rights import TestAccessRights
class TestProjectAcceptance(TestAccessRights):
def test_10_task_aceptance(self):
exception = self.env.ref('project_acceptance.except_no_project_id').sudo()
exception.active = True
task = self.create_task('Test task acceptance')
self.assertTrue(task)
self.assertFalse(task.task_acceptance)
self.assertFalse(task.stage_id)
#exception must exist if stage requires acceptance
stage_in_progress = self.env['project.task.type'].search([('name', '=', 'In Progress')])
self.assertEqual(stage_in_progress.name, 'In Progress')
task.stage_id = stage_in_progress
stage_in_progress.requires_acceptance = True
stage_done = self.env['project.task.type'].search([('name', '=', 'Done')])
self.assertTrue(task.exception_ids)
self.assertEqual(task.stage_id.name, 'In Progress')