Merge "Added test for mistral-dashboard cron_triggers"

This commit is contained in:
Jenkins 2017-04-19 09:51:24 +00:00 committed by Gerrit Code Review
commit 0a62939a97
2 changed files with 48 additions and 0 deletions

View File

@ -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:cron_triggers:index')
class CronTriggersTest(test.TestCase):
def test_index(self):
with mock.patch('mistraldashboard.api.cron_trigger_list',
return_value=self.
mistralclient_cron_triggers.list()):
res = self.client.get(INDEX_URL)
self.assertTemplateUsed(res, 'mistral/cron_triggers/index.html')

View File

@ -14,6 +14,7 @@
from mistralclient.api.v2 import action_executions
from mistralclient.api.v2 import actions
from mistralclient.api.v2 import cron_triggers
from mistralclient.api.v2 import executions
from mistralclient.api.v2 import tasks
from mistralclient.api.v2 import workbooks
@ -146,3 +147,19 @@ def data(TEST):
}
)
TEST.mistralclient_action_executions.add(action_executions_1)
# MistralCronTriggers
TEST.mistralclient_cron_triggers = test_data_utils.TestDataContainer()
cron_triggers_1 = cron_triggers.CronTrigger(
cron_triggers.CronTriggerManager(None),
{'id': '1',
'name': 'a',
'workflow_name': 'my work flow',
'pattern': '',
'next_execution_time': '',
'remaining_executions': '',
'first_execution_time': '',
'created_at': '1',
'updated_at': '1'
})
TEST.mistralclient_cron_triggers.add(cron_triggers_1)