From a2054d4ff200dfadbda985cdd9a075b5946724be Mon Sep 17 00:00:00 2001 From: Renat Akhmerov <rakhmerov@mirantis.com> Date: Thu, 25 Sep 2014 15:39:14 -0700 Subject: [PATCH] Adding 'tags' to actions Change-Id: I4fb5780b991c6c653847bae50d36d39b0517d49a --- AUTHORS | 11 ++++++++--- mistralclient/commands/v2/actions.py | 4 ++++ .../tests/unit/v2/test_cli_actions.py | 18 ++++++++++++++---- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/AUTHORS b/AUTHORS index 32ce1cb3..cdea8334 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,4 +1,9 @@ +Anastasia Kuznetsova <akuznetsova@mirantis.com> +Angus Salkeld <angus.salkeld@rackspace.com> +Christian Berendt <berendt@b1-systems.de> +Dmitri Zimine <dz@stackstorm.com> +Kirill Izotov <enykeev@stackstorm.com> +Leandro I. Costantino <leandro.i.costantino@intel.com> +Nikolay Mahotkin <nmakhotkin@mirantis.com> Renat Akhmerov <rakhmerov@mirantis.com> -Nikolay Makhotkin <nmakhotkin@mirantis.com> -Alexander Kuznetsov <akuznetsov@mirantis.com> - +TimurNurlygayanov <tnurlygayanov@mirantis.com> diff --git a/mistralclient/commands/v2/actions.py b/mistralclient/commands/v2/actions.py index ece44f5e..3f49b5f5 100644 --- a/mistralclient/commands/v2/actions.py +++ b/mistralclient/commands/v2/actions.py @@ -30,14 +30,18 @@ def format(action=None): columns = ( 'Name', 'Description', + 'Tags', 'Created at', 'Updated at' ) if action: + tags = getattr(action, 'tags', None) or [] + data = ( action.name, getattr(action, 'description', '<none>'), + ', '.join(tags) or '<none>', action.created_at, ) diff --git a/mistralclient/tests/unit/v2/test_cli_actions.py b/mistralclient/tests/unit/v2/test_cli_actions.py index 0bd14a18..7d673ae9 100644 --- a/mistralclient/tests/unit/v2/test_cli_actions.py +++ b/mistralclient/tests/unit/v2/test_cli_actions.py @@ -25,6 +25,7 @@ from mistralclient.api.v2 import actions ACTION_DICT = { 'name': 'a', 'description': 'My cool action', + 'tags': ['test'], 'created_at': '1', 'updated_at': '1' } @@ -53,7 +54,10 @@ class TestCLIActionsV2(base.BaseCommandTest): result = self.call(action_cmd.Create, app_args=['1.txt']) - self.assertEqual([('a', 'My cool action', '1', '1')], result[1]) + self.assertEqual( + [('a', 'My cool action', 'test', '1', '1')], + result[1] + ) @mock.patch('argparse.open', create=True) @mock.patch('mistralclient.api.v2.actions.ActionManager.update') @@ -62,7 +66,10 @@ class TestCLIActionsV2(base.BaseCommandTest): result = self.call(action_cmd.Update, app_args=['my_action.yaml']) - self.assertEqual([('a', 'My cool action', '1', '1')], result[1]) + self.assertEqual( + [('a', 'My cool action', 'test', '1', '1')], + result[1] + ) @mock.patch('mistralclient.api.v2.actions.ActionManager.list') def test_list(self, mock): @@ -70,7 +77,10 @@ class TestCLIActionsV2(base.BaseCommandTest): result = self.call(action_cmd.List) - self.assertEqual([('a', 'My cool action', '1', '1')], result[1]) + self.assertEqual( + [('a', 'My cool action', 'test', '1', '1')], + result[1] + ) @mock.patch('mistralclient.api.v2.actions.ActionManager.get') def test_get(self, mock): @@ -78,7 +88,7 @@ class TestCLIActionsV2(base.BaseCommandTest): result = self.call(action_cmd.Get, app_args=['name']) - self.assertEqual(('a', 'My cool action', '1', '1'), result[1]) + self.assertEqual(('a', 'My cool action', 'test', '1', '1'), result[1]) @mock.patch('mistralclient.api.v2.actions.ActionManager.delete') def test_delete(self, mock):