blob: 536e5899e92500cc1b9f24712243fc30ef1832b3 [file] [log] [blame]
Oleksii Chuprykov62d90322015-12-14 15:32:58 +02001# 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
13from heat_integrationtests.functional import functional_base
14
15
16class StackOutputsTest(functional_base.FunctionalTestsBase):
17
18 template = '''
19heat_template_version: 2015-10-15
20resources:
21 test_resource_a:
22 type: OS::Heat::TestResource
23 properties:
24 value: 'a'
25 test_resource_b:
26 type: OS::Heat::TestResource
27 properties:
28 value: 'b'
29outputs:
30 resource_output_a:
31 description: 'Output of resource a'
32 value: { get_attr: [test_resource_a, output] }
33 resource_output_b:
34 description: 'Output of resource b'
35 value: { get_attr: [test_resource_b, output] }
36'''
37
38 def test_outputs(self):
39 stack_identifier = self.stack_create(
40 template=self.template
41 )
42 expected_list = [{u'output_key': u'resource_output_a',
43 u'description': u'Output of resource a'},
44 {u'output_key': u'resource_output_b',
45 u'description': u'Output of resource b'}]
46
47 actual_list = self.client.stacks.output_list(
48 stack_identifier)['outputs']
rabi4e7db092017-02-07 09:29:59 +053049 sorted_actual_list = sorted(actual_list, key=lambda x: x['output_key'])
50 self.assertEqual(expected_list, sorted_actual_list)
Oleksii Chuprykov62d90322015-12-14 15:32:58 +020051
52 expected_output_a = {
53 u'output_value': u'a', u'output_key': u'resource_output_a',
54 u'description': u'Output of resource a'}
55 expected_output_b = {
56 u'output_value': u'b', u'output_key': u'resource_output_b',
57 u'description': u'Output of resource b'}
58 actual_output_a = self.client.stacks.output_show(
59 stack_identifier, 'resource_output_a')['output']
60 actual_output_b = self.client.stacks.output_show(
61 stack_identifier, 'resource_output_b')['output']
62 self.assertEqual(expected_output_a, actual_output_a)
63 self.assertEqual(expected_output_b, actual_output_b)