forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTC_TCCM_1_2.py
108 lines (89 loc) · 4.03 KB
/
TC_TCCM_1_2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#
# Copyright (c) 2024 Project CHIP Authors
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# === BEGIN CI TEST ARGUMENTS ===
# test-runner-runs:
# run1:
# app: ${ENERGY_MANAGEMENT_APP}
# app-args: >
# --discriminator 1234
# --KVS kvs1
# --trace-to json:${TRACE_APP}.json
# --enable-key 000102030405060708090a0b0c0d0e0f
# --application water-heater
# script-args: >
# --storage-path admin_storage.json
# --commissioning-method on-network
# --discriminator 1234
# --passcode 20202021
# --hex-arg enableKey:000102030405060708090a0b0c0d0e0f
# --endpoint 2
# --trace-to json:${TRACE_TEST_JSON}.json
# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
# factory-reset: true
# quiet: true
# === END CI TEST ARGUMENTS ===
from tc_mode_base import ClusterModeCheck
import chip.clusters as Clusters
from chip.testing.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
class TC_TCCM_1_2(MatterBaseTest, ClusterModeCheck):
def __init__(self, *args):
super().__init__(*args)
ClusterModeCheck.__init__(self,
requested_cluster=Clusters.RefrigeratorAndTemperatureControlledCabinetMode)
def desc_TC_TCCM_1_2(self) -> str:
return "[TC-TCCM-1.2] Cluster attributes with DUT as Server"
def steps_TC_TCCM_1_2(self) -> list[TestStep]:
steps = [
TestStep(1, "Commissioning, already done", is_commissioning=True),
TestStep(2, "TH reads from the DUT the SupportedModes attribute."),
TestStep(3, "TH reads from the DUT the CurrentMode attribute."),
TestStep(4, "TH reads from the DUT the OnMode attribute."),
TestStep(5, "TH reads from the DUT the StartUpMode attribute.")
]
return steps
def pics_TC_TCCM_1_2(self) -> list[str]:
pics = [
"TCCM.S"
]
return pics
@async_test_body
async def test_TC_TCCM_1_2(self):
# Setup common mode check
endpoint = self.get_endpoint(default=1)
self.step(1)
self.step(2)
# Verify common checks for Mode Base as described in the TC-TCCM-1.2
await self.check_supported_modes_and_labels(endpoint=endpoint)
# According to the spec, there should be at least one RapidCool or RapidFreeze tag in
# the ones supported.
additional_tags = [Clusters.RefrigeratorAndTemperatureControlledCabinetMode.Enums.ModeTag.kRapidCool,
Clusters.RefrigeratorAndTemperatureControlledCabinetMode.Enums.ModeTag.kRapidFreeze]
self.check_tags_in_lists(requiredtags=additional_tags)
self.step(3)
# Verify that the CurrentMode attribute has a valid value.
mode = Clusters.RefrigeratorAndTemperatureControlledCabinetMode.Attributes.CurrentMode
await self.read_and_check_mode(endpoint=endpoint, mode=mode)
self.step(4)
# Verify that the OnMode attribute has a valid value or null.
mode = Clusters.RefrigeratorAndTemperatureControlledCabinetMode.Attributes.OnMode
await self.read_and_check_mode(endpoint=endpoint, mode=mode, is_nullable=True)
self.step(5)
# Verify that the StartUpMode has a valid value or null
mode = Clusters.RefrigeratorAndTemperatureControlledCabinetMode.Attributes.StartUpMode
await self.read_and_check_mode(endpoint=endpoint, mode=mode, is_nullable=True)
if __name__ == "__main__":
default_matter_test_main()