James Combs | 96606b3 | 2015-06-29 15:21:05 +0000 | [diff] [blame^] | 1 | # 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 | |
| 13 | from heat_integrationtests.common import test |
| 14 | |
| 15 | |
| 16 | class EncryptedParametersTest(test.HeatIntegrationTest): |
| 17 | |
| 18 | template = ''' |
| 19 | heat_template_version: 2013-05-23 |
| 20 | parameters: |
| 21 | foo: |
| 22 | type: string |
| 23 | description: Parameter with encryption turned on |
| 24 | hidden: true |
| 25 | default: secret |
| 26 | outputs: |
| 27 | encrypted_foo_param: |
| 28 | description: '' |
| 29 | value: {get_param: foo} |
| 30 | ''' |
| 31 | |
| 32 | def setUp(self): |
| 33 | super(EncryptedParametersTest, self).setUp() |
| 34 | self.client = self.orchestration_client |
| 35 | |
| 36 | def test_db_encryption(self): |
| 37 | # Create a stack with a non-default value for 'foo' to be encrypted |
| 38 | foo_param = 'my_encrypted_foo' |
| 39 | stack_identifier = self.stack_create( |
| 40 | template=self.template, |
| 41 | parameters={'foo': foo_param} |
| 42 | ) |
| 43 | stack = self.client.stacks.get(stack_identifier) |
| 44 | |
| 45 | # Verify the output value for 'foo' parameter |
| 46 | for out in stack.outputs: |
| 47 | if out['output_key'] == 'encrypted_foo_param': |
| 48 | self.assertEqual(foo_param, out['output_value']) |