Skip to content

Commit

Permalink
Updated YAML Parser code to consider wait as command (#28818)
Browse files Browse the repository at this point in the history
  • Loading branch information
rquidute authored and pull[bot] committed Nov 14, 2023
1 parent 82bcb7b commit 2245349
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ def decode(self, payload):
clusterId = json_response[_CLUSTER_ID]
decoded_response[_COMMAND] = self.__definitions.get_response_name(
clusterId, value)
if not decoded_response[_COMMAND]:
decoded_response[_COMMAND] = self.__definitions.get_command_name(clusterId, value)
elif key == _ATTRIBUTE_ID:
clusterId = json_response[_CLUSTER_ID]
decoded_response[_ATTRIBUTE] = self.__definitions.get_attribute_name(
Expand Down
8 changes: 7 additions & 1 deletion scripts/py_matter_yamltests/matter_yamltests/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ def __init__(self, test: dict, config: dict, definitions: SpecDefinitions, pics_
self.group_id = _value_or_config(test, 'groupId', config)
self.cluster = _value_or_config(test, 'cluster', config)
self.command = _value_or_config(test, 'command', config)
if not self.command:
self.command = _value_or_config(test, 'wait', config)
self.attribute = _value_or_none(test, 'attribute')
self.event = _value_or_none(test, 'event')
self.endpoint = _value_or_config(test, 'endpoint', config)
Expand Down Expand Up @@ -786,8 +788,12 @@ def _response_cluster_wait_validation(self, received_responses, result):
expected_wait_type
]

wait_for_str = received_response.get('wait_for')
if not wait_for_str:
wait_for_str = received_response.get('command')

received_values = [
received_response.get('wait_for'),
wait_for_str,
received_response.get('endpoint'),
received_response.get('cluster'),
received_wait_type
Expand Down
6 changes: 4 additions & 2 deletions scripts/py_matter_yamltests/matter_yamltests/yaml_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,9 @@ def __rule_response_variable_should_exist_in_config(self, config, content):

def __rule_argument_value_is_only_when_writing_attributes(self, content):
if 'arguments' in content:
command = content.get('command')
operation = content.get('command')
if not operation:
operation = content.get('wait')
arguments = content.get('arguments')
if 'value' in arguments and command != 'writeAttribute':
if 'value' in arguments and operation != 'writeAttribute':
raise TestStepArgumentsValueError(content)

0 comments on commit 2245349

Please sign in to comment.