Skip to content

Commit

Permalink
Update UserPrompt to match legacy behavior if not expected value is s…
Browse files Browse the repository at this point in the history
…et in YAML
  • Loading branch information
krypton36 committed May 31, 2023
1 parent dd1a59a commit ec60d03
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,17 @@ class LogCommands(PseudoCluster):
definition = _DEFINITION

async def UserPrompt(self, request):
input_result = input("")
for value in request.arguments.get("values", []):
expected_value = None
for value in request.arguments.get("values", []):
if value.get('name') and 'expectedValue' in value['name']:
request.responses = [{"values": [{"name": "expectedValue", "value": value['value']}]}]
return {"value": {"expectedValue": input_result}}
return {}
expected_value = value['value']
request.responses = [{"values": [{"name": "expectedValue", "value": expected_value}]}]

if expected_value is not None:
input_result = input("")
return {"value": {"expectedValue": input_result}}

return {}

async def Log(self, request):
pass
5 changes: 2 additions & 3 deletions src/app/tests/suites/TestLogCommands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ tests:
- label: "Do a simple user prompt message. Expect 'y' to pass."
cluster: "LogCommands"
command: "UserPrompt"
PICS: PICS_USER_PROMPT
disabled: true
arguments:
values:
- name: "message"
Expand All @@ -50,7 +50,7 @@ tests:
- label: "Do a simple user prompt message. Use enter to coninue."
cluster: "LogCommands"
command: "UserPrompt"
PICS: PICS_USER_PROMPT
disabled: true
arguments:
values:
- name: "message"
Expand All @@ -61,7 +61,6 @@ tests:
- label: "Do a simple user prompt message"
cluster: "LogCommands"
command: "UserPrompt"
PICS: PICS_USER_PROMPT
arguments:
values:
- name: "message"
Expand Down

0 comments on commit ec60d03

Please sign in to comment.