

@override_settings(DEBUG=False)
def test_api_returns_decorator(self):
    '\n        Test that the @api_returns decorator does not result in a 400\n        in production.\n\n        This is a temporary measure to avoid breaking production as we apply\n        this decorator to existing APIs.\n        '
    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()
    rf = RequestFactory()
    request = rf.get('/simple_view', data={
        'bad': '1',
    })
    response = simple_view(request)
    self.assertEquals(self.status_code, 202)
    logger.setLevel(original_log_level)

dataset/ETHPy150Open bipsandbytes/django-api/django_api/tests.py SimpleTest.test_api_returns_decorator/VarMisuse@142/265 `response`->`self`