Merge "Horizon support for Heat template versions"
This commit is contained in:
commit
1285a27cf0
@ -232,3 +232,11 @@ def resource_type_get(request, resource_type):
|
||||
|
||||
def service_list(request):
|
||||
return heatclient(request).services.list()
|
||||
|
||||
|
||||
def template_version_list(request):
|
||||
return heatclient(request).template_versions.list()
|
||||
|
||||
|
||||
def template_function_list(request, template_version):
|
||||
return heatclient(request).template_versions.get(template_version)
|
||||
|
@ -329,3 +329,30 @@ class HeatApiTests(test.APITestCase):
|
||||
api.heat.get_template_files(template_data=tmpl)[0]
|
||||
except exceptions.GetFileError:
|
||||
self.assertRaises(exceptions.GetFileError)
|
||||
|
||||
def test_template_version_list(self):
|
||||
api_template_versions = self.template_versions.list()
|
||||
|
||||
heatclient = self.stub_heatclient()
|
||||
heatclient.template_versions = self.mox.CreateMockAnything()
|
||||
heatclient.template_versions.list().AndReturn(api_template_versions)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
template_versions = api.heat.template_version_list(self.request)
|
||||
|
||||
self.assertItemsEqual(template_versions, api_template_versions)
|
||||
|
||||
def test_template_function_list(self):
|
||||
template_version = self.template_versions.first().version
|
||||
api_template_functions = self.template_functions.list()
|
||||
|
||||
heatclient = self.stub_heatclient()
|
||||
heatclient.template_versions = self.mox.CreateMockAnything()
|
||||
heatclient.template_versions.get(
|
||||
template_version).AndReturn(api_template_functions)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
template_functions = api.heat.template_function_list(
|
||||
self.request, template_version)
|
||||
|
||||
self.assertItemsEqual(template_functions, api_template_functions)
|
||||
|
@ -16,6 +16,7 @@ from heatclient.v1 import resource_types
|
||||
from heatclient.v1 import resources
|
||||
from heatclient.v1 import services
|
||||
from heatclient.v1 import stacks
|
||||
from heatclient.v1 import template_versions
|
||||
|
||||
from openstack_dashboard.test.test_data import utils
|
||||
|
||||
@ -363,6 +364,8 @@ def data(TEST):
|
||||
TEST.resource_types = utils.TestDataContainer()
|
||||
TEST.heat_resources = utils.TestDataContainer()
|
||||
TEST.heat_services = utils.TestDataContainer()
|
||||
TEST.template_versions = utils.TestDataContainer()
|
||||
TEST.template_functions = utils.TestDataContainer()
|
||||
|
||||
# Services
|
||||
service_1 = services.Service(services.ServiceManager(None), {
|
||||
@ -586,3 +589,35 @@ def data(TEST):
|
||||
})
|
||||
|
||||
TEST.heat_resources.add(resource_1)
|
||||
|
||||
# Template versions
|
||||
template_version_1 = template_versions.TemplateVersion(
|
||||
template_versions.TemplateVersionManager(None), {
|
||||
"version": "HeatTemplateFormatVersion.2012-12-12",
|
||||
"type": "cfn"
|
||||
})
|
||||
|
||||
template_version_2 = template_versions.TemplateVersion(
|
||||
template_versions.TemplateVersionManager(None), {
|
||||
"version": "heat_template_version.2013-05-23",
|
||||
"type": "hot"
|
||||
})
|
||||
|
||||
TEST.template_versions.add(template_version_1)
|
||||
TEST.template_versions.add(template_version_2)
|
||||
|
||||
# Template functions
|
||||
template_function_1 = template_versions.TemplateVersion(
|
||||
template_versions.TemplateVersionManager(None), {
|
||||
"functions": "Fn::GetAZs",
|
||||
"description": "A function for retrieving the availability zones."
|
||||
})
|
||||
|
||||
template_function_2 = template_versions.TemplateVersion(
|
||||
template_versions.TemplateVersionManager(None), {
|
||||
"functions": "Fn::Join",
|
||||
"description": "A function for joining strings."
|
||||
})
|
||||
|
||||
TEST.template_functions.add(template_function_1)
|
||||
TEST.template_functions.add(template_function_2)
|
||||
|
Loading…
Reference in New Issue
Block a user