diff --git a/mistralclient/commands/v2/tasks.py b/mistralclient/commands/v2/tasks.py index 7854836c..43f3a8d5 100644 --- a/mistralclient/commands/v2/tasks.py +++ b/mistralclient/commands/v2/tasks.py @@ -112,21 +112,20 @@ class GetResult(command.Command): self.app.stdout.write(result or "\n") -class GetInput(command.Command): - """Show task input.""" +class GetPublished(command.Command): + """Show task published variables.""" def get_parser(self, prog_name): - parser = super(GetInput, self).get_parser(prog_name) + parser = super(GetPublished, 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).input + parsed_args.id).published try: result = json.loads(result) diff --git a/mistralclient/shell.py b/mistralclient/shell.py index fecb33df..403dab11 100644 --- a/mistralclient/shell.py +++ b/mistralclient/shell.py @@ -283,7 +283,7 @@ class MistralShell(app.App): mistralclient.commands.v2.executions.GetOutput, 'task-list': mistralclient.commands.v2.tasks.List, 'task-get': mistralclient.commands.v2.tasks.Get, - 'task-get-input': mistralclient.commands.v2.tasks.GetInput, + 'task-get-published': mistralclient.commands.v2.tasks.GetPublished, 'task-get-result': mistralclient.commands.v2.tasks.GetResult, 'action-list': mistralclient.commands.v2.actions.List, 'action-get': mistralclient.commands.v2.actions.Get, diff --git a/mistralclient/tests/unit/v2/test_cli_tasks.py b/mistralclient/tests/unit/v2/test_cli_tasks.py index c9ecdeef..b27c41f2 100644 --- a/mistralclient/tests/unit/v2/test_cli_tasks.py +++ b/mistralclient/tests/unit/v2/test_cli_tasks.py @@ -31,16 +31,16 @@ TASK_DICT = { } TASK_RESULT = {"test": "is", "passed": "successfully"} -TASK_INPUT = {"param1": "val1", "param2": 2} +TASK_PUBLISHED = {"bar1": "val1", "var2": 2} TASK_WITH_RESULT_DICT = TASK_DICT.copy() TASK_WITH_RESULT_DICT.update({'result': json.dumps(TASK_RESULT)}) -TASK_WITH_INPUT_DICT = TASK_DICT.copy() -TASK_WITH_INPUT_DICT.update({'input': json.dumps(TASK_INPUT)}) +TASK_WITH_PUBLISHED_DICT = TASK_DICT.copy() +TASK_WITH_PUBLISHED_DICT.update({'published': json.dumps(TASK_PUBLISHED)}) TASK = tasks.Task(mock, TASK_DICT) TASK_WITH_RESULT = tasks.Task(mock, TASK_WITH_RESULT_DICT) -TASK_WITH_INPUT = tasks.Task(mock, TASK_WITH_INPUT_DICT) +TASK_WITH_PUBLISHED = tasks.Task(mock, TASK_WITH_PUBLISHED_DICT) class TestCLITasksV2(base.BaseCommandTest): @@ -81,11 +81,11 @@ class TestCLITasksV2(base.BaseCommandTest): json.dumps(TASK_RESULT, indent=4) + "\n") @mock.patch('mistralclient.api.v2.tasks.TaskManager.get') - def test_get_input(self, mock): - mock.return_value = TASK_WITH_INPUT + def test_get_published(self, mock): + mock.return_value = TASK_WITH_PUBLISHED - self.call(task_cmd.GetInput, app_args=['id']) + self.call(task_cmd.GetPublished, app_args=['id']) self.app.stdout.write.assert_called_with( - json.dumps(TASK_INPUT, indent=4) + "\n" + json.dumps(TASK_PUBLISHED, indent=4) + "\n" )