summaryrefslogtreecommitdiff
path: root/openstack_dashboard/dashboards/project/stacks/template_versions/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'openstack_dashboard/dashboards/project/stacks/template_versions/tests.py')
-rw-r--r--openstack_dashboard/dashboards/project/stacks/template_versions/tests.py79
1 files changed, 0 insertions, 79 deletions
diff --git a/openstack_dashboard/dashboards/project/stacks/template_versions/tests.py b/openstack_dashboard/dashboards/project/stacks/template_versions/tests.py
deleted file mode 100644
index fcace15..0000000
--- a/openstack_dashboard/dashboards/project/stacks/template_versions/tests.py
+++ /dev/null
@@ -1,79 +0,0 @@
1# Licensed under the Apache License, Version 2.0 (the "License");
2# you may not use this file except in compliance with the License.
3# You may obtain a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS,
9# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
10# implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14from django.core.urlresolvers import reverse
15from django import http
16
17from mox3.mox import IsA
18
19from openstack_dashboard import api
20from openstack_dashboard.test import helpers as test
21
22
23class TemplateVersionsTests(test.TestCase):
24 INDEX_URL = reverse('horizon:project:stacks.template_versions:index')
25
26 @test.create_stubs({api.heat: ('template_version_list',)})
27 def test_index(self):
28 api.heat.template_version_list(
29 IsA(http.HttpRequest)).AndReturn(self.template_versions.list())
30 self.mox.ReplayAll()
31
32 res = self.client.get(self.INDEX_URL)
33 self.assertTemplateUsed(
34 res, 'project/stacks.template_versions/index.html')
35 self.assertContains(res, 'HeatTemplateFormatVersion.2012-12-12')
36
37 @test.create_stubs({api.heat: ('template_version_list',)})
38 def test_index_exception(self):
39 api.heat.template_version_list(
40 IsA(http.HttpRequest)).AndRaise(self.exceptions.heat)
41 self.mox.ReplayAll()
42
43 res = self.client.get(self.INDEX_URL)
44 self.assertTemplateUsed(
45 res, 'project/stacks.template_versions/index.html')
46 self.assertEqual(len(res.context['table'].data), 0)
47 self.assertMessageCount(res, error=1)
48
49 @test.create_stubs({api.heat: ('template_function_list',)})
50 def test_detail_view(self):
51 t_version = self.template_versions.first().version
52 t_functions = self.template_functions.list()
53
54 api.heat.template_function_list(
55 IsA(http.HttpRequest), t_version).AndReturn(t_functions)
56 self.mox.ReplayAll()
57
58 url = reverse('horizon:project:stacks.template_versions:details',
59 args=[t_version])
60 res = self.client.get(url)
61
62 self.assertTemplateUsed(res, 'horizon/common/_detail.html')
63 self.assertNoMessages()
64
65 @test.create_stubs({api.heat: ('template_function_list',)})
66 def test_detail_view_with_exception(self):
67 t_version = self.template_versions.first().version
68
69 api.heat.template_function_list(
70 IsA(http.HttpRequest), t_version).AndRaise(self.exceptions.heat)
71 self.mox.ReplayAll()
72
73 url = reverse('horizon:project:stacks.template_versions:details',
74 args=[t_version])
75 res = self.client.get(url)
76
77 self.assertTemplateUsed(res, 'horizon/common/_detail.html')
78 self.assertEqual(len(res.context['table'].data), 0)
79 self.assertMessageCount(res, error=1)