diff --git a/pms_housekeeping/tests/test_pms_housekeeping_task.py b/pms_housekeeping/tests/test_pms_housekeeping_task.py index d99e28510d..70cb73e8b1 100644 --- a/pms_housekeeping/tests/test_pms_housekeeping_task.py +++ b/pms_housekeeping/tests/test_pms_housekeeping_task.py @@ -11,34 +11,187 @@ class TestPmsHousekeepingTask(TestPms): def setUp(self): super().setUp() - @freeze_time("2000-01-04") - def test_no_create_overnight_task_when_it_shouldnt_when_no_overnight(self): + def test_task_max_inheritance(self): # ARRANGE - # create task type - self.env["pms.housekeeping.task.type"].create( + task_type = self.env["pms.housekeeping.task.type"].create( + { + "name": "Task Type Parent", + "is_checkout": True, + } + ) + parent_task = self.env["pms.housekeeping.task"].create( + { + "name": "Parent task", + "room_id": self.room1.id, + "task_type_id": task_type.id, + "task_date": datetime.today(), + } + ) + child_task = self.env["pms.housekeeping.task"].create( + { + "name": "Child task", + "room_id": self.room1.id, + "task_type_id": task_type.id, + "parent_id": parent_task.id, + "task_date": datetime.today(), + } + ) + # ACT & ASSERT + with self.assertRaises( + ValidationError, + msg="The maximum level of inheritance between tasks should be 2", + ): + self.env["pms.housekeeping.task"].create( + { + "name": "Grandchild task", + "room_id": self.room1.id, + "task_type_id": task_type.id, + "parent_id": child_task.id, + "task_date": datetime.today(), + } + ) + + def test_task_with_non_housekeeper_employee(self): + # ARRANGE + self.job_id = self.env["hr.job"].create( + { + "name": "Non housekeeper job", + } + ) + self.employee = self.env["hr.employee"].create( + { + "name": "Test Employee", + "company_id": self.company1.id, + "job_id": self.job_id.id, + } + ) + self.task_type = self.env["pms.housekeeping.task.type"].create( { "name": "Task Type 1", - "is_overnight": True, - "days_after_clean_overnight": 2, } ) + # ACT & ASSERT + with self.assertRaises( + ValidationError, msg="Task should be assigned to a housekeeper role" + ): + self.env["pms.housekeeping.task"].create( + { + "name": "Task", + "room_id": self.room1.id, + "task_type_id": self.task_type.id, + "task_date": datetime.today(), + "housekeeper_ids": [(6, 0, [self.employee.id])], + } + ) + def test_task_with_housekeeper_employee(self): + # ARRANGE + self.employee = self.env["hr.employee"].create( + { + "name": "Test Employee", + "company_id": self.company1.id, + "job_id": self.env.ref("pms_housekeeping.housekeeping_job_id").id, + } + ) + self.task_type = self.env["pms.housekeeping.task.type"].create( + { + "name": "Task Type 1", + } + ) # ACT - # call method to create task - self.env["pms.housekeeping.task"].generate_tasks(self.pms_property1) + self.task = self.env["pms.housekeeping.task"].create( + { + "name": "Task", + "room_id": self.room1.id, + "task_type_id": self.task_type.id, + "task_date": datetime.today(), + "housekeeper_ids": [(6, 0, [self.employee.id])], + } + ) + # ASSERT + self.assertTrue(self.task, "Housekeeping task should be created") + + def test_task_inconsistency_between_room_id_and_housekeeper_properties(self): + # ARRANGE + self.pms_property2 = self.env["pms.property"].create( + { + "name": "Property 2", + "company_id": self.company1.id, + "default_pricelist_id": self.pricelist1.id, + } + ) + self.room2 = self.env["pms.room"].create( + { + "name": "Room 202", + "pms_property_id": self.pms_property2.id, + "room_type_id": self.room_type1.id, + } + ) + self.employee = self.env["hr.employee"].create( + { + "name": "Test Employee", + "company_id": self.company1.id, + "job_id": self.env.ref("pms_housekeeping.housekeeping_job_id").id, + "property_ids": [(6, 0, [self.pms_property1.id])], + } + ) + self.task_type = self.env["pms.housekeeping.task.type"].create( + { + "name": "Task Type 1", + } + ) + # ACT & ASSERT + with self.assertRaises( + ValidationError, + msg="Task with inconsistency between room_id and " + "housekeeper properties should not be created", + ): + self.env["pms.housekeeping.task"].create( + { + "name": "Task", + "room_id": self.room2.id, + "task_type_id": self.task_type.id, + "task_date": datetime.today(), + "housekeeper_ids": [(6, 0, [self.employee.id])], + } + ) + def test_task_consistency_between_room_id_and_housekeeper_properties(self): + # ARRANGE + self.employee = self.env["hr.employee"].create( + { + "name": "Test Employee", + "company_id": self.company1.id, + "job_id": self.env.ref("pms_housekeeping.housekeeping_job_id").id, + "property_ids": [(6, 0, [self.pms_property1.id])], + } + ) + self.task_type = self.env["pms.housekeeping.task.type"].create( + { + "name": "Task Type 1", + } + ) + # ACT + task = self.env["pms.housekeeping.task"].create( + { + "name": "Task", + "room_id": self.room1.id, + "task_type_id": self.task_type.id, + "task_date": datetime.today(), + "housekeeper_ids": [(6, 0, [self.employee.id])], + } + ) # ASSERT - # search for the task - housekeeping_task = self.env["pms.housekeeping.task"].search( - [("room_id", "=", self.room1.id)] + self.assertTrue( + task, + "Task with consistency between room_id and " + "housekeeper properties should be created", ) - # Verify that the housekeeping task is not created - self.assertFalse(housekeeping_task, "Housekeeping task shouldn't be created") + # Tests generate_tasks method @freeze_time("2000-01-10") - def test_create_overnight_task_when_it_should_be_created_with_different_dates(self): + def test_task_generate_tasks_create_overnight(self): # ARRANGE - # create reservation with checkin today self.env["pms.reservation"].create( { "checkin": datetime.today(), @@ -50,7 +203,6 @@ def test_create_overnight_task_when_it_should_be_created_with_different_dates(se "sale_channel_origin_id": self.sale_channel1.id, } ) - # create task type self.env["pms.housekeeping.task.type"].create( { "name": "Task Type 1", @@ -58,36 +210,23 @@ def test_create_overnight_task_when_it_should_be_created_with_different_dates(se "days_after_clean_overnight": 2, } ) - # Define a list of dates to iterate over - test_dates = [ - "2000-01-12", - "2000-01-14", - "2000-01-16", - ] + test_dates = ["2000-01-12", "2000-01-14", "2000-01-16"] for test_date in test_dates: with self.subTest(test_date=test_date): - # Freeze time to the current test date with freeze_time(test_date): # ACT - # call method to create task self.env["pms.housekeeping.task"].generate_tasks(self.pms_property1) - # ASSERT - # search for the task housekeeping_task = self.env["pms.housekeeping.task"].search( [("room_id", "=", self.room1.id), ("task_date", "=", test_date)] ) - # Verify that the housekeeping task is created self.assertTrue( - housekeeping_task, "Housekeeping task should be created" + housekeeping_task, "Overnight tasks should be created" ) @freeze_time("2000-01-10") - def test_create_overnight_task_when_it_shouldnt_be_created_with_different_dates( - self, - ): + def test_task_generate_tasks_no_create_overnight_tasks(self): # ARRANGE - # create reservation with checkin today self.env["pms.reservation"].create( { "checkin": datetime.today(), @@ -99,7 +238,6 @@ def test_create_overnight_task_when_it_shouldnt_be_created_with_different_dates( "sale_channel_origin_id": self.sale_channel1.id, } ) - # create task type self.env["pms.housekeeping.task.type"].create( { "name": "Task Type 1", @@ -107,59 +245,43 @@ def test_create_overnight_task_when_it_shouldnt_be_created_with_different_dates( "days_after_clean_overnight": 2, } ) - # Define a list of dates to iterate over - test_dates = [ - "2000-01-11", - "2000-01-13", - "2000-01-15", - ] + test_dates = ["2000-01-11", "2000-01-13", "2000-01-15"] for test_date in test_dates: with self.subTest(test_date=test_date): - # Freeze time to the current test date with freeze_time(test_date): # ACT - # call method to create task self.env["pms.housekeeping.task"].generate_tasks(self.pms_property1) - # ASSERT - # search for the task housekeeping_task = self.env["pms.housekeeping.task"].search( [("room_id", "=", self.room1.id), ("task_date", "=", test_date)] ) - # Verify that the housekeeping task is created self.assertFalse( - housekeeping_task, "Housekeeping task shouldn't be created" + housekeeping_task, "Overnight tasks shouldn't be created" ) - ################### @freeze_time("2000-01-04") - def test_no_create_empty_task_when_it_shouldnt_when_no_empty(self): + def test_task_generate_tasks_no_create_overnight_task_no_overnight_reservations( + self, + ): # ARRANGE - # create task type self.env["pms.housekeeping.task.type"].create( { "name": "Task Type 1", - "is_empty": True, - "days_after_clean_empty": 2, + "is_overnight": True, + "days_after_clean_overnight": 2, } ) - # ACT - # call method to create task self.env["pms.housekeeping.task"].generate_tasks(self.pms_property1) - # ASSERT - # search for the task housekeeping_task = self.env["pms.housekeeping.task"].search( [("room_id", "=", self.room1.id)] ) - # Verify that the housekeeping task is not created - self.assertFalse(housekeeping_task, "Housekeeping task shouldn't be created") + self.assertFalse(housekeeping_task, "Empty tasks shouldn't be created") @freeze_time("2000-02-11") - def test_create_empty_task_when_it_should_be_created_with_different_dates(self): + def test_task_generate_tasks_create_empty_tasks(self): # ARRANGE - # create reservation with checkout today - 10 days self.env["pms.reservation"].create( { "checkin": datetime.today() + timedelta(days=-20), @@ -171,38 +293,28 @@ def test_create_empty_task_when_it_should_be_created_with_different_dates(self): "sale_channel_origin_id": self.sale_channel1.id, } ) - # create task type self.env["pms.housekeeping.task.type"].create( - {"name": "Task Type 1", "is_empty": True, "days_after_clean_empty": 2} - ) - # Define a list of dates to iterate over - test_dates = [ - "2000-02-03", - "2000-02-05", - "2000-02-07", - ] + { + "name": "Task Type 1", + "is_empty": True, + "days_after_clean_empty": 2, + } + ) + test_dates = ["2000-02-03", "2000-02-05", "2000-02-07"] for test_date in test_dates: with self.subTest(test_date=test_date): - # Freeze time to the current test date with freeze_time(test_date): # ACT - # call method to create task self.env["pms.housekeeping.task"].generate_tasks(self.pms_property1) - # ASSERT - # search for the task housekeeping_task = self.env["pms.housekeeping.task"].search( [("room_id", "=", self.room1.id), ("task_date", "=", test_date)] ) - # Verify that the housekeeping task is created - self.assertTrue( - housekeeping_task, "Housekeeping task should be created" - ) + self.assertTrue(housekeeping_task, "Empty tasks should be created") @freeze_time("2000-02-11") - def test_create_empty_task_when_it_shouldnt_be_created_with_different_dates(self): + def test_task_generate_tasks_no_create_empty_tasks(self): # ARRANGE - # create reservation with checkout today - 10 days self.env["pms.reservation"].create( { "checkin": datetime.today() + timedelta(days=-20), @@ -214,45 +326,54 @@ def test_create_empty_task_when_it_shouldnt_be_created_with_different_dates(self "sale_channel_origin_id": self.sale_channel1.id, } ) - # create task type self.env["pms.housekeeping.task.type"].create( - {"name": "Task Type 1", "is_empty": True, "days_after_clean_empty": 2} - ) - # Define a list of dates to iterate over - test_dates = [ - "2000-02-02", - "2000-02-04", - "2000-02-06", - ] + { + "name": "Task Type 1", + "is_empty": True, + "days_after_clean_empty": 2, + } + ) + test_dates = ["2000-02-02", "2000-02-04", "2000-02-06"] for test_date in test_dates: with self.subTest(test_date=test_date): - # Freeze time to the current test date with freeze_time(test_date): # ACT - # call method to create task self.env["pms.housekeeping.task"].generate_tasks(self.pms_property1) - # ASSERT - # search for the task housekeeping_task = self.env["pms.housekeeping.task"].search( [("room_id", "=", self.room1.id), ("task_date", "=", test_date)] ) - # Verify that the housekeeping task is created self.assertFalse( - housekeeping_task, "Housekeeping task should be created" + housekeeping_task, "Empty tasks should not be created" ) @freeze_time("2000-01-04") - def test_create_checkin_task_when_it_should_when_checkin(self): + def test_task_generate_tasks_no_create_empty_task_no_previous_checkouts(self): + # ARRANGE + self.env["pms.housekeeping.task.type"].create( + { + "name": "Task Type 1", + "is_empty": True, + "days_after_clean_empty": 2, + } + ) + # ACT + self.env["pms.housekeeping.task"].generate_tasks(self.pms_property1) + # ASSERT + housekeeping_task = self.env["pms.housekeeping.task"].search( + [("room_id", "=", self.room1.id)] + ) + self.assertFalse(housekeeping_task, "Empty tasks shouldn't be created") + + @freeze_time("2000-01-04") + def test_task_generate_tasks_create_checkin_task(self): # ARRANGE - # create task type self.env["pms.housekeeping.task.type"].create( { "name": "Task Type 1", "is_checkin": True, } ) - # create reservation with checkin today self.env["pms.reservation"].create( { "checkin": datetime.today(), @@ -264,53 +385,40 @@ def test_create_checkin_task_when_it_should_when_checkin(self): "sale_channel_origin_id": self.sale_channel1.id, } ) - # ACT - # call method to create task self.env["pms.housekeeping.task"].generate_tasks(self.pms_property1) - # ASSERT - # search for the task housekeeping_task = self.env["pms.housekeeping.task"].search( [("room_id", "=", self.room1.id)] ) - # Verify that the housekeeping task is not created - self.assertTrue(housekeeping_task, "Housekeeping task should be created") + self.assertTrue(housekeeping_task, "Checkin tasks should be created") @freeze_time("2000-01-04") - def test_no_create_checkin_task_when_it_shouldnt_when_no_checkin(self): + def test_task_generate_tasks_no_create_checkin_task(self): # ARRANGE - # create task type self.env["pms.housekeeping.task.type"].create( { "name": "Task Type 1", "is_checkin": True, } ) - # ACT - # call method to create task self.env["pms.housekeeping.task"].generate_tasks(self.pms_property1) - # ASSERT - # search for the task housekeeping_task = self.env["pms.housekeeping.task"].search( [("room_id", "=", self.room1.id)] ) - # Verify that the housekeeping task is not created - self.assertFalse(housekeeping_task, "Housekeeping task shouldn't be created") + self.assertFalse(housekeeping_task, "Checkin task shouldn't be created") @freeze_time("2000-01-04") - def test_create_checkout_task_when_it_should_when_checkout(self): + def test_task_generate_tasks_create_checkout_task(self): # ARRANGE - # create task type self.env["pms.housekeeping.task.type"].create( { "name": "Task Type 1", "is_checkout": True, } ) - # create reservation with checkout today self.env["pms.reservation"].create( { "checkin": datetime.today() + timedelta(days=-3), @@ -322,46 +430,34 @@ def test_create_checkout_task_when_it_should_when_checkout(self): "sale_channel_origin_id": self.sale_channel1.id, } ) - # ACT - # call method to create task self.env["pms.housekeeping.task"].generate_tasks(self.pms_property1) - # ASSERT - # search for the task housekeeping_task = self.env["pms.housekeeping.task"].search( [("room_id", "=", self.room1.id)] ) - # Verify that the housekeeping task is not created - self.assertTrue(housekeeping_task, "Housekeeping task should be created") + self.assertTrue(housekeeping_task, "Checkout task should be created") @freeze_time("2000-01-04") - def test_no_create_checkout_task_when_it_shouldnt_when_no_checkout(self): + def test_task_generate_tasks_no_create_checkout_task(self): # ARRANGE - # create task type self.env["pms.housekeeping.task.type"].create( { "name": "Task Type 1", "is_checkout": True, } ) - # ACT - # call method to create task self.env["pms.housekeeping.task"].generate_tasks(self.pms_property1) - # ASSERT - # search for the task housekeeping_task = self.env["pms.housekeeping.task"].search( [("room_id", "=", self.room1.id)] ) - # Verify that the housekeeping task is not created - self.assertFalse(housekeeping_task, "Housekeeping task shouldn't be created") + self.assertFalse(housekeeping_task, "Checkout task shouldn't be created") @freeze_time("2000-01-04") - def test_create_task_childs(self): + def test_task_generate_tasks_create_child_task(self): # ARRANGE - # create task type parent_task_type = self.env["pms.housekeeping.task.type"].create( { "name": "Task Type Parent", @@ -375,7 +471,6 @@ def test_create_task_childs(self): "parent_id": parent_task_type.id, } ) - # create reservation with checkout today self.env["pms.reservation"].create( { "checkin": datetime.today() + timedelta(days=-3), @@ -387,30 +482,25 @@ def test_create_task_childs(self): "sale_channel_origin_id": self.sale_channel1.id, } ) - # ACT - # call method to create task self.env["pms.housekeeping.task"].generate_tasks(self.pms_property1) - # ASSERT - # search for the task housekeeping_task = self.env["pms.housekeeping.task"].search( - [("room_id", "=", self.room1.id), ("task_type_id", "=", child_task_type.id)] + [ + ("room_id", "=", self.room1.id), + ("task_type_id", "=", child_task_type.id), + ] ) - # Verify that the housekeeping task is not created - self.assertTrue(housekeeping_task, "Child housekeeping task should be created") + self.assertTrue(housekeeping_task, "Child task should be created") - def test_no_create_task_childs(self): + def test_task_generate_tasks_no_create_child_task(self): # ARRANGE - # create task type self.env["pms.housekeeping.task.type"].create( { "name": "Task Type Parent", "is_checkout": True, } ) - - # create reservation with checkout today self.env["pms.reservation"].create( { "checkin": datetime.today() + timedelta(days=-3), @@ -422,204 +512,10 @@ def test_no_create_task_childs(self): "sale_channel_origin_id": self.sale_channel1.id, } ) - # ACT - # call method to create task self.env["pms.housekeeping.task"].generate_tasks(self.pms_property1) - # ASSERT - # search for the task housekeeping_task = self.env["pms.housekeeping.task"].search( [("room_id", "=", self.room1.id)] ) - # Verify that the housekeeping task childs is not created - self.assertFalse( - housekeeping_task.child_ids, "Child housekeeping task shouldn´t be created" - ) - - def test_no_create_grandchild_task(self): - # ARRANGE - # create task type - task_type = self.env["pms.housekeeping.task.type"].create( - { - "name": "Task Type Parent", - "is_checkout": True, - } - ) - parent_task = self.env["pms.housekeeping.task"].create( - { - "name": "Task", - "room_id": self.room1.id, - "task_type_id": task_type.id, - "task_date": datetime.today(), - } - ) - child_task = self.env["pms.housekeeping.task"].create( - { - "name": "Child Task", - "room_id": self.room1.id, - "task_type_id": task_type.id, - "parent_id": parent_task.id, - "task_date": datetime.today(), - } - ) - # ACT & ASSERT - with self.assertRaises(ValidationError, msg="Grandchild task shouldn´t exist."): - self.env["pms.housekeeping.task"].create( - { - "name": "Grandchild Task", - "room_id": self.room1.id, - "task_type_id": task_type.id, - "parent_id": child_task.id, - "task_date": datetime.today(), - } - ) - - def test_create_task_with_no_housekeeper(self): - - # ARRANGE - self.job_id = self.env["hr.job"].create( - { - "name": "Test Job", - } - ) - self.employee = self.env["hr.employee"].create( - { - "name": "Test Employee", - "company_id": self.company1.id, - "job_id": self.job_id.id, - } - ) - # create task type - self.task_type = self.env["pms.housekeeping.task.type"].create( - { - "name": "Task Type 1", - "is_checkout": True, - } - ) - - # ACT & ASSERT - with self.assertRaises( - ValidationError, msg="Employee should have a housekeeper job" - ): - self.env["pms.housekeeping.task"].create( - { - "name": "Task", - "room_id": self.room1.id, - "task_type_id": self.task_type.id, - "task_date": datetime.today(), - "housekeeper_ids": [(6, 0, [self.employee.id])], - } - ) - - def test_create_task_with_housekeeper(self): - - # ARRANGE - self.employee = self.env["hr.employee"].create( - { - "name": "Test Employee", - "company_id": self.company1.id, - "job_id": self.env.ref("pms_housekeeping.housekeeping_job_id").id, - } - ) - # create task type - self.task_type = self.env["pms.housekeeping.task.type"].create( - { - "name": "Task Type 1", - "is_checkout": True, - } - ) - - # ACT - self.task = self.env["pms.housekeeping.task"].create( - { - "name": "Task", - "room_id": self.room1.id, - "task_type_id": self.task_type.id, - "task_date": datetime.today(), - "housekeeper_ids": [(6, 0, [self.employee.id])], - } - ) - - # ASSERT - self.assertTrue(self.task, "Housekeeping task should be created") - - def test_task_housekeeper_room_inconsistency(self): - - # ARRANGE - self.pms_property2 = self.env["pms.property"].create( - { - "name": "Property 2", - "company_id": self.company1.id, - "default_pricelist_id": self.pricelist1.id, - } - ) - self.room2 = self.env["pms.room"].create( - { - "name": "Room 202", - "pms_property_id": self.pms_property2.id, - "room_type_id": self.room_type1.id, - } - ) - self.employee = self.env["hr.employee"].create( - { - "name": "Test Employee", - "company_id": self.company1.id, - "job_id": self.env.ref("pms_housekeeping.housekeeping_job_id").id, - "property_ids": [(6, 0, [self.pms_property1.id])], - } - ) - # create task type - self.task_type = self.env["pms.housekeeping.task.type"].create( - { - "name": "Task Type 1", - "is_checkout": True, - } - ) - - # ACT & ASSERT - with self.assertRaises( - ValidationError, - msg="The room and housekeeper should belong to the same property.", - ): - self.env["pms.housekeeping.task"].create( - { - "name": "Task", - "room_id": self.room2.id, - "task_type_id": self.task_type.id, - "task_date": datetime.today(), - "housekeeper_ids": [(6, 0, [self.employee.id])], - } - ) - - def test_task_housekeeper_room_consistency(self): - # ARRANGE - self.employee = self.env["hr.employee"].create( - { - "name": "Test Employee", - "company_id": self.company1.id, - "job_id": self.env.ref("pms_housekeeping.housekeeping_job_id").id, - "property_ids": [(6, 0, [self.pms_property1.id])], - } - ) - # create task type - self.task_type = self.env["pms.housekeeping.task.type"].create( - { - "name": "Task Type 1", - "is_checkout": True, - } - ) - - # ACT - task = self.env["pms.housekeeping.task"].create( - { - "name": "Task", - "room_id": self.room1.id, - "task_type_id": self.task_type.id, - "task_date": datetime.today(), - "housekeeper_ids": [(6, 0, [self.employee.id])], - } - ) - - # ASSERT - self.assertTrue(task, "Housekeeping task should be created") + self.assertFalse(housekeeping_task.child_ids, "Child task shouldn´t be created") diff --git a/pms_housekeeping/tests/test_pms_housekeeping_task_type.py b/pms_housekeeping/tests/test_pms_housekeeping_task_type.py index a905c2c772..547f99d3ed 100644 --- a/pms_housekeeping/tests/test_pms_housekeeping_task_type.py +++ b/pms_housekeeping/tests/test_pms_housekeeping_task_type.py @@ -7,7 +7,7 @@ class TestPmsHousekeepingTask(TestPms): def setUp(self): super().setUp() - def test_days_after_clean_overnight_constraint(self): + def test_task_type_days_after_overnight_should_be_gt_zero(self): # ARRANGE, ACT & ASSERT # create task type and verify that the constraint is raised with self.assertRaises( @@ -21,7 +21,7 @@ def test_days_after_clean_overnight_constraint(self): } ) - def test_days_after_clean_empty_constraint(self): + def test_task_type_days_after_empty_should_be_gt_zero(self): # ARRANGE, ACT & ASSERT # create task type and verify that the constraint is raised with self.assertRaises( @@ -35,7 +35,7 @@ def test_days_after_clean_empty_constraint(self): } ) - def test_no_create_grandchild_task_type(self): + def test_task_type_max_inheritance(self): # ARRANGE # create task type parent_task_type = self.env["pms.housekeeping.task.type"].create( @@ -53,7 +53,8 @@ def test_no_create_grandchild_task_type(self): ) # ACT & ASSERT with self.assertRaises( - ValidationError, msg="Grandchild task type shouldn´t exist." + ValidationError, + msg="The maximum level of inheritance between tasks types should be 2", ): self.env["pms.housekeeping.task.type"].create( { diff --git a/pms_housekeeping/tests/test_pms_hr_employee.py b/pms_housekeeping/tests/test_pms_hr_employee.py index 4fa21130ff..8b074f5f6c 100644 --- a/pms_housekeeping/tests/test_pms_hr_employee.py +++ b/pms_housekeeping/tests/test_pms_hr_employee.py @@ -7,9 +7,10 @@ class TestPmsHrEmployee(TestPms): def setUp(self): super().setUp() - def test_employee_pre_assigned_room_inconsistent(self): + def test_hr_employee_inconsistency_between_employees_properties_and_pre_assigned_rooms( + self, + ): # ARRANGE - self.pms_property2 = self.env["pms.property"].create( { "name": "Property 2", @@ -24,7 +25,6 @@ def test_employee_pre_assigned_room_inconsistent(self): "room_type_id": self.room_type1.id, } ) - # ACT & ASSERT with self.assertRaises( ValidationError, msg="The room should belong to the employee's property." @@ -39,7 +39,9 @@ def test_employee_pre_assigned_room_inconsistent(self): } ) - def test_employee_pre_assigned_room_consistent_with_property(self): + def test_hr_employee_consistency_between_employees_properties_and_pre_assigned_rooms( + self, + ): # ARRANGE self.hr_employee = self.env["hr.employee"].create( { @@ -59,7 +61,9 @@ def test_employee_pre_assigned_room_consistent_with_property(self): "Pre assigned room is not consistent with property", ) - def test_employee_pre_assigned_room_consistent_without_properties(self): + def test_hr_employee_consistency_between_employees_no_properties_and_pre_assigned_rooms( + self, + ): # ARRANGE self.hr_employee = self.env["hr.employee"].create( { @@ -78,7 +82,9 @@ def test_employee_pre_assigned_room_consistent_without_properties(self): "Pre assigned room is not consistent without properties", ) - def test_not_pre_assigned_room_no_housekeeper_employee(self): + def test_hr_employee_consistency_between_employees_pre_assigned_rooms_and_position( + self, + ): # ARRANGE self.job_id = self.env["hr.job"].create( {