Ejemplo n.º 1
0
    def test_get_attribute(self):
        tmpl = template_format.parse(self.test_template)
        ctx = utils.dummy_context('test_username', 'aaaa', 'password')
        stack = parser.Stack(ctx, 'test', template.Template(tmpl))
        stack.store()

        stack_res = stack['the_nested']
        stack_res._store()

        nested_t = template_format.parse(self.nested_template)
        nested_stack = parser.Stack(ctx, 'test', template.Template(nested_t))
        nested_stack.store()
        stack_res.nested = mock.Mock(return_value=nested_stack)
        self.assertEqual('bar', stack_res.FnGetAtt('Outputs.Foo'))
Ejemplo n.º 2
0
    def test_get_attribute(self):
        tmpl = template_format.parse(self.test_template)
        ctx = utils.dummy_context('test_username', 'aaaa', 'password')
        stack = parser.Stack(ctx, 'test', template.Template(tmpl))
        stack.store()

        stack_res = stack['the_nested']
        stack_res.store()

        nested_t = template_format.parse(self.nested_template)
        nested_t['Parameters']['KeyName']['Default'] = 'Key'

        nested_stack = parser.Stack(ctx, 'test', template.Template(nested_t))
        nested_stack.store()

        stack_res._rpc_client = mock.MagicMock()
        stack_res._rpc_client.show_stack.return_value = [
            api.format_stack(nested_stack)
        ]
        stack_res.nested_identifier = mock.Mock()
        stack_res.nested_identifier.return_value = {'foo': 'bar'}
        self.assertEqual('bar', stack_res.FnGetAtt('Outputs.Foo'))