Add actions and executions unit tests
Partially implements blueprint mistral-dashboard-ut Change-Id: I1f91427848866ebbfd9440454af1c4ee2556c5ba
This commit is contained in:
parent
dd64c180e0
commit
64919e0321
33
mistraldashboard/actions/tests.py
Normal file
33
mistraldashboard/actions/tests.py
Normal file
@ -0,0 +1,33 @@
|
||||
# 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.
|
||||
|
||||
import contextlib
|
||||
|
||||
from django.core.urlresolvers import reverse
|
||||
import mock
|
||||
|
||||
from mistraldashboard.test import helpers as test
|
||||
|
||||
INDEX_URL = reverse('horizon:mistral:actions:index')
|
||||
|
||||
|
||||
class ActionsTest(test.TestCase):
|
||||
|
||||
def test_index(self):
|
||||
with contextlib.nested(
|
||||
mock.patch('mistraldashboard.api.action_list',
|
||||
return_value=self.mistralclient_actions.list()),):
|
||||
res = self.client.get(INDEX_URL)
|
||||
|
||||
self.assertTemplateUsed(res, 'mistral/actions/index.html')
|
33
mistraldashboard/executions/tests.py
Normal file
33
mistraldashboard/executions/tests.py
Normal file
@ -0,0 +1,33 @@
|
||||
# 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.
|
||||
|
||||
import contextlib
|
||||
|
||||
from django.core.urlresolvers import reverse
|
||||
import mock
|
||||
|
||||
from mistraldashboard.test import helpers as test
|
||||
|
||||
INDEX_URL = reverse('horizon:mistral:executions:index')
|
||||
|
||||
|
||||
class ExecutionsTest(test.TestCase):
|
||||
|
||||
def test_index(self):
|
||||
with contextlib.nested(
|
||||
mock.patch('mistraldashboard.api.execution_list',
|
||||
return_value=self.mistralclient_executions.list()),):
|
||||
res = self.client.get(INDEX_URL)
|
||||
|
||||
self.assertTemplateUsed(res, 'mistral/executions/index.html')
|
@ -12,6 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from mistralclient.api.v2 import actions
|
||||
from mistralclient.api.v2 import executions
|
||||
from mistralclient.api.v2 import tasks
|
||||
from mistralclient.api.v2 import workbooks
|
||||
@ -56,6 +57,20 @@ flow:
|
||||
|
||||
|
||||
def data(TEST):
|
||||
# MistralActions
|
||||
TEST.mistralclient_actions = test_data_utils.TestDataContainer()
|
||||
action_1 = actions.Action(
|
||||
actions.ActionManager(None),
|
||||
{'name': 'a',
|
||||
'is_system': True,
|
||||
'input': 'param1',
|
||||
'description': 'my cool action',
|
||||
'tags': ['test'],
|
||||
'created_at': '1',
|
||||
'updated_at': '1'
|
||||
})
|
||||
TEST.mistralclient_actions.add(action_1)
|
||||
|
||||
# MistralExecutions
|
||||
TEST.mistralclient_executions = test_data_utils.TestDataContainer()
|
||||
execution_1 = executions.Execution(
|
||||
|
Loading…
x
Reference in New Issue
Block a user