'Test resolution of get_attr occurrences in HOT template.'

def test_get_attr_multiple_rsrc_status(self):

    hot_tpl = hot_tpl_generic_resource
    self.stack = parser.Stack(self.ctx, 'test_get_attr', template.Template(hot_tpl))
    self.stack.store()
    with mock.patch.object(rsrc_defn.ResourceDefinition, 'dep_attrs') as mock_da:
        mock_da.return_value = ['foo']
        self.stack.create()
    self.assertEqual((parser.Stack.CREATE, parser.Stack.COMPLETE), self.stack.state)
    snippet = {'Value': {'get_attr': ['resource1', 'foo']}}
    rsrc = self.stack['resource1']
    for (action, status) in ((rsrc.CREATE, rsrc.IN_PROGRESS), (rsrc.CREATE, rsrc.COMPLETE), (rsrc.RESUME, rsrc.IN_PROGRESS), (rsrc.RESUME, rsrc.COMPLETE), (rsrc.UPDATE, rsrc.IN_PROGRESS), (rsrc.UPDATE, rsrc.COMPLETE)):
        rsrc.state_set(action, status)
        self.assertEqual({'Value': 'resource1'}, self.resolve(snippet))
