Adding 'tags' to actions

Change-Id: I4fb5780b991c6c653847bae50d36d39b0517d49a
This commit is contained in:
Renat Akhmerov 2014-09-25 15:39:14 -07:00
parent 6d1d882134
commit a2054d4ff2
3 changed files with 26 additions and 7 deletions

11
AUTHORS
View File

@ -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>

View File

@ -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,
)

View File

@ -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):