Skip to content

Commit

Permalink
fix RVC Mode clusters' TC 3-2: add precondition check (#29016)
Browse files Browse the repository at this point in the history
* fix TC 3-2

* fix lint issues

* use 'not' instead of 'is False'
  • Loading branch information
plauric authored and pull[bot] committed Dec 14, 2023
1 parent de36d07 commit 8a0ac72
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/python_testing/TC_RVCCLEANM_3_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand All @@ -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
Expand Down
30 changes: 30 additions & 0 deletions src/python_testing/TC_RVCRUNM_3_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand All @@ -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
Expand Down

0 comments on commit 8a0ac72

Please sign in to comment.