Skip to content

Commit 623b618

Browse files
cecilleandy31415fessehaeve
authored andcommitted
TC-VALCC-4.2: unconditionally write open duration (project-chip#35852)
* TC-VALCC-4.2: unconditionally write open duration This way we can ensure the open duration is writeable. Also add a cleanup step. * linter * Update src/python_testing/TC_VALCC_4_2.py Co-authored-by: fesseha-eve <88329315+fessehaeve@users.noreply.github.com> * Update src/python_testing/TC_VALCC_4_2.py Co-authored-by: fesseha-eve <88329315+fessehaeve@users.noreply.github.com> --------- Co-authored-by: Andrei Litvin <andy314@gmail.com> Co-authored-by: fesseha-eve <88329315+fessehaeve@users.noreply.github.com>
1 parent 29ff129 commit 623b618

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/python_testing/TC_VALCC_4_2.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
2525
# === END CI TEST ARGUMENTS ===
2626

27-
import logging
2827
import time
2928

3029
import chip.clusters as Clusters
@@ -55,6 +54,7 @@ def steps_TC_VALCC_4_2(self) -> list[TestStep]:
5554
TestStep(8, "Send Close command"),
5655
TestStep(9, "Read OpenDuration attribute"),
5756
TestStep(10, "Read RemainingDuration attribute"),
57+
TestStep(11, "Write DefaultOpenDuration back to original value")
5858
]
5959
return steps
6060

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

7575
self.step("2a")
76-
defaultOpenDuration = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.DefaultOpenDuration)
76+
originalDefaultOpenDuration = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.DefaultOpenDuration)
7777

7878
self.step("2b")
79-
if defaultOpenDuration is NullValue:
80-
defaultOpenDuration = 60
81-
82-
result = await self.default_controller.WriteAttribute(self.dut_node_id, [(endpoint, attributes.DefaultOpenDuration(defaultOpenDuration))])
83-
asserts.assert_equal(result[0].Status, Status.Success, "DefaultOpenDuration write failed")
84-
else:
85-
logging.info("Test step skipped")
79+
defaultOpenDuration = 60
80+
await self.write_single_attribute(attributes.DefaultOpenDuration(defaultOpenDuration), endpoint_id=endpoint)
8681

8782
self.step(3)
8883
try:
@@ -129,6 +124,9 @@ async def test_TC_VALCC_4_2(self):
129124
remaining_duration_dut = await self.read_valcc_attribute_expect_success(endpoint=endpoint, attribute=attributes.RemainingDuration)
130125
asserts.assert_true(remaining_duration_dut is NullValue, "RemainingDuration is not null")
131126

127+
self.step(11)
128+
await self.write_single_attribute(attributes.DefaultOpenDuration(originalDefaultOpenDuration), endpoint_id=endpoint)
129+
132130

133131
if __name__ == "__main__":
134132
default_matter_test_main()

0 commit comments

Comments
 (0)