def test_resource_state_get_att(self):
    tmpl = {'HeatTemplateFormatVersion': '2012-12-12', 'Resources': {'AResource': {'Type': 'GenericResourceType'}}, 'Outputs': {'TestOutput': {'Value': {'Fn::GetAtt': ['AResource', 'Foo']}}}}
    self.stack = stack.Stack(self.ctx, 'resource_state_get_att', template.Template(tmpl))
    self.stack.store()
    self.stack.create()
    self.assertEqual((stack.Stack.CREATE, stack.Stack.COMPLETE), self.stack.state)
    self.assertIn('AResource', self.stack)
    rsrc = self.stack['AResource']
    rsrc.resource_id_set('aaaa')
    self.assertEqual('AResource', rsrc.FnGetAtt('Foo'))
    for (action, status) in ((rsrc.CREATE, rsrc.IN_PROGRESS), (rsrc.CREATE, rsrc.COMPLETE), (rsrc.CREATE, rsrc.FAILED), (rsrc.SUSPEND, rsrc.IN_PROGRESS), (rsrc.SUSPEND, rsrc.COMPLETE), (rsrc.RESUME, rsrc.IN_PROGRESS), (rsrc.RESUME, rsrc.COMPLETE), (rsrc.UPDATE, rsrc.IN_PROGRESS), (rsrc.UPDATE, rsrc.FAILED), (rsrc.UPDATE, rsrc.COMPLETE), (rsrc.DELETE, rsrc.IN_PROGRESS), (rsrc.DELETE, rsrc.FAILED), (rsrc.DELETE, rsrc.COMPLETE)):
        rsrc.state_set(action, status)
        self.stack._update_all_resource_data(False, True)
        self.assertEqual('AResource', self.stack.outputs['TestOutput'].get_value())
def test_resource_state_get_att(self):
    tmpl = {'HeatTemplateFormatVersion': '2012-12-12', 'Resources': {'AResource': {'Type': 'GenericResourceType'}}, 'Outputs': {'TestOutput': {'Value': {'Fn::GetAtt': ['AResource', 'Foo']}}}}
    self.stack = stack.Stack(self.ctx, 'resource_state_get_att', template.Template(tmpl))
    self.stack.store()
    self.stack.create()
    self.assertEqual((stack.Stack.CREATE, stack.Stack.COMPLETE), self.stack.state)
    self.assertIn('AResource', self.stack)
    rsrc = self.stack['AResource']
    rsrc.resource_id_set('aaaa')
    self.assertEqual('AResource', rsrc.FnGetAtt('Foo'))
    for (action, status) in ((rsrc.CREATE, rsrc.IN_PROGRESS), (rsrc.CREATE, rsrc.COMPLETE), (rsrc.CREATE, rsrc.FAILED), (rsrc.SUSPEND, rsrc.IN_PROGRESS), (rsrc.SUSPEND, rsrc.COMPLETE), (rsrc.RESUME, rsrc.IN_PROGRESS), (rsrc.RESUME, rsrc.COMPLETE), (rsrc.UPDATE, rsrc.IN_PROGRESS), (rsrc.UPDATE, rsrc.FAILED), (rsrc.UPDATE, rsrc.COMPLETE), (rsrc.DELETE, rsrc.IN_PROGRESS), (rsrc.DELETE, rsrc.FAILED), (rsrc.DELETE, rsrc.COMPLETE)):
        rsrc.state_set(action, status)
        self.stack._update_all_resource_data(False, True)
        self.assertEqual('AResource', self.stack.outputs['TestOutput'].get_value())