def test_list(self, request):
     self.logger.info('Running test: %s', get_function_name(__name__))
     service = StandardManagerService(logger=self.logger,
                                      config=self.CONFIG,
                                      connection=get_connection())
     data = service.list(request)
     self.assertIsNotNone(data)
def standard_list():
    """
    get:
       summary: List all standards
       responses:
            200:
                description: Success response
                content:
                    application/json:
                        schema: StandardListResponseSchema
    """
    service = StandardManagerService(logger=logger)
    request = ApiRequest().parse_request(app)
    response = ApiResponse(request)
    status_code = 200

    try:
        data = service.list(request)
        total = service.count(request)

        response.set_data(data)
        response.set_total(total)

    except Exception as err:
        logger.error(err)

        if isinstance(err, ApiException):
            api_ex = err
            status_code = 404
        else:
            api_ex = ApiException(MessagesEnum.LIST_ERROR)
            status_code = 500

        response.set_exception(api_ex)
    return response.get_response(status_code)