Always return default via template-validate "Default"
Currently we redefine the value of Default when a user value is
provided, which means the data returned doesn't match the schema
defined in the template. Instead always return the actual default
and add a "Value" key that contains the user value, if provided.
Change-Id: If4ed0b733d4e61c84167063c36cdcb234b001136
Closes-Bug: #1497310
diff --git a/functional/test_template_validate.py b/functional/test_template_validate.py
index 9dd0947..91e3e6a 100644
--- a/functional/test_template_validate.py
+++ b/functional/test_template_validate.py
@@ -74,6 +74,20 @@
'Type': 'Number'}}}
self.assertEqual(expected, ret)
+ def test_template_validate_override_default(self):
+ env = {'parameters': {'aparam': 5}}
+ ret = self.client.stacks.validate(template=self.random_template,
+ environment=env)
+ expected = {'Description': 'the stack description',
+ 'Parameters': {
+ 'aparam': {'Default': 10,
+ 'Value': 5,
+ 'Description': 'the param description',
+ 'Label': 'aparam',
+ 'NoEcho': 'false',
+ 'Type': 'Number'}}}
+ self.assertEqual(expected, ret)
+
def test_template_validate_basic_required_param(self):
tmpl = self.random_template.replace('default: 10', '')
ret = self.client.stacks.validate(template=tmpl)