def test_state(self):
    self.tmpl = template.Template(copy.deepcopy(empty_template))
    self.ctx = utils.dummy_context()
    self.stack = stack.Stack(self.ctx, 'test_stack', self.tmpl, action=stack.Stack.CREATE, status=stack.Stack.IN_PROGRESS)
    persist_state = self.patchobject(self.stack, '_persist_state')
    self.assertEqual((stack.Stack.CREATE, stack.Stack.IN_PROGRESS), self.stack.state)
    if self.error:
        self.assertRaises(ValueError, self.stack.state_set, self.action, self.status, 'test')
    else:
        self.stack.state_set(self.action, self.status, 'test')
        self.assertEqual((self.action, self.status), self.stack.state)
        self.assertEqual('test', self.stack.status_reason)
    self.assertEqual(self.persist_count, persist_state.call_count)
def test_state(self):
    self.tmpl = template.Template(copy.deepcopy(empty_template))
    self.ctx = utils.dummy_context()
    self.stack = stack.Stack(self.ctx, 'test_stack', self.tmpl, action=stack.Stack.CREATE, status=stack.Stack.IN_PROGRESS)
    persist_state = self.patchobject(self.stack, '_persist_state')
    self.assertEqual((stack.Stack.CREATE, stack.Stack.IN_PROGRESS), self.stack.state)
    if self.error:
        self.assertRaises(ValueError, self.stack.state_set, self.action, self.status, 'test')
    else:
        self.stack.state_set(self.action, self.status, 'test')
        self.assertEqual((self.action, self.status), self.stack.state)
        self.assertEqual('test', self.stack.status_reason)
    self.assertEqual(self.persist_count, persist_state.call_count)