Skip to content

Commit a718957

Browse files
[Fix] Updating TC_ACL_2_5 test steps to attribute_guard wrap extension attribute (project-chip#41185)
* [Fix] Updating TC_ACL_2_5 test steps to attribute_guard wrap extension attribute - If the extension attribute does not exist on the specified endpoint during testing then test steps 3-13 are skipped * Restyled by autopep8 * Changed to using @run_if_endpoint_matches(has_attribute(Clusters.AccessControl.Attributes.Extension)) since a majority of the test steps in this test module require the AccessControl extension attribute * resolving linting error * Restyled by autopep8 * Updated to include pics_ function with the specified attribute from the test plan --------- Co-authored-by: Restyled.io <[email protected]>
1 parent a85799d commit a718957

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/python_testing/TC_ACL_2_5.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,10 @@
3939
import matter.clusters as Clusters
4040
from matter.interaction_model import Status
4141
from matter.testing.event_attribute_reporting import EventSubscriptionHandler
42-
from matter.testing.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
42+
from matter.testing.matter_testing import MatterBaseTest, TestStep, default_matter_test_main, has_attribute, run_if_endpoint_matches
4343

4444

4545
class TC_ACL_2_5(MatterBaseTest):
46-
4746
async def write_attribute_with_encoding_option(self, controller, node_id, path, forceLegacyListEncoding):
4847
if forceLegacyListEncoding:
4948
return await controller.TestOnlyWriteAttributeWithLegacyList(node_id, path)
@@ -53,11 +52,13 @@ async def write_attribute_with_encoding_option(self, controller, node_id, path,
5352
async def internal_test_TC_ACL_2_5(self, force_legacy_encoding: bool):
5453
self.step(1)
5554
self.th1 = self.default_controller
55+
self.endpoint = self.get_endpoint()
5656

5757
self.step(2)
5858
oc_cluster = Clusters.OperationalCredentials
5959
cfi_attribute = oc_cluster.Attributes.CurrentFabricIndex
6060
f1 = await self.read_single_attribute_check_success(endpoint=0, cluster=oc_cluster, attribute=cfi_attribute)
61+
extension_attr = Clusters.AccessControl.Attributes.Extension
6162

6263
self.step(3)
6364
# Read initial AccessControlClusterExtension
@@ -89,7 +90,6 @@ async def internal_test_TC_ACL_2_5(self, force_legacy_encoding: bool):
8990

9091
# Write the extension to the device - properly wrap the extensions list
9192
logging.info(f"Writing extension with data {D_OK_EMPTY.hex()}")
92-
extension_attr = Clusters.AccessControl.Attributes.Extension
9393
extensions_list = [extension]
9494
result = await self.write_attribute_with_encoding_option(
9595
self.default_controller,
@@ -120,11 +120,6 @@ async def internal_test_TC_ACL_2_5(self, force_legacy_encoding: bool):
120120
asserts.assert_equal(len(direct_events), 1, "Expected exactly one event from direct read")
121121
direct_event = direct_events[0]
122122

123-
# Log the event structures to help debug
124-
logging.info(f"direct event: {direct_event}")
125-
logging.info(f"Direct event structure: {dir(direct_event)}")
126-
logging.info(f"Subscription event structure: {dir(subscription_event)}")
127-
128123
# Verify both methods return the same event data
129124
logging.info(f"Comparing subscription event: {subscription_event} with direct event: {direct_event}")
130125
asserts.assert_equal(subscription_event, direct_event.Data, "Subscription event should be in direct event")
@@ -412,6 +407,9 @@ async def get_latest_event_number(self, acec_event: Clusters.AccessControl.Event
412407
events = await self.default_controller.ReadEvent(nodeid=self.dut_node_id, events=event_path)
413408
return max([e.Header.EventNumber for e in events])
414409

410+
def pics_TC_ACL_2_5(self) -> list[str]:
411+
return ['ACL.S.A0001']
412+
415413
def desc_TC_ACL_2_5(self) -> str:
416414
return "[TC-ACL-2.5] AccessControlExtensionChanged event"
417415

@@ -445,7 +443,7 @@ def steps_TC_ACL_2_5(self) -> list[TestStep]:
445443
]
446444
return steps
447445

448-
@ async_test_body
446+
@run_if_endpoint_matches(has_attribute(Clusters.AccessControl.Attributes.Extension))
449447
async def test_TC_ACL_2_5(self):
450448
await self.internal_test_TC_ACL_2_5(force_legacy_encoding=False)
451449
self.current_step_index = 0

0 commit comments

Comments
 (0)