Fix test_stack_collect_attributes

Note: self.stack.resources returns an iterator that is assumed
to be a collection.

Initialize the iterator within the loop otherwise we do not assert
all the resources (mostly only the last one).

Change-Id: Idde2ed6971994438cbfb1f68a80e2816eb8cec54
This commit is contained in:
Angus Salkeld 2015-08-10 13:58:54 +10:00
parent 0c2b545510
commit 66586037d9
1 changed files with 3 additions and 4 deletions

View File

@ -167,14 +167,13 @@ class DepAttrsTest(common.HeatTestCase):
self.ctx = utils.dummy_context()
def test_dep_attrs(self):
parsed_tmpl = template_format.parse(self.tmpl)
self.stack = stack.Stack(self.ctx, 'test_stack',
template.Template(parsed_tmpl))
resources = six.itervalues(self.stack.resources)
outputs = self.stack.outputs
for res in resources:
for res in six.itervalues(self.stack):
outputs = self.stack.outputs
resources = six.itervalues(self.stack.resources)
self.assertEqual(self.expected[res.name],
self.stack.get_dep_attrs(resources, outputs,
res.name))