Add the scope attribute in workflow list
The scope attribute was missing from the list of workflows and as a result the operator wasn't able to know if the worflow is public or private. This commit adds the scope attribute to the output of the workflow list command. Change-Id: Ib1e07f0388b90dc3c1d7b12ce54020e15fba868c Closes-Bug: #1746681
This commit is contained in:
parent
667c137194
commit
6726610f3c
|
@ -34,6 +34,7 @@ def format(workflow=None, lister=False):
|
||||||
'Project ID',
|
'Project ID',
|
||||||
'Tags',
|
'Tags',
|
||||||
'Input',
|
'Input',
|
||||||
|
'Scope',
|
||||||
'Created at',
|
'Created at',
|
||||||
'Updated at'
|
'Updated at'
|
||||||
)
|
)
|
||||||
|
@ -48,6 +49,7 @@ def format(workflow=None, lister=False):
|
||||||
workflow.project_id,
|
workflow.project_id,
|
||||||
base.wrap(', '.join(tags)) or '<none>',
|
base.wrap(', '.join(tags)) or '<none>',
|
||||||
workflow.input if not lister else base.cut(workflow.input),
|
workflow.input if not lister else base.cut(workflow.input),
|
||||||
|
workflow.scope,
|
||||||
workflow.created_at
|
workflow.created_at
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,8 @@ class SimpleMistralCLITests(base.MistralCLIAuth):
|
||||||
|
|
||||||
self.assertTableStruct(
|
self.assertTableStruct(
|
||||||
workflows,
|
workflows,
|
||||||
['ID', 'Name', 'Tags', 'Input', 'Created at', 'Updated at']
|
['ID', 'Name', 'Tags', 'Input', 'Scope', 'Created at',
|
||||||
|
'Updated at']
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_executions_list(self):
|
def test_executions_list(self):
|
||||||
|
@ -560,7 +561,8 @@ class WorkflowCLITests(base_v2.MistralClientTestBase):
|
||||||
|
|
||||||
self.assertTableStruct(
|
self.assertTableStruct(
|
||||||
workflows,
|
workflows,
|
||||||
['ID', 'Name', 'Tags', 'Input', 'Created at', 'Updated at']
|
['ID', 'Name', 'Tags', 'Input', 'Scope', 'Created at',
|
||||||
|
'Updated at']
|
||||||
)
|
)
|
||||||
|
|
||||||
# We know that we have more than one workflow by default.
|
# We know that we have more than one workflow by default.
|
||||||
|
@ -576,7 +578,8 @@ class WorkflowCLITests(base_v2.MistralClientTestBase):
|
||||||
|
|
||||||
self.assertTableStruct(
|
self.assertTableStruct(
|
||||||
workflows,
|
workflows,
|
||||||
['ID', 'Name', 'Tags', 'Input', 'Created at', 'Updated at']
|
['ID', 'Name', 'Tags', 'Input', 'Scope', 'Created at',
|
||||||
|
'Updated at']
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(1, len(workflows))
|
self.assertEqual(1, len(workflows))
|
||||||
|
|
|
@ -29,6 +29,7 @@ WORKFLOW_DICT = {
|
||||||
'project_id': '12345',
|
'project_id': '12345',
|
||||||
'tags': ['a', 'b'],
|
'tags': ['a', 'b'],
|
||||||
'input': 'param',
|
'input': 'param',
|
||||||
|
'scope': 'private',
|
||||||
'created_at': '1',
|
'created_at': '1',
|
||||||
'updated_at': '1'
|
'updated_at': '1'
|
||||||
}
|
}
|
||||||
|
@ -56,13 +57,17 @@ class TestCLIWorkflowsV2(base.BaseCommandTest):
|
||||||
result = self.call(workflow_cmd.Create, app_args=['1.txt'])
|
result = self.call(workflow_cmd.Create, app_args=['1.txt'])
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
[('1-2-3-4', 'a', '', '12345', 'a, b', 'param', '1', '1')],
|
[('1-2-3-4', 'a', '', '12345', 'a, b', 'param', 'private',
|
||||||
|
'1', '1')],
|
||||||
result[1]
|
result[1]
|
||||||
)
|
)
|
||||||
|
|
||||||
@mock.patch('argparse.open', create=True)
|
@mock.patch('argparse.open', create=True)
|
||||||
def test_create_public(self, mock_open):
|
def test_create_public(self, mock_open):
|
||||||
self.client.workflows.create.return_value = [WORKFLOW]
|
wf_public_dict = WORKFLOW_DICT.copy()
|
||||||
|
wf_public_dict['scope'] = 'public'
|
||||||
|
workflow_public = workflows.Workflow(mock, wf_public_dict)
|
||||||
|
self.client.workflows.create.return_value = [workflow_public]
|
||||||
|
|
||||||
result = self.call(
|
result = self.call(
|
||||||
workflow_cmd.Create,
|
workflow_cmd.Create,
|
||||||
|
@ -70,7 +75,8 @@ class TestCLIWorkflowsV2(base.BaseCommandTest):
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
[('1-2-3-4', 'a', '', '12345', 'a, b', 'param', '1', '1')],
|
[('1-2-3-4', 'a', '', '12345', 'a, b', 'param', 'public',
|
||||||
|
'1', '1')],
|
||||||
result[1]
|
result[1]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -93,7 +99,7 @@ class TestCLIWorkflowsV2(base.BaseCommandTest):
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
[('1-2-3-4', 'a', '', '12345', 'a, b', cmd_base.cut(long_input),
|
[('1-2-3-4', 'a', '', '12345', 'a, b', cmd_base.cut(long_input),
|
||||||
'1', '1')],
|
'private', '1', '1')],
|
||||||
result[1]
|
result[1]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -104,7 +110,8 @@ class TestCLIWorkflowsV2(base.BaseCommandTest):
|
||||||
result = self.call(workflow_cmd.Update, app_args=['1.txt'])
|
result = self.call(workflow_cmd.Update, app_args=['1.txt'])
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
[('1-2-3-4', 'a', '', '12345', 'a, b', 'param', '1', '1')],
|
[('1-2-3-4', 'a', '', '12345', 'a, b', 'param', 'private',
|
||||||
|
'1', '1')],
|
||||||
result[1]
|
result[1]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -118,7 +125,8 @@ class TestCLIWorkflowsV2(base.BaseCommandTest):
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
[('1-2-3-4', 'a', '', '12345', 'a, b', 'param', '1', '1')],
|
[('1-2-3-4', 'a', '', '12345', 'a, b', 'param', 'private',
|
||||||
|
'1', '1')],
|
||||||
result[1]
|
result[1]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -137,7 +145,8 @@ class TestCLIWorkflowsV2(base.BaseCommandTest):
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
[('1-2-3-4', 'a', '', '12345', 'a, b', 'param', '1', '1')],
|
[('1-2-3-4', 'a', '', '12345', 'a, b', 'param', 'private',
|
||||||
|
'1', '1')],
|
||||||
result[1]
|
result[1]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -147,7 +156,8 @@ class TestCLIWorkflowsV2(base.BaseCommandTest):
|
||||||
result = self.call(workflow_cmd.List)
|
result = self.call(workflow_cmd.List)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
[('1-2-3-4', 'a', '', '12345', 'a, b', 'param', '1', '1')],
|
[('1-2-3-4', 'a', '', '12345', 'a, b', 'param', 'private',
|
||||||
|
'1', '1')],
|
||||||
result[1]
|
result[1]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -157,7 +167,8 @@ class TestCLIWorkflowsV2(base.BaseCommandTest):
|
||||||
result = self.call(workflow_cmd.Get, app_args=['name'])
|
result = self.call(workflow_cmd.Get, app_args=['name'])
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
('1-2-3-4', 'a', '', '12345', 'a, b', 'param', '1', '1'),
|
('1-2-3-4', 'a', '', '12345', 'a, b', 'param', 'private',
|
||||||
|
'1', '1'),
|
||||||
result[1]
|
result[1]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue