def deallocate_resource(self, context, object_id): res = self.get_resource(context, object_id) yield res try: self._pm.release_resource(context, res['resource_id']) finally: db_api.binding_delete(context, res['object_id'])
def test_get_error_after_delete(self): api.binding_delete(self.context, self.obj['object_id']) self.assertRaises(exceptions.WrongObjectId, api.binding_get, context=self.context, object_id=self.obj['object_id'])
def test_add_dublicate_after_delete(self): api.binding_delete(self.context, self.obj['object_id']) obj = dict(api.binding_add(self.context, self.obj)) self.assertEqual(self.obj['object_id'], obj['object_id'])
def test_delete(self): self.assertIsNone(api.binding_delete(self.context, self.obj['object_id']))