diff --git a/mistraldashboard/action_executions/tests.py b/mistraldashboard/action_executions/tests.py new file mode 100644 index 0000000..20dd2aa --- /dev/null +++ b/mistraldashboard/action_executions/tests.py @@ -0,0 +1,31 @@ +# Copyright 2015 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from django.core.urlresolvers import reverse +import mock + +from mistraldashboard.test import helpers as test + +INDEX_URL = reverse('horizon:mistral:action_executions:index') + + +class ActionExecutionsTest(test.TestCase): + + def test_index(self): + with mock.patch('mistraldashboard.api.action_executions_list', + return_value=self. + mistralclient_action_executions.list()): + res = self.client.get(INDEX_URL) + + self.assertTemplateUsed(res, 'mistral/action_executions/index.html') diff --git a/mistraldashboard/test/test_data/mistral_data.py b/mistraldashboard/test/test_data/mistral_data.py index 8f76b32..8cdada8 100644 --- a/mistraldashboard/test/test_data/mistral_data.py +++ b/mistraldashboard/test/test_data/mistral_data.py @@ -12,6 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. +from mistralclient.api.v2 import action_executions from mistralclient.api.v2 import actions from mistralclient.api.v2 import executions from mistralclient.api.v2 import tasks @@ -68,7 +69,8 @@ def data(TEST): 'tags': ['test'], 'created_at': '1', 'updated_at': '1' - }) + } + ) TEST.mistralclient_actions.add(action_1) # MistralExecutions @@ -84,7 +86,8 @@ def data(TEST): 'first_name': 'John', 'last_name': 'Doe' } - }}) + }} + ) TEST.mistralclient_executions.add(execution_1) # Tasks @@ -108,7 +111,8 @@ def data(TEST): 'tags': ['a', 'b'], 'created_at': '1', 'updated_at': '1', - 'definition': WB_DEF}) + 'definition': WB_DEF} + ) TEST.mistralclient_workbooks.add(workbook_1) # Workflows @@ -120,5 +124,25 @@ def data(TEST): 'input': 'param', 'created_at': '1', 'updated_at': '1', - 'definition': WF_DEF}) + 'definition': WF_DEF} + ) TEST.mistralclient_workflows.add(workflow_1) + + # MistralActionsExecutions + TEST.mistralclient_action_executions = test_data_utils.TestDataContainer() + action_executions_1 = action_executions.ActionExecution( + action_executions.ActionExecutionManager(None), + {'id': '1', + 'name': 'a', + 'tags': ['a', 'b'], + 'workflow_name': 'my work flow', + 'task_execution_id': '1', + 'task_name': 'b', + 'description': '', + 'created_at': '1', + 'updated_at': '1', + 'accepted': True, + 'state': 'RUNNING' + } + ) + TEST.mistralclient_action_executions.add(action_executions_1)