From 8a0ac72718c2c702441a9be67a1bd98db2e93832 Mon Sep 17 00:00:00 2001 From: Petru Lauric <81822411+plauric@users.noreply.github.com> Date: Fri, 1 Sep 2023 19:08:56 -0400 Subject: [PATCH] fix RVC Mode clusters' TC 3-2: add precondition check (#29016) * fix TC 3-2 * fix lint issues * use 'not' instead of 'is False' --- src/python_testing/TC_RVCCLEANM_3_2.py | 30 ++++++++++++++++++++++++++ src/python_testing/TC_RVCRUNM_3_2.py | 30 ++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/src/python_testing/TC_RVCCLEANM_3_2.py b/src/python_testing/TC_RVCCLEANM_3_2.py index 7f29c8807262b9..0ac29273c20b7d 100644 --- a/src/python_testing/TC_RVCCLEANM_3_2.py +++ b/src/python_testing/TC_RVCCLEANM_3_2.py @@ -45,6 +45,30 @@ async def write_start_up_mode(self, newMode): ret = await self.default_controller.WriteAttribute(self.dut_node_id, [(self.endpoint, Clusters.RvcCleanMode.Attributes.StartUpMode(newMode))]) asserts.assert_equal(ret[0].Status, Status.Success, "Writing to StartUpMode failed") + async def check_preconditions(self, endpoint): + # check whether the StartUpMode will be overridden by the OnMode attribute + + if not self.check_pics("RVCCLEANM.S.F00"): + return True + + logging.info("RVCCLEANM.S.F00: 1") + + cluster = Clusters.Objects.OnOff + attr = Clusters.OnOff.Attributes.StartUpOnOff + startUpOnOff = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attr) + logging.info("StartUpOnOff: %s" % (startUpOnOff)) + if startUpOnOff == NullValue or startUpOnOff == 0: + return True + + cluster = Clusters.Objects.RvcCleanMode + attr = Clusters.RvcCleanMode.Attributes.OnMode + onMode = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attr) + logging.info("OnMode: %s" % (onMode)) + if onMode == NullValue: + return True + + return False + @async_test_body async def test_TC_RVCCLEANM_3_2(self): @@ -60,6 +84,12 @@ async def test_TC_RVCCLEANM_3_2(self): asserts.assert_true(self.check_pics("RVCCLEANM.S.C00.Rsp"), "RVCCLEANM.S.C00.Rsp must be supported") asserts.assert_true(self.check_pics("RVCCLEANM.S.C01.Tx"), "RVCCLEANM.S.C01.Tx must be supported") + depOnOffKey = "RVCCLEANM.S.F00" + asserts.assert_true(depOnOffKey in self.matter_test_config.pics, "%s must be provided" % (depOnOffKey)) + + ret = await self.check_preconditions(self.endpoint) + asserts.assert_true(ret, "invalid preconditions - StartUpMode overridden by OnMode") + attributes = Clusters.RvcCleanMode.Attributes from enum import Enum diff --git a/src/python_testing/TC_RVCRUNM_3_2.py b/src/python_testing/TC_RVCRUNM_3_2.py index 683395ef1db72a..09d99f4864b15f 100644 --- a/src/python_testing/TC_RVCRUNM_3_2.py +++ b/src/python_testing/TC_RVCRUNM_3_2.py @@ -45,6 +45,30 @@ async def write_start_up_mode(self, newMode): ret = await self.default_controller.WriteAttribute(self.dut_node_id, [(self.endpoint, Clusters.RvcRunMode.Attributes.StartUpMode(newMode))]) asserts.assert_equal(ret[0].Status, Status.Success, "Writing to StartUpMode failed") + async def check_preconditions(self, endpoint): + # check whether the StartUpMode will be overridden by the OnMode attribute + + if not self.check_pics("RVCRUNM.S.F00"): + return True + + logging.info("RVCRUNM.S.F00: 1") + + cluster = Clusters.Objects.OnOff + attr = Clusters.OnOff.Attributes.StartUpOnOff + startUpOnOff = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attr) + logging.info("StartUpOnOff: %s" % (startUpOnOff)) + if startUpOnOff == NullValue or startUpOnOff == 0: + return True + + cluster = Clusters.Objects.RvcRunMode + attr = Clusters.RvcRunMode.Attributes.OnMode + onMode = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attr) + logging.info("OnMode: %s" % (onMode)) + if onMode == NullValue: + return True + + return False + @async_test_body async def test_TC_RVCRUNM_3_2(self): @@ -60,6 +84,12 @@ async def test_TC_RVCRUNM_3_2(self): asserts.assert_true(self.check_pics("RVCRUNM.S.C00.Rsp"), "RVCRUNM.S.C00.Rsp must be supported") asserts.assert_true(self.check_pics("RVCRUNM.S.C01.Tx"), "RVCRUNM.S.C01.Tx must be supported") + depOnOffKey = "RVCRUNM.S.F00" + asserts.assert_true(depOnOffKey in self.matter_test_config.pics, "%s must be provided" % (depOnOffKey)) + + ret = await self.check_preconditions(self.endpoint) + asserts.assert_true(ret, "invalid preconditions - StartUpMode overridden by OnMode") + attributes = Clusters.RvcRunMode.Attributes from enum import Enum