]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
heat tests : Add ValidateTemplate test to CFN_API_Actions test
authorSteven Hardy <shardy@redhat.com>
Tue, 16 Oct 2012 12:45:24 +0000 (13:45 +0100)
committerSteven Hardy <shardy@redhat.com>
Tue, 16 Oct 2012 13:55:24 +0000 (14:55 +0100)
Add test for ValidateTemplate action to test_CFN_API_Actions.py

Change-Id: Ia7a377f952d096e7b728a7151906ab2781695008
Signed-off-by: Steven Hardy <shardy@redhat.com>
heat/tests/functional/test_CFN_API_Actions.py

index 76d84bd85ec8cf62197cf1facfc1b940088d2302..f50335a4828046a7ceaed9b1e45394eb03bd17b0 100644 (file)
@@ -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"