Add 'created_at' and 'updated_at' to action-execution-get and action-execution-list command

Closes-bug: 1618767
Change-Id: I422fdcdfa66d6b7a781542c7acc458f8c46edb18
This commit is contained in:
Lucky samadhiya 2016-09-19 15:34:46 +05:30 committed by Hardik Parekh
parent fa821c8250
commit 355019133f
2 changed files with 16 additions and 5 deletions

View File

@ -34,6 +34,8 @@ def format_list(action_ex=None):
'Task ID', 'Task ID',
'State', 'State',
'Accepted', 'Accepted',
'Created at',
'Updated at'
) )
if action_ex: if action_ex:
@ -45,6 +47,8 @@ def format_list(action_ex=None):
action_ex.task_execution_id, action_ex.task_execution_id,
action_ex.state, action_ex.state,
action_ex.accepted, action_ex.accepted,
action_ex.created_at,
action_ex.updated_at or '<none>'
) )
else: else:
data = (tuple('<none>' for _ in range(len(columns))),) data = (tuple('<none>' for _ in range(len(columns))),)
@ -62,6 +66,8 @@ def format(action_ex=None):
'State', 'State',
'State info', 'State info',
'Accepted', 'Accepted',
'Created at',
'Updated at',
) )
if action_ex: if action_ex:
@ -74,6 +80,8 @@ def format(action_ex=None):
action_ex.state, action_ex.state,
action_ex.state_info, action_ex.state_info,
action_ex.accepted, action_ex.accepted,
action_ex.created_at,
action_ex.updated_at or '<none>'
) )
else: else:
data = (tuple('<none>' for _ in range(len(columns))),) data = (tuple('<none>' for _ in range(len(columns))),)

View File

@ -30,7 +30,9 @@ ACTION_EX_DICT = {
'task_execution_id': "1-2-3-4", 'task_execution_id': "1-2-3-4",
'state': 'RUNNING', 'state': 'RUNNING',
'state_info': 'RUNNING somehow.', 'state_info': 'RUNNING somehow.',
'accepted': True 'accepted': True,
'created_at': '1',
'updated_at': '1',
} }
ACTION_EX_RESULT = {"test": "is", "passed": "successfully"} ACTION_EX_RESULT = {"test": "is", "passed": "successfully"}
@ -81,7 +83,7 @@ class TestCLIActionExecutions(base.BaseCommandTest):
self.assertEqual( self.assertEqual(
('123', 'some', 'thing', 'task1', '1-2-3-4', 'RUNNING', ('123', 'some', 'thing', 'task1', '1-2-3-4', 'RUNNING',
'RUNNING somehow.', True), 'RUNNING somehow.', True, '1', '1'),
result[1] result[1]
) )
@ -95,7 +97,7 @@ class TestCLIActionExecutions(base.BaseCommandTest):
self.assertEqual( self.assertEqual(
('123', 'some', 'thing', 'task1', '1-2-3-4', 'RUNNING', ('123', 'some', 'thing', 'task1', '1-2-3-4', 'RUNNING',
'RUNNING somehow.', True), 'RUNNING somehow.', True, '1', '1'),
result[1] result[1]
) )
@ -105,7 +107,8 @@ class TestCLIActionExecutions(base.BaseCommandTest):
result = self.call(action_ex_cmd.List) result = self.call(action_ex_cmd.List)
self.assertEqual( self.assertEqual(
[('123', 'some', 'thing', 'task1', '1-2-3-4', 'RUNNING', True)], [('123', 'some', 'thing', 'task1', '1-2-3-4', 'RUNNING', True,
'1', '1')],
result[1] result[1]
) )
@ -116,7 +119,7 @@ class TestCLIActionExecutions(base.BaseCommandTest):
self.assertEqual( self.assertEqual(
('123', 'some', 'thing', 'task1', '1-2-3-4', 'RUNNING', ('123', 'some', 'thing', 'task1', '1-2-3-4', 'RUNNING',
'RUNNING somehow.', True), result[1] 'RUNNING somehow.', True, '1', '1'), result[1]
) )
def test_get_output(self): def test_get_output(self):