From da5406a043512dbc47064794d6ab1ab1e0ba228b Mon Sep 17 00:00:00 2001 From: Steven Hardy Date: Tue, 16 Oct 2012 13:45:24 +0100 Subject: [PATCH] heat tests : Add ValidateTemplate test to CFN_API_Actions test Add test for ValidateTemplate action to test_CFN_API_Actions.py Change-Id: Ia7a377f952d096e7b728a7151906ab2781695008 Signed-off-by: Steven Hardy --- heat/tests/functional/test_CFN_API_Actions.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/heat/tests/functional/test_CFN_API_Actions.py b/heat/tests/functional/test_CFN_API_Actions.py index 76d84bd8..f50335a4 100644 --- a/heat/tests/functional/test_CFN_API_Actions.py +++ b/heat/tests/functional/test_CFN_API_Actions.py @@ -417,3 +417,22 @@ class CfnApiFunctionalTest(unittest.TestCase): self.assertTrue(self.phys_res_id_re.match(phys_res_id) != None) print "ListStackResources : OK" + + def testValidateTemplate(self): + client = self.stack.get_heat_client() + # Use stack.format_parameters to get the TemplateBody + params = self.stack.format_parameters() + val_params = {'TemplateBody': params['TemplateBody']} + response = client.validate_template(**val_params) + prefix = '/ValidateTemplateResponse/ValidateTemplateResult' +\ + '/Parameters/member' + # Check the response contains all the expected paramter keys + templ_params = ['DBUsername', 'LinuxDistribution', 'InstanceType', + 'DBRootPassword', 'KeyName', 'DBPassword', 'DBName'] + + for param in templ_params: + lookup = '[ParameterKey="' + param + '"]' + val = self.stack.response_xml_item(response, prefix + lookup, + 'ParameterKey') + self.assertEqual(param, val) + print "ValidateTemplate : OK" -- 2.45.2