'Test repeat function with get_attr function as an argument.'

def test_repeat_get_attr(self):

    tmpl = template.Template(hot_tpl_complex_attrs_all_attrs)
    self.stack = parser.Stack(self.ctx, 'test_repeat_get_attr', tmpl)
    snippet = {'repeat': {'template': 'this    is    %var%', 'for_each': {'%var%': {'get_attr': ['resource1', 'list']}}}}
    repeat = self.stack.t.parse(self.stack.defn, snippet)
    self.stack.store()
    with mock.patch.object(rsrc_defn.ResourceDefinition, 'dep_attrs') as mock_da:
        mock_da.return_value = ['list']
        self.stack.create()
    self.assertEqual((parser.Stack.CREATE, parser.Stack.COMPLETE), self.stack.state)
    self.assertEqual(['this    is    foo', 'this    is    bar'], function.resolve(repeat))
