@mock.patch.object(update, 'StackUpdate')
def test_update_task_exception(self, mock_stack_update):

    class RandomException(Exception):
        pass
    tmpl1 = template.Template({'HeatTemplateFormatVersion': '2012-12-12', 'Resources': {'foo': {'Type': 'GenericResourceType'}}})
    self.stack = stack.Stack(utils.dummy_context(), 'test_stack', tmpl1)
    self.stack.store()
    self.stack.create()
    self.assertEqual((stack.Stack.CREATE, stack.Stack.COMPLETE), self.stack.state)
    tmpl2 = template.Template({'HeatTemplateFormatVersion': '2012-12-12', 'Resources': {'foo': {'Type': 'GenericResourceType'}, 'bar': {'Type': 'GenericResourceType'}}})
    updated_stack = stack.Stack(utils.dummy_context(), 'test_stack', tmpl2)
    mock_stack_update.side_effect = RandomException()
    self.assertRaises(RandomException, self.stack.update, updated_stack)
@mock.patch.object(update, 'StackUpdate')
def test_update_task_exception(self, mock_stack_update):

    class RandomException(Exception):
        pass
    tmpl1 = template.Template({'HeatTemplateFormatVersion': '2012-12-12', 'Resources': {'foo': {'Type': 'GenericResourceType'}}})
    self.stack = stack.Stack(utils.dummy_context(), 'test_stack', tmpl1)
    self.stack.store()
    self.stack.create()
    self.assertEqual((stack.Stack.CREATE, stack.Stack.COMPLETE), self.stack.state)
    tmpl2 = template.Template({'HeatTemplateFormatVersion': '2012-12-12', 'Resources': {'foo': {'Type': 'GenericResourceType'}, 'bar': {'Type': 'GenericResourceType'}}})
    updated_stack = stack.Stack(utils.dummy_context(), 'test_stack', tmpl2)
    mock_stack_update.side_effect = RandomException()
    self.assertRaises(RandomException, self.stack.update, updated_stack)