From b131d60be51271553673c7b4ad7541e578988da4 Mon Sep 17 00:00:00 2001 From: Renat Akhmerov Date: Sun, 21 Sep 2014 21:57:34 -0700 Subject: [PATCH] Renaming 'parameters' to 'input' Change-Id: Ie20422d97d321a684b25f28068e3a64b77451da6 --- mistralclient/commands/v2/tasks.py | 11 ++++++----- mistralclient/shell.py | 3 +-- mistralclient/tests/unit/v2/test_cli_tasks.py | 17 +++++++++-------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/mistralclient/commands/v2/tasks.py b/mistralclient/commands/v2/tasks.py index c8eebe3f..67efdd2c 100644 --- a/mistralclient/commands/v2/tasks.py +++ b/mistralclient/commands/v2/tasks.py @@ -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) diff --git a/mistralclient/shell.py b/mistralclient/shell.py index da1d1b59..9c4816b2 100644 --- a/mistralclient/shell.py +++ b/mistralclient/shell.py @@ -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, diff --git a/mistralclient/tests/unit/v2/test_cli_tasks.py b/mistralclient/tests/unit/v2/test_cli_tasks.py index 31d3e433..141e7a09 100644 --- a/mistralclient/tests/unit/v2/test_cli_tasks.py +++ b/mistralclient/tests/unit/v2/test_cli_tasks.py @@ -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" + )