def test_suspend_fail(self):
    tmpl = {'HeatTemplateFormatVersion': '2012-12-12', 'Resources': {'AResource': {'Type': 'GenericResourceType'}}}
    exc = Exception('foo')
    self.patchobject(generic_rsrc.GenericResource, 'handle_suspend', side_effect=exc)
    self.stack = stack.Stack(self.ctx, 'suspend_test_fail', template.Template(tmpl))
    self.stack.store()
    self.stack.create()
    self.assertEqual((self.stack.CREATE, self.stack.COMPLETE), self.stack.state)
    self.stack.suspend()
    self.assertEqual((self.stack.SUSPEND, self.stack.FAILED), self.stack.state)
    self.assertEqual('Resource SUSPEND failed: Exception: resources.AResource: foo', self.stack.status_reason)
    generic_rsrc.GenericResource.handle_suspend.assert_called_once_with()
def test_suspend_fail(self):
    tmpl = {'HeatTemplateFormatVersion': '2012-12-12', 'Resources': {'AResource': {'Type': 'GenericResourceType'}}}
    exc = Exception('foo')
    self.patchobject(generic_rsrc.GenericResource, 'handle_suspend', side_effect=exc)
    self.stack = stack.Stack(self.ctx, 'suspend_test_fail', template.Template(tmpl))
    self.stack.store()
    self.stack.create()
    self.assertEqual((self.stack.CREATE, self.stack.COMPLETE), self.stack.state)
    self.stack.suspend()
    self.assertEqual((self.stack.SUSPEND, self.stack.FAILED), self.stack.state)
    self.assertEqual('Resource SUSPEND failed: Exception: resources.AResource: foo', self.stack.status_reason)
    generic_rsrc.GenericResource.handle_suspend.assert_called_once_with()