@override_settings(DEBUG=False)
    def test_api_returns_decorator(self):
        """
        Test that the @api_returns decorator does not result in a 400
        in production.

        This is a temporary measure to avoid breaking production as we apply
        this decorator to existing APIs.
        """
        original_log_level = logger.level
        logger.setLevel(1000)

        @api_returns({
            200: 'OK',
            403: 'Permission denied',
        })
        def simple_view(request):
            if 'ok' in request.GET:
                return JsonResponse()
            elif 'noperm' in request.GET:
                return JsonResponseForbidden()
            else:
                return JsonResponseAccepted()  # Not declared in @api_returns

        rf = RequestFactory()
        request = rf.get('/simple_view', data={'bad': '1'})
        response = simple_view(request)
        self.assertEquals(response.status_code, 202)
        logger.setLevel(original_log_level)
dataset/ETHPy150Open bipsandbytes/django-api/django_api/tests.py/SimpleTest.test_api_returns_decorator/original