Renaming 'parameters' to 'input'
Change-Id: Ie20422d97d321a684b25f28068e3a64b77451da6
This commit is contained in:
@@ -152,20 +152,21 @@ class GetResult(command.Command):
|
||||
self.app.stdout.write(result or "\n")
|
||||
|
||||
|
||||
class GetParameters(command.Command):
|
||||
"""Show task parameters."""
|
||||
class GetInput(command.Command):
|
||||
"""Show task input."""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(GetParameters, self).get_parser(prog_name)
|
||||
parser = super(GetInput, self).get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'id',
|
||||
help='Task ID')
|
||||
help='Task ID'
|
||||
)
|
||||
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
result = tasks.TaskManager(self.app.client)\
|
||||
.get(parsed_args.id).parameters
|
||||
.get(parsed_args.id).input
|
||||
|
||||
try:
|
||||
result = json.loads(result)
|
||||
|
@@ -250,9 +250,8 @@ class MistralShell(app.App):
|
||||
'execution-update': mistralclient.commands.v2.executions.Update,
|
||||
'task-list': mistralclient.commands.v2.tasks.List,
|
||||
'task-get': mistralclient.commands.v2.tasks.Get,
|
||||
'task-get-input': mistralclient.commands.v2.tasks.GetInput,
|
||||
'task-get-output': mistralclient.commands.v2.tasks.GetOutput,
|
||||
'task-get-parameters':
|
||||
mistralclient.commands.v2.tasks.GetParameters,
|
||||
'task-get-result': mistralclient.commands.v2.tasks.GetResult,
|
||||
'task-update': mistralclient.commands.v2.tasks.Update,
|
||||
'action-list': mistralclient.commands.v2.actions.List,
|
||||
|
@@ -31,19 +31,19 @@ TASK_DICT = {
|
||||
}
|
||||
|
||||
TASK_RESULT = {"test": "is", "passed": "successfully"}
|
||||
TASK_PARAMETERS = {"param1": "val1", "param2": 2}
|
||||
TASK_INPUT = {"param1": "val1", "param2": 2}
|
||||
|
||||
TASK_WITH_RESULT_DICT = TASK_DICT.copy()
|
||||
TASK_WITH_RESULT_DICT.update({'result': json.dumps(TASK_RESULT)})
|
||||
TASK_WITH_OUTPUT_DICT = TASK_DICT.copy()
|
||||
TASK_WITH_OUTPUT_DICT.update({'output': json.dumps(TASK_RESULT)})
|
||||
TASK_WITH_PARAMETERS_DICT = TASK_DICT.copy()
|
||||
TASK_WITH_PARAMETERS_DICT.update({'parameters': json.dumps(TASK_PARAMETERS)})
|
||||
TASK_WITH_INPUT_DICT = TASK_DICT.copy()
|
||||
TASK_WITH_INPUT_DICT.update({'input': json.dumps(TASK_INPUT)})
|
||||
|
||||
TASK = tasks.Task(mock, TASK_DICT)
|
||||
TASK_WITH_RESULT = tasks.Task(mock, TASK_WITH_RESULT_DICT)
|
||||
TASK_WITH_OUTPUT = tasks.Task(mock, TASK_WITH_OUTPUT_DICT)
|
||||
TASK_WITH_PARAMETERS = tasks.Task(mock, TASK_WITH_PARAMETERS_DICT)
|
||||
TASK_WITH_INPUT = tasks.Task(mock, TASK_WITH_INPUT_DICT)
|
||||
|
||||
|
||||
class TestCLIT1asksV2(base.BaseCommandTest):
|
||||
@@ -94,10 +94,11 @@ class TestCLIT1asksV2(base.BaseCommandTest):
|
||||
json.dumps(TASK_RESULT, indent=4) + "\n")
|
||||
|
||||
@mock.patch('mistralclient.api.v2.tasks.TaskManager.get')
|
||||
def test_get_parameters(self, mock):
|
||||
mock.return_value = TASK_WITH_PARAMETERS
|
||||
def test_get_input(self, mock):
|
||||
mock.return_value = TASK_WITH_INPUT
|
||||
|
||||
self.call(task_cmd.GetParameters, app_args=['id'])
|
||||
self.call(task_cmd.GetInput, app_args=['id'])
|
||||
|
||||
self.app.stdout.write.assert_called_with(
|
||||
json.dumps(TASK_PARAMETERS, indent=4) + "\n")
|
||||
json.dumps(TASK_INPUT, indent=4) + "\n"
|
||||
)
|
||||
|
Reference in New Issue
Block a user