Skip to content

Commit

Permalink
TC-VALCC-4.2: unconditionally write open duration
Browse files Browse the repository at this point in the history
This way we can ensure the open duration is writeable.
Also add a cleanup step.
  • Loading branch information
cecille committed Sep 30, 2024
1 parent f509f67 commit ba7c499
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/python_testing/TC_VALCC_4_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def steps_TC_VALCC_4_2(self) -> list[TestStep]:
TestStep(8, "Send Close command"),
TestStep(9, "Read OpenDuration attribute"),
TestStep(10, "Read RemainingDuration attribute"),
TestStep(11, "Write DefaultOpenDuration back to original value")
]
return steps

Expand All @@ -73,16 +74,11 @@ async def test_TC_VALCC_4_2(self):
attributes = Clusters.ValveConfigurationAndControl.Attributes

self.step("2a")
defaultOpenDuration = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.DefaultOpenDuration)
originalDefaultOpenDuration = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.DefaultOpenDuration)

self.step("2b")
if defaultOpenDuration is NullValue:
defaultOpenDuration = 60

result = await self.default_controller.WriteAttribute(self.dut_node_id, [(endpoint, attributes.DefaultOpenDuration(defaultOpenDuration))])
asserts.assert_equal(result[0].Status, Status.Success, "DefaultOpenDuration write failed")
else:
logging.info("Test step skipped")
defaultOpenDuration = 60
await self.write_single_attribute(attributes.DefaultOpenDuration(defaultOpenDuration))

self.step(3)
try:
Expand Down Expand Up @@ -129,6 +125,9 @@ async def test_TC_VALCC_4_2(self):
remaining_duration_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.RemainingDuration)
asserts.assert_true(remaining_duration_dut is NullValue, "RemainingDuration is not null")

self.step(11)
await self.write_single_attribute(attributes.DefaultOpenDuration(originalDefaultOpenDuration))


if __name__ == "__main__":
default_matter_test_main()

0 comments on commit ba7c499

Please sign in to comment.