blob: e1a9b888e6554637fec58853bd62cac2b43bfef2 [file] [log] [blame]
James Combs96606b32015-06-29 15:21:05 +00001# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
12
Rabi Mishra477efc92015-07-31 13:01:45 +053013from heat_integrationtests.functional import functional_base
James Combs96606b32015-06-29 15:21:05 +000014
15
Rabi Mishra477efc92015-07-31 13:01:45 +053016class EncryptedParametersTest(functional_base.FunctionalTestsBase):
James Combs96606b32015-06-29 15:21:05 +000017
18 template = '''
19heat_template_version: 2013-05-23
20parameters:
21 foo:
22 type: string
23 description: Parameter with encryption turned on
24 hidden: true
25 default: secret
26outputs:
27 encrypted_foo_param:
28 description: ''
29 value: {get_param: foo}
30'''
31
32 def setUp(self):
33 super(EncryptedParametersTest, self).setUp()
James Combs96606b32015-06-29 15:21:05 +000034
35 def test_db_encryption(self):
36 # Create a stack with a non-default value for 'foo' to be encrypted
37 foo_param = 'my_encrypted_foo'
38 stack_identifier = self.stack_create(
39 template=self.template,
40 parameters={'foo': foo_param}
41 )
42 stack = self.client.stacks.get(stack_identifier)
43
44 # Verify the output value for 'foo' parameter
45 for out in stack.outputs:
46 if out['output_key'] == 'encrypted_foo_param':
47 self.assertEqual(foo_param, out['output_value'])