23
23
from matter_testing_support import MatterBaseTest , async_test_body , default_matter_test_main , type_matches
24
24
from mobly import asserts
25
25
26
- # This test requires several additional command line arguments
27
- # run with
28
- # --int-arg PIXIT_ENDPOINT:<endpoint>
29
-
30
26
31
27
# Takes an OpState or RvcOpState state enum and returns a string representation
32
28
def state_enum_to_text (state_enum ):
@@ -82,20 +78,20 @@ def pics_TC_RVCOPSTATE_2_3(self) -> list[str]:
82
78
class TC_RVCOPSTATE_2_3 (MatterBaseTest ):
83
79
84
80
def __init__ (self , * args ):
85
- super ().__init__ (args )
86
- self .endpoint = 0
81
+ super ().__init__ (* args )
82
+ self .endpoint = None
87
83
88
84
async def read_mod_attribute_expect_success (self , endpoint , attribute ):
89
85
cluster = Clusters .Objects .RvcOperationalState
90
86
return await self .read_single_attribute_check_success (endpoint = endpoint , cluster = cluster , attribute = attribute )
91
87
92
- async def send_pause_cmd (self ) -> Clusters .Objects .RvcOperationalState .Commands .Pause :
88
+ async def send_pause_cmd (self ) -> Clusters .Objects .RvcOperationalState .Commands .OperationalCommandResponse :
93
89
ret = await self .send_single_cmd (cmd = Clusters .Objects .RvcOperationalState .Commands .Pause (), endpoint = self .endpoint )
94
90
asserts .assert_true (type_matches (ret , Clusters .Objects .RvcOperationalState .Commands .OperationalCommandResponse ),
95
91
"Unexpected return type for Pause" )
96
92
return ret
97
93
98
- async def send_resume_cmd (self ) -> Clusters .Objects .RvcOperationalState .Commands .Resume :
94
+ async def send_resume_cmd (self ) -> Clusters .Objects .RvcOperationalState .Commands .OperationalCommandResponse :
99
95
ret = await self .send_single_cmd (cmd = Clusters .Objects .RvcOperationalState .Commands .Resume (), endpoint = self .endpoint )
100
96
asserts .assert_true (type_matches (ret , Clusters .Objects .RvcOperationalState .Commands .OperationalCommandResponse ),
101
97
"Unexpected return type for Resume" )
@@ -108,23 +104,23 @@ async def read_operational_state_with_check(self, step_number, expected_state):
108
104
endpoint = self .endpoint , attribute = Clusters .RvcOperationalState .Attributes .OperationalState )
109
105
logging .info ("OperationalState: %s" % operational_state )
110
106
asserts .assert_equal (operational_state , expected_state ,
111
- "OperationalState(%s) should be %s" % operational_state , state_enum_to_text (expected_state ))
107
+ "OperationalState(%s) should be %s" % ( operational_state , state_enum_to_text (expected_state ) ))
112
108
113
109
# Sends the Pause command and checks that the returned error matches the expected_error
114
110
async def send_pause_cmd_with_check (self , step_number , expected_error ):
115
111
self .print_step (step_number , "Send Pause command" )
116
- ret = self .send_pause_cmd ()
112
+ ret = await self .send_pause_cmd ()
117
113
asserts .assert_equal (ret .commandResponseState .errorStateID , expected_error ,
118
- "errorStateID(%s) should be %s" % ret .commandResponseState .errorStateID ,
119
- error_enum_to_text (expected_error ))
114
+ "errorStateID(%s) should be %s" % ( ret .commandResponseState .errorStateID ,
115
+ error_enum_to_text (expected_error ) ))
120
116
121
117
# Sends the Resume command and checks that the returned error matches the expected_error
122
118
async def send_resume_cmd_with_check (self , step_number , expected_error ):
123
119
self .print_step (step_number , "Send Pause command" )
124
- ret = self .send_resume_cmd ()
120
+ ret = await self .send_resume_cmd ()
125
121
asserts .assert_equal (ret .commandResponseState .errorStateID , expected_error ,
126
- "errorStateID(%s) should be %s" % ret .commandResponseState .errorStateID ,
127
- error_enum_to_text (expected_error ))
122
+ "errorStateID(%s) should be %s" % ( ret .commandResponseState .errorStateID ,
123
+ error_enum_to_text (expected_error ) ))
128
124
129
125
# Prints the instruction and waits for a user input to continue
130
126
def print_instruction (self , step_number , instruction ):
@@ -134,18 +130,15 @@ def print_instruction(self, step_number, instruction):
134
130
@async_test_body
135
131
async def test_TC_RVCOPSTATE_2_3 (self ):
136
132
137
- asserts .assert_true ('PIXIT_ENDPOINT' in self .matter_test_config .global_test_params ,
138
- "PIXIT_ENDPOINT must be included on the command line in "
139
- "the --int-arg flag as PIXIT_ENDPOINT:<endpoint>" )
140
-
141
- self .endpoint = self .matter_test_config .global_test_params ['PIXIT_ENDPOINT' ]
133
+ self .endpoint = self .matter_test_config .endpoint
134
+ asserts .assert_false (self .endpoint is None , "--endpoint <endpoint> must be included on the command line in." )
142
135
143
136
asserts .assert_true (self .check_pics ("RVCOPSTATE.S.A0003" ), "RVCOPSTATE.S.A0003 must be supported" )
144
137
asserts .assert_true (self .check_pics ("RVCOPSTATE.S.A0004" ), "RVCOPSTATE.S.A0004 must be supported" )
145
138
asserts .assert_true (self .check_pics ("RVCOPSTATE.S.C00.Rsp" ), "RVCOPSTATE.S.C00.Rsp must be supported" )
146
139
asserts .assert_true (self .check_pics ("RVCOPSTATE.S.C03.Rsp" ), "RVCOPSTATE.S.C03.Rsp must be supported" )
147
140
# This command SHALL be supported by an implementation if any of the other commands are supported (6.5)
148
- asserts .assert_true (self .check_pics ("RVCOPSTATE.S.C04.Rsp " ), "RVCOPSTATE.S.C04.Rsp must be supported" )
141
+ asserts .assert_true (self .check_pics ("RVCOPSTATE.S.C04.Tx " ), "RVCOPSTATE.S.C04.Tx must be supported" )
149
142
150
143
attributes = Clusters .RvcOperationalState .Attributes
151
144
op_states = Clusters .OperationalState .Enums .OperationalStateEnum
@@ -208,7 +201,7 @@ async def test_TC_RVCOPSTATE_2_3(self):
208
201
attribute = attributes .OperationalState )
209
202
logging .info ("OperationalState: %s" % operational_state )
210
203
asserts .assert_equal (operational_state , old_opstate_dut ,
211
- "OperationalState(%s) should be the state before pause (%s)" % operational_state , old_opstate_dut )
204
+ "OperationalState(%s) should be the state before pause (%s)" % ( operational_state , old_opstate_dut ) )
212
205
213
206
await self .send_resume_cmd_with_check (13 , op_errors .kNoError )
214
207
0 commit comments