Esempio n. 1
0
    def _create_dummy_stack(self, expect_count=2, expect_attrs=None):
        self.stack = utils.parse_stack(TEMPLATE)
        snip = self.stack.t.resource_definitions(self.stack)['test-chain']
        chain = resource_chain.ResourceChain('test', snip, self.stack)
        attrs = {}
        refids = {}
        if expect_attrs is None:
            expect_attrs = {}
        for index in range(expect_count):
            res = str(index)
            attrs[index] = expect_attrs.get(res, res)
            refids[index] = 'ID-%s' % res

        names = [str(name) for name in range(expect_count)]
        chain._resource_names = mock.Mock(return_value=names)
        self._stub_get_attr(chain, refids, attrs)
        return chain
Esempio n. 2
0
 def _create_chain(self, t):
     self.stack = utils.parse_stack(t)
     snip = self.stack.t.resource_definitions(self.stack)['test-chain']
     chain = resource_chain.ResourceChain('test', snip, self.stack)
     return chain