def test_parameters_created_encrypted_updated_decrypted(self):
    'Test stack loading with disabled parameter value validation.'
    tmpl = template_format.parse('\n        heat_template_version: 2013-05-23\n        parameters:\n            param1:\n                type: string\n                description: value1.\n            param2:\n                type: string\n                description: value2.\n                hidden: true\n        resources:\n            a_resource:\n                type: GenericResourceType\n        ')
    cfg.CONF.set_override('encrypt_parameters_and_properties', True)
    env1 = environment.Environment({'param1': 'foo', 'param2': 'bar'})
    self.stack = stack.Stack(self.ctx, 'test', template.Template(tmpl, env=env1))
    self.stack.store()
    cfg.CONF.set_override('encrypt_parameters_and_properties', False)
    loaded_stack = stack.Stack.load(self.ctx, stack_id=self.stack.id)
    loaded_stack.state_set(self.stack.CREATE, self.stack.COMPLETE, 'for_update')
    env2 = environment.Environment({'param1': 'foo', 'param2': 'new_bar'})
    new_stack = stack.Stack(self.ctx, 'test_update', template.Template(tmpl, env=env2))
    self.assertEqual(['param2'], loaded_stack.env.encrypted_param_names)
    loaded_stack.update(new_stack)
    self.assertEqual([], loaded_stack.env.encrypted_param_names)
Test stack loading with disabled parameter value validation.
def test_parameters_created_encrypted_updated_decrypted(self):
    
    tmpl = template_format.parse('\n        heat_template_version: 2013-05-23\n        parameters:\n            param1:\n                type: string\n                description: value1.\n            param2:\n                type: string\n                description: value2.\n                hidden: true\n        resources:\n            a_resource:\n                type: GenericResourceType\n        ')
    cfg.CONF.set_override('encrypt_parameters_and_properties', True)
    env1 = environment.Environment({'param1': 'foo', 'param2': 'bar'})
    self.stack = stack.Stack(self.ctx, 'test', template.Template(tmpl, env=env1))
    self.stack.store()
    cfg.CONF.set_override('encrypt_parameters_and_properties', False)
    loaded_stack = stack.Stack.load(self.ctx, stack_id=self.stack.id)
    loaded_stack.state_set(self.stack.CREATE, self.stack.COMPLETE, 'for_update')
    env2 = environment.Environment({'param1': 'foo', 'param2': 'new_bar'})
    new_stack = stack.Stack(self.ctx, 'test_update', template.Template(tmpl, env=env2))
    self.assertEqual(['param2'], loaded_stack.env.encrypted_param_names)
    loaded_stack.update(new_stack)
    self.assertEqual([], loaded_stack.env.encrypted_param_names)