prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Add unit test for Event helpers
  **Is your feature request related to a problem? Please describe.**
  <!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
  We should add unit tests for event helpers.
  
  **Additional context**
  <!-- Add any other context or screenshots about the feature request here. -->
  Parent: #5320 
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `app/api/helpers/errors.py`
  Content:
  ```
  1 import json
  2 
  3 from flask import make_response
  4 from flask_rest_jsonapi.errors import jsonapi_errors
  5 
  6 
  7 class ErrorResponse:
  8     """
  9     Parent ErrorResponse class for handling json-api compliant errors.
  10     Inspired by the JsonApiException class of `flask-rest-jsonapi` itself
  11     """
  12     title = 'Unknown error'
  13     status = 500
  14     headers = {'Content-Type': 'application/vnd.api+json'}
  15 
  16     def __init__(self, source, detail, title=None, status=None):
  17         """Initialize a jsonapi ErrorResponse Object
  18 
  19         :param dict source: the source of the error
  20         :param str detail: the detail of the error
  21         """
  22         self.source = source
  23         self.detail = detail
  24         if title is not None:
  25             self.title = title
  26         if status is not None:
  27             self.status = status
  28 
  29     def respond(self):
  30         """
  31         :return: a jsonapi compliant response object
  32         """
  33         dict_ = self.to_dict()
  34         return make_response(json.dumps(jsonapi_errors([dict_])), self.status, self.headers)
  35 
  36     def to_dict(self):
  37         """
  38         :return: Dict from details of the object
  39         """
  40         return {'status': self.status,
  41                 'source': self.source,
  42                 'title': self.title,
  43                 'detail': self.detail}
  44 
  45 
  46 class ForbiddenError(ErrorResponse):
  47     """
  48     Default class for 403 Error
  49     """
  50     title = 'Access Forbidden'
  51     status = 403
  52 
  53 
  54 class NotFoundError(ErrorResponse):
  55     """
  56     Default class for 404 Error
  57     """
  58     title = 'Not Found'
  59     status = 404
  60 
  61 
  62 class ServerError(ErrorResponse):
  63     status = 500
  64     title = 'Internal Server Error'
  65 
  66 
  67 class UnprocessableEntityError(ErrorResponse):
  68     status = 422
  69     title = 'Unprocessable Entity'
  70 
  71 
  72 class BadRequestError(ErrorResponse):
  73     status = 400
  74     title = 'Bad Request'
  75
  ```
  
  Path: `app/api/helpers/exceptions.py`
  Content:
  ```
  1 from flask_rest_jsonapi.exceptions import JsonApiException
  2 
  3 
  4 class UnprocessableEntity(JsonApiException):
  5     title = "Unprocessable Entity"
  6     status = 422
  7 
  8 
  9 class ConflictException(JsonApiException):
  10     title = "Conflict"
  11     status = 409
  12 
  13 
  14 class ForbiddenException(JsonApiException):
  15     """
  16     Default class for 403 Error
  17     """
  18     title = 'Access Forbidden'
  19     status = 403
  20 
  21 
  22 class MethodNotAllowed(JsonApiException):
  23     """
  24     Default Class to throw HTTP 405 Exception
  25     """
  26     title = "Method Not Allowed"
  27     status = 405
  28
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/app/api/helpers/errors.py b/app/api/helpers/errors.py
  --- a/app/api/helpers/errors.py
  +++ b/app/api/helpers/errors.py
  @@ -65,10 +65,16 @@
   
   
   class UnprocessableEntityError(ErrorResponse):
  +    """
  +    Default class for 422 Error
  +    """
       status = 422
       title = 'Unprocessable Entity'
   
   
   class BadRequestError(ErrorResponse):
  +    """
  +    Default class for 400 Error
  +    """
       status = 400
       title = 'Bad Request'
  diff --git a/app/api/helpers/exceptions.py b/app/api/helpers/exceptions.py
  --- a/app/api/helpers/exceptions.py
  +++ b/app/api/helpers/exceptions.py
  @@ -2,11 +2,17 @@
   
   
   class UnprocessableEntity(JsonApiException):
  +    """
  +    Default class for 422 Error
  +    """
       title = "Unprocessable Entity"
       status = 422
   
   
   class ConflictException(JsonApiException):
  +    """
  +    Default class for 409 Error
  +    """
       title = "Conflict"
       status = 409
  
verification_info: {"golden_diff": "diff --git a/app/api/helpers/errors.py b/app/api/helpers/errors.py\n--- a/app/api/helpers/errors.py\n+++ b/app/api/helpers/errors.py\n@@ -65,10 +65,16 @@\n \n \n class UnprocessableEntityError(ErrorResponse):\n+    \"\"\"\n+    Default class for 422 Error\n+    \"\"\"\n     status = 422\n     title = 'Unprocessable Entity'\n \n \n class BadRequestError(ErrorResponse):\n+    \"\"\"\n+    Default class for 400 Error\n+    \"\"\"\n     status = 400\n     title = 'Bad Request'\ndiff --git a/app/api/helpers/exceptions.py b/app/api/helpers/exceptions.py\n--- a/app/api/helpers/exceptions.py\n+++ b/app/api/helpers/exceptions.py\n@@ -2,11 +2,17 @@\n \n \n class UnprocessableEntity(JsonApiException):\n+    \"\"\"\n+    Default class for 422 Error\n+    \"\"\"\n     title = \"Unprocessable Entity\"\n     status = 422\n \n \n class ConflictException(JsonApiException):\n+    \"\"\"\n+    Default class for 409 Error\n+    \"\"\"\n     title = \"Conflict\"\n     status = 409\n", "issue": "Add unit test for Event helpers\n**Is your feature request related to a problem? Please describe.**\r\n<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->\r\nWe should add unit tests for event helpers.\r\n\r\n**Additional context**\r\n<!-- Add any other context or screenshots about the feature request here. -->\r\nParent: #5320 \n", "before_files": [{"content": "import json\n\nfrom flask import make_response\nfrom flask_rest_jsonapi.errors import jsonapi_errors\n\n\nclass ErrorResponse:\n    \"\"\"\n    Parent ErrorResponse class for handling json-api compliant errors.\n    Inspired by the JsonApiException class of `flask-rest-jsonapi` itself\n    \"\"\"\n    title = 'Unknown error'\n    status = 500\n    headers = {'Content-Type': 'application/vnd.api+json'}\n\n    def __init__(self, source, detail, title=None, status=None):\n        \"\"\"Initialize a jsonapi ErrorResponse Object\n\n        :param dict source: the source of the error\n        :param str detail: the detail of the error\n        \"\"\"\n        self.source = source\n        self.detail = detail\n        if title is not None:\n            self.title = title\n        if status is not None:\n            self.status = status\n\n    def respond(self):\n        \"\"\"\n        :return: a jsonapi compliant response object\n        \"\"\"\n        dict_ = self.to_dict()\n        return make_response(json.dumps(jsonapi_errors([dict_])), self.status, self.headers)\n\n    def to_dict(self):\n        \"\"\"\n        :return: Dict from details of the object\n        \"\"\"\n        return {'status': self.status,\n                'source': self.source,\n                'title': self.title,\n                'detail': self.detail}\n\n\nclass ForbiddenError(ErrorResponse):\n    \"\"\"\n    Default class for 403 Error\n    \"\"\"\n    title = 'Access Forbidden'\n    status = 403\n\n\nclass NotFoundError(ErrorResponse):\n    \"\"\"\n    Default class for 404 Error\n    \"\"\"\n    title = 'Not Found'\n    status = 404\n\n\nclass ServerError(ErrorResponse):\n    status = 500\n    title = 'Internal Server Error'\n\n\nclass UnprocessableEntityError(ErrorResponse):\n    status = 422\n    title = 'Unprocessable Entity'\n\n\nclass BadRequestError(ErrorResponse):\n    status = 400\n    title = 'Bad Request'\n", "path": "app/api/helpers/errors.py"}, {"content": "from flask_rest_jsonapi.exceptions import JsonApiException\n\n\nclass UnprocessableEntity(JsonApiException):\n    title = \"Unprocessable Entity\"\n    status = 422\n\n\nclass ConflictException(JsonApiException):\n    title = \"Conflict\"\n    status = 409\n\n\nclass ForbiddenException(JsonApiException):\n    \"\"\"\n    Default class for 403 Error\n    \"\"\"\n    title = 'Access Forbidden'\n    status = 403\n\n\nclass MethodNotAllowed(JsonApiException):\n    \"\"\"\n    Default Class to throw HTTP 405 Exception\n    \"\"\"\n    title = \"Method Not Allowed\"\n    status = 405\n", "path": "app/api/helpers/exceptions.py"}], "after_files": [{"content": "import json\n\nfrom flask import make_response\nfrom flask_rest_jsonapi.errors import jsonapi_errors\n\n\nclass ErrorResponse:\n    \"\"\"\n    Parent ErrorResponse class for handling json-api compliant errors.\n    Inspired by the JsonApiException class of `flask-rest-jsonapi` itself\n    \"\"\"\n    title = 'Unknown error'\n    status = 500\n    headers = {'Content-Type': 'application/vnd.api+json'}\n\n    def __init__(self, source, detail, title=None, status=None):\n        \"\"\"Initialize a jsonapi ErrorResponse Object\n\n        :param dict source: the source of the error\n        :param str detail: the detail of the error\n        \"\"\"\n        self.source = source\n        self.detail = detail\n        if title is not None:\n            self.title = title\n        if status is not None:\n            self.status = status\n\n    def respond(self):\n        \"\"\"\n        :return: a jsonapi compliant response object\n        \"\"\"\n        dict_ = self.to_dict()\n        return make_response(json.dumps(jsonapi_errors([dict_])), self.status, self.headers)\n\n    def to_dict(self):\n        \"\"\"\n        :return: Dict from details of the object\n        \"\"\"\n        return {'status': self.status,\n                'source': self.source,\n                'title': self.title,\n                'detail': self.detail}\n\n\nclass ForbiddenError(ErrorResponse):\n    \"\"\"\n    Default class for 403 Error\n    \"\"\"\n    title = 'Access Forbidden'\n    status = 403\n\n\nclass NotFoundError(ErrorResponse):\n    \"\"\"\n    Default class for 404 Error\n    \"\"\"\n    title = 'Not Found'\n    status = 404\n\n\nclass ServerError(ErrorResponse):\n    status = 500\n    title = 'Internal Server Error'\n\n\nclass UnprocessableEntityError(ErrorResponse):\n    \"\"\"\n    Default class for 422 Error\n    \"\"\"\n    status = 422\n    title = 'Unprocessable Entity'\n\n\nclass BadRequestError(ErrorResponse):\n    \"\"\"\n    Default class for 400 Error\n    \"\"\"\n    status = 400\n    title = 'Bad Request'\n", "path": "app/api/helpers/errors.py"}, {"content": "from flask_rest_jsonapi.exceptions import JsonApiException\n\n\nclass UnprocessableEntity(JsonApiException):\n    \"\"\"\n    Default class for 422 Error\n    \"\"\"\n    title = \"Unprocessable Entity\"\n    status = 422\n\n\nclass ConflictException(JsonApiException):\n    \"\"\"\n    Default class for 409 Error\n    \"\"\"\n    title = \"Conflict\"\n    status = 409\n\n\nclass ForbiddenException(JsonApiException):\n    \"\"\"\n    Default class for 403 Error\n    \"\"\"\n    title = 'Access Forbidden'\n    status = 403\n\n\nclass MethodNotAllowed(JsonApiException):\n    \"\"\"\n    Default Class to throw HTTP 405 Exception\n    \"\"\"\n    title = \"Method Not Allowed\"\n    status = 405\n", "path": "app/api/helpers/exceptions.py"}]}