From 283dbb733de66f06d92361c2e028ed432d32bbba Mon Sep 17 00:00:00 2001 From: Jake Ororke Date: Wed, 18 Dec 2024 19:54:56 -0800 Subject: [PATCH] Updating TC_SEAR_1_3, TC_SEAR_1_5, and TC_SEAR_1_6 test modules: - Updating to using attribute_guard, command_guard, and feature_guard functions where applicable. --- src/python_testing/TC_SEAR_1_3.py | 4 +--- src/python_testing/TC_SEAR_1_5.py | 15 +++++---------- src/python_testing/TC_SEAR_1_6.py | 11 +++-------- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/python_testing/TC_SEAR_1_3.py b/src/python_testing/TC_SEAR_1_3.py index bfb9003e463a7c..5e66e54c0c12f6 100644 --- a/src/python_testing/TC_SEAR_1_3.py +++ b/src/python_testing/TC_SEAR_1_3.py @@ -97,8 +97,6 @@ async def test_TC_SEAR_1_3(self): asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set") self.app_pipe = self.app_pipe + str(app_pid) - features = await self.read_sear_attribute_expect_success(endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.FeatureMap) - self.print_step(1, "Commissioning, already done") # Ensure that the device is in the correct state @@ -165,7 +163,7 @@ async def test_TC_SEAR_1_3(self): else: self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") - if bool(features & Clusters.ServiceArea.Bitmaps.Feature.kSelectWhileRunning): + if await self.feature_guard(endpoint=self.endpoint, cluster=Clusters.ServiceArea, feature_int=Clusters.ServiceArea.Bitmaps.Feature.kSelectWhileRunning): await self.send_cmd_select_areas_expect_response(step=15, new_areas=valid_areas, expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kSuccess) else: await self.send_cmd_select_areas_expect_response(step=15, new_areas=valid_areas, expected_response=Clusters.ServiceArea.Enums.SelectAreasStatus.kInvalidInMode) diff --git a/src/python_testing/TC_SEAR_1_5.py b/src/python_testing/TC_SEAR_1_5.py index beac29e68dd1d7..53db09ebe67c05 100644 --- a/src/python_testing/TC_SEAR_1_5.py +++ b/src/python_testing/TC_SEAR_1_5.py @@ -111,12 +111,7 @@ async def test_TC_SEAR_1_5(self): asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set") self.app_pipe = self.app_pipe + str(app_pid) - attribute_list = await self.read_sear_attribute_expect_success( - endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.AttributeList) - accepted_cmd_list = await self.read_sear_attribute_expect_success( - endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.AcceptedCommandList) - - if Clusters.ServiceArea.Commands.SkipArea.command_id not in accepted_cmd_list: + if not await self.command_guard(endpoint=self.endpoint, command=Clusters.ServiceArea.Commands.SkipArea): asserts.fail("Skip Area Response command needs to be supported to run this test") self.print_step(1, "Commissioning, already done") @@ -175,7 +170,7 @@ async def test_TC_SEAR_1_5(self): if not self.check_pics("SEAR.S.M.VALID_STATE_FOR_SKIP"): return - if Clusters.ServiceArea.Attributes.Progress.attribute_id in attribute_list: + if await self.attribute_guard(endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.Progress): old_progress_list = await self.read_progress(step=9) asserts.assert_true(len(old_progress_list) > 0, f"len of Progress({len(old_progress_list)}) should not be zero)") @@ -183,7 +178,7 @@ async def test_TC_SEAR_1_5(self): asserts.assert_true(len(selected_areas) > 0, "SelectedAreas is empty") old_current_area = NullValue - if Clusters.ServiceArea.Attributes.CurrentArea.attribute_id in attribute_list: + if await self.attribute_guard(endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.CurrentArea): old_current_area = await self.read_current_area(step=11) self.print_step("12", "") @@ -197,7 +192,7 @@ async def test_TC_SEAR_1_5(self): if not self.is_ci: self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") - if Clusters.ServiceArea.Attributes.Progress.attribute_id in attribute_list: + if await self.attribute_guard(endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.Progress): new_progress_list = await self.read_progress(step=15) asserts.assert_true(len(new_progress_list) > 0, f"len of Progress({len(new_progress_list)}) should not be zero)") @@ -238,7 +233,7 @@ async def test_TC_SEAR_1_5(self): self.print_step("17", "") return - if Clusters.ServiceArea.Attributes.Progress.attribute_id not in attribute_list: + if not await self.attribute_guard(endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.Progress): return if self.check_pics("SEAR.S.M.HAS_MANUAL_SKIP_STATE_CONTROL"): diff --git a/src/python_testing/TC_SEAR_1_6.py b/src/python_testing/TC_SEAR_1_6.py index a5a2ac73ce07b5..592461d214ed54 100644 --- a/src/python_testing/TC_SEAR_1_6.py +++ b/src/python_testing/TC_SEAR_1_6.py @@ -95,19 +95,14 @@ async def test_TC_SEAR_1_6(self): self.app_pipe = self.app_pipe + str(app_pid) attributes = Clusters.ServiceArea.Attributes - attribute_list = await self.read_sear_attribute_expect_success( - endpoint=self.endpoint, attribute=Clusters.ServiceArea.Attributes.AttributeList) - SupportedAreas = attributes.SupportedAreas.attribute_id - SelectedAreas = attributes.SelectedAreas.attribute_id - Progress = attributes.Progress.attribute_id - if SupportedAreas not in attribute_list: + if not await self.attribute_guard(endpoint=self.endpoint, attribute=attributes.SupportedAreas): asserts.fail("Supported areas attribute required in attribute list to run test") - if SelectedAreas not in attribute_list: + if not await self.attribute_guard(endpoint=self.endpoint, attribute=attributes.SelectedAreas): asserts.fail("Selected areas attribute required in attribute list to run test") - if Progress not in attribute_list: + if not await self.attribute_guard(endpoint=self.endpoint, attribute=attributes.Progress): asserts.fail("Progress attribute required in attribute list to run test") self.print_step(1, "Commissioning, already done")