blob: 4bb67db9982ab7f647d6573178bb5d1651ea671f [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']
49 self.assertEqual(expected_list, actual_list)
50
51 expected_output_a = {
52 u'output_value': u'a', u'output_key': u'resource_output_a',
53 u'description': u'Output of resource a'}
54 expected_output_b = {
55 u'output_value': u'b', u'output_key': u'resource_output_b',
56 u'description': u'Output of resource b'}
57 actual_output_a = self.client.stacks.output_show(
58 stack_identifier, 'resource_output_a')['output']
59 actual_output_b = self.client.stacks.output_show(
60 stack_identifier, 'resource_output_b')['output']
61 self.assertEqual(expected_output_a, actual_output_a)
62 self.assertEqual(expected_output_b, actual_output_b)