Merge "Added test for mistral-dashboard cron_triggers"
This commit is contained in:
commit
0a62939a97
|
@ -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')
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue