@mock.patch.object(stack.Stack, 'db_resource_get')
def test_lightweight_stack_getatt(self, mock_drg):
    tmpl = template.Template({'HeatTemplateFormatVersion': '2012-12-12', 'Resources': {'foo': {'Type': 'GenericResourceType'}, 'bar': {'Type': 'ResourceWithPropsType', 'Properties': {'Foo': {'Fn::GetAtt': ['foo', 'bar']}}}}})
    rsrcs_data = {'foo': {'reference_id': 'foo-id', 'attrs': {'bar': 'baz'}, 'uuid': mock.ANY, 'id': mock.ANY, 'action': 'CREATE', 'status': 'COMPLETE'}, 'bar': {'reference_id': 'bar-id', 'uuid': mock.ANY, 'id': mock.ANY, 'action': 'CREATE', 'status': 'COMPLETE'}}
    cache_data = {n: node_data.NodeData.from_dict(d) for (n, d) in rsrcs_data.items()}
    tmpl_stack = stack.Stack(self.ctx, 'test', tmpl)
    tmpl_stack.store()
    lightweight_stack = stack.Stack.load(self.ctx, stack_id=tmpl_stack.id, cache_data=cache_data)
    bar = resource.Resource('bar', lightweight_stack.defn.resource_definition('bar'), lightweight_stack)
    self.assertEqual('baz', bar.properties['Foo'])
    attr_value = lightweight_stack.defn['foo'].FnGetAtt('bar')
    self.assertEqual('baz', attr_value)
    self.assertFalse(mock_drg.called)
@mock.patch.object(stack.Stack, 'db_resource_get')
def test_lightweight_stack_getatt(self, mock_drg):
    tmpl = template.Template({'HeatTemplateFormatVersion': '2012-12-12', 'Resources': {'foo': {'Type': 'GenericResourceType'}, 'bar': {'Type': 'ResourceWithPropsType', 'Properties': {'Foo': {'Fn::GetAtt': ['foo', 'bar']}}}}})
    rsrcs_data = {'foo': {'reference_id': 'foo-id', 'attrs': {'bar': 'baz'}, 'uuid': mock.ANY, 'id': mock.ANY, 'action': 'CREATE', 'status': 'COMPLETE'}, 'bar': {'reference_id': 'bar-id', 'uuid': mock.ANY, 'id': mock.ANY, 'action': 'CREATE', 'status': 'COMPLETE'}}
    cache_data = {n: node_data.NodeData.from_dict(d) for (n, d) in rsrcs_data.items()}
    tmpl_stack = stack.Stack(self.ctx, 'test', tmpl)
    tmpl_stack.store()
    lightweight_stack = stack.Stack.load(self.ctx, stack_id=tmpl_stack.id, cache_data=cache_data)
    bar = resource.Resource('bar', lightweight_stack.defn.resource_definition('bar'), lightweight_stack)
    self.assertEqual('baz', bar.properties['Foo'])
    attr_value = lightweight_stack.defn['foo'].FnGetAtt('bar')
    self.assertEqual('baz', attr_value)
    self.assertFalse(mock_drg.called)