Skip to content

Commit e4fa99c

Browse files
committed
example
1 parent 44c725d commit e4fa99c

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

src/python_testing/testbed.py

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#
2+
# Copyright (c) 2024 Project CHIP Authors
3+
# All rights reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
import chip.clusters as Clusters
19+
import chip.clusters.ClusterObjects as ClusterObjects
20+
from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main, per_node_test
21+
from chip.interaction_model import Status
22+
from basic_composition_support import BasicCompositionTests
23+
import global_attribute_ids
24+
25+
26+
class testbed(MatterBaseTest, BasicCompositionTests):
27+
@async_test_body
28+
async def setup_class(self):
29+
self.user_params["use_pase_only"] = False
30+
super().setup_class()
31+
await self.setup_class_helper()
32+
33+
@per_node_test
34+
async def test_testbed(self):
35+
for endpoint_id, endpoint in self.endpoints.items():
36+
for cluster_type, cluster in endpoint.items():
37+
if global_attribute_ids.cluster_id_type(cluster_type.id) != global_attribute_ids.ClusterIdType.kStandard:
38+
continue
39+
40+
all_attrs = set(list(ClusterObjects.ALL_ATTRIBUTES[cluster_type.id].keys()))
41+
dut_attrs = set(cluster[cluster_type.Attributes.AttributeList])
42+
43+
unsupported = [id for id in list(all_attrs - dut_attrs) if global_attribute_ids.attribute_id_type(id) == global_attribute_ids.AttributeIdType.kStandardNonGlobal]
44+
45+
if unsupported:
46+
await self.read_single_attribute_expect_error(endpoint=endpoint_id, cluster=cluster_type, attribute=ClusterObjects.ALL_ATTRIBUTES[cluster_type.id][unsupported[0]], error=Status.UnsupportedAttribute)
47+
48+
49+
50+
if __name__ == "__main__":
51+
default_matter_test_main()

0 commit comments

Comments
 (0)