Skip to content

Commit 3791a5a

Browse files
author
Juan Erasmo Trejo
committed
Fixed fail status for command execution. Minor standard issues fixed
1 parent d73d33f commit 3791a5a

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

src/python_testing/TC_REFALM_2_2.py

+33-33
Original file line numberDiff line numberDiff line change
@@ -102,29 +102,29 @@ def pics_TC_REFALM_2_2(self):
102102
def steps_TC_REFALM_2_2(self) -> list[TestStep]:
103103
"""Execute the test steps."""
104104
steps = [
105-
TestStep( 1, "Commission DUT to TH (can be skipped if done in a preceding test)",is_commissioning=True),
106-
TestStep( 2, "Ensure that the door on the DUT is closed"),
107-
TestStep( 3, "TH reads from the DUT the State attribute"),
108-
TestStep( 4, "Manually open the door on the DUT"),
109-
TestStep( 5, "Wait for the time defined in PIXIT.REFALM.AlarmThreshold"),
110-
TestStep( 6, "TH reads from the DUT the State attribute"),
111-
TestStep( 7, "Ensure that the door on the DUT is closed"),
112-
TestStep( 8, "TH reads from the DUT the State attribute"),
113-
TestStep( 9, "TH sends Reset command to the DUT"),
114-
TestStep( 10, "TH sends ModifyEnabledAlarms command to the DUT"),
115-
TestStep( 11, "Set up subscription to the Notify event"),
116-
TestStep( "12.a", "Repeating step 4 Manually open the door on the DUT"),
117-
TestStep( "12.b", "Step 12b: Repeat step 5 Wait for the time defined in PIXIT.REFALM.AlarmThreshold"),
118-
TestStep( "12.c", "After step 5 (repeated), receive a Notify event with the State attribute bit 0 set to 1."),
119-
TestStep( "13.a", "Repeat step 7 Ensure that the door on the DUT is closed"),
120-
TestStep( "13.b", "Receive a Notify event with the State attribute bit 0 set to 0"),
105+
TestStep(1, "Commission DUT to TH (can be skipped if done in a preceding test)", is_commissioning=True),
106+
TestStep(2, "Ensure that the door on the DUT is closed"),
107+
TestStep(3, "TH reads from the DUT the State attribute"),
108+
TestStep(4, "Manually open the door on the DUT"),
109+
TestStep(5, "Wait for the time defined in PIXIT.REFALM.AlarmThreshold"),
110+
TestStep(6, "TH reads from the DUT the State attribute"),
111+
TestStep(7, "Ensure that the door on the DUT is closed"),
112+
TestStep(8, "TH reads from the DUT the State attribute"),
113+
TestStep(9, "TH sends Reset command to the DUT"),
114+
TestStep(10, "TH sends ModifyEnabledAlarms command to the DUT"),
115+
TestStep(11, "Set up subscription to the Notify event"),
116+
TestStep("12.a", "Repeating step 4 Manually open the door on the DUT"),
117+
TestStep("12.b", "Step 12b: Repeat step 5 Wait for the time defined in PIXIT.REFALM.AlarmThreshold"),
118+
TestStep("12.c", "After step 5 (repeated), receive a Notify event with the State attribute bit 0 set to 1."),
119+
TestStep("13.a", "Repeat step 7 Ensure that the door on the DUT is closed"),
120+
TestStep("13.b", "Receive a Notify event with the State attribute bit 0 set to 0"),
121121
]
122122

123123
return steps
124124

125-
async def get_command_status(self,cmd: ClusterCommand,cmd_str:str=""):
126-
"""Return the status of the executed command.By default the status is 0x0 unless a different
127-
status on InteractionModel is returned."""
125+
async def _get_command_status(self,cmd: ClusterCommand,cmd_str:str=""):
126+
"""Return the status of the executed command. By default the status is 0x0 unless a different
127+
status on InteractionModel is returned. For this test we consider the status 0x0 as not succesfull."""
128128
cmd_status = Status.Success
129129
if self.is_ci:
130130
try:
@@ -133,9 +133,11 @@ async def get_command_status(self,cmd: ClusterCommand,cmd_str:str=""):
133133
cmd_status = uc.status
134134
else:
135135
user_response = self.wait_for_user_input(prompt_msg=f"{cmd_str} command is implemented in the DUT?. Enter 'y' or 'n' to confirm.",
136-
prompt_msg_placeholder="y",
137-
default_value="y")
136+
default_value="n")
138137
asserts.assert_equal(user_response.lower(), "n")
138+
if user_response.lower() == "n":
139+
cmd_status = Status.UnsupportedCommand
140+
139141
return cmd_status
140142

141143

@@ -144,8 +146,7 @@ def _ask_for_closed_door(self):
144146
self._send_close_door_commnad()
145147
sleep(1)
146148
else:
147-
user_response = self.wait_for_user_input(prompt_msg=f"Ensure that the door on the DUT is closed. Enter 'y' or 'n' after completition",
148-
prompt_msg_placeholder="y",
149+
user_response = self.wait_for_user_input(prompt_msg=f"Ensure that the door on the DUT is closed.",
149150
default_value="y")
150151
asserts.assert_equal(user_response.lower(), "y")
151152

@@ -154,19 +155,18 @@ def _ask_for_open_door(self):
154155
self._send_open_door_command()
155156
else:
156157
user_response = self.wait_for_user_input(prompt_msg=f"Manually open the door on the DUT. Enter 'y' or 'n' after completition",
157-
prompt_msg_placeholder="y",
158158
default_value="y")
159159
asserts.assert_equal(user_response.lower(), "y")
160160

161-
async def read_refalm_state_attribute(self):
161+
async def _read_refalm_state_attribute(self):
162162
cluster = Clusters.Objects.RefrigeratorAlarm
163163
return await self.read_single_attribute_check_success(
164164
endpoint=self.endpoint,
165165
cluster=cluster,
166166
attribute=Clusters.RefrigeratorAlarm.Attributes.State
167167
)
168168

169-
def wait_thresshold(self):
169+
def _wait_thresshold(self):
170170
sleep(self.wait_thresshold_v/1000)
171171

172172
def _send_named_pipe_command(self, command_dict: dict[str, Any]):
@@ -209,7 +209,7 @@ async def test_TC_REFALM_2_2(self):
209209

210210
self.step(3)
211211
# reads the state attribute , must be a bitMap32 ( list wich values are 32 bits)
212-
device_state = await self.read_refalm_state_attribute()
212+
device_state = await self._read_refalm_state_attribute()
213213
logger.info(f"The device state is {device_state}")
214214
asserts.assert_equal(device_state,0)
215215

@@ -220,11 +220,11 @@ async def test_TC_REFALM_2_2(self):
220220

221221
# wait PIXIT.REFALM.AlarmThreshold (5s)
222222
self.step(5)
223-
self.wait_thresshold()
223+
self._wait_thresshold()
224224

225225
# # read the status
226226
self.step(6)
227-
device_state = await self.read_refalm_state_attribute()
227+
device_state = await self._read_refalm_state_attribute()
228228
logger.info(f"The device state is {device_state}")
229229
asserts.assert_equal(device_state,1)
230230

@@ -234,16 +234,16 @@ async def test_TC_REFALM_2_2(self):
234234

235235
# # read from the state attr
236236
self.step(8)
237-
device_status = await self.read_refalm_state_attribute()
237+
device_status = await self._read_refalm_state_attribute()
238238
logger.info(f"The device state is {device_state}")
239239
asserts.assert_equal(device_status,0)
240240

241241
self.step(9)
242-
cmd_status = await self.get_command_status(cmd=FakeReset(),cmd_str="Reset")
242+
cmd_status = await self._get_command_status(cmd=FakeReset(),cmd_str="Reset")
243243
asserts.assert_equal(Status.UnsupportedCommand,cmd_status, msg=f"Command status is not {Status.UnsupportedCommand}, is {cmd_status}")
244244

245245
self.step(10)
246-
cmd_status = await self.get_command_status(cmd=FakeModifyEnabledAlarms(),cmd_str="ModifyEnabledAlarms")
246+
cmd_status = await self._get_command_status(cmd=FakeModifyEnabledAlarms(),cmd_str="ModifyEnabledAlarms")
247247
asserts.assert_equal(Status.UnsupportedCommand,cmd_status,msg=f"Command status is not {Status.UnsupportedCommand}, is {cmd_status}")
248248

249249

@@ -260,7 +260,7 @@ async def test_TC_REFALM_2_2(self):
260260
self._ask_for_open_door()
261261

262262
self.step("12.b")
263-
self.wait_thresshold()
263+
self._wait_thresshold()
264264

265265
self.step("12.c")
266266
# Wait for the Notify event with the State value.

0 commit comments

Comments
 (0)