

@override_settings(DEBUG=False)
def test_api_accepts_decorator(self):
    '\n        Test that failures to validate with the @api_accepts decorator do not result in\n        400 Bad Requests 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_accepts({
        'im_required': forms.IntegerField(),
    })
    def my_failed_post_view(request, *args, **kwargs):
        return JsonResponseWithStatus('still called on failure')
    rf = RequestFactory()
    request = response_json.post('/post_failure', data={
        'hello': 'world',
    })
    response = my_failed_post_view(request)
    self.assertEquals(response.status_code, 200)
    response_json = json.loads(response.content)
    self.assertEquals(response_json['error_message'], 'still called on failure')
    logger.setLevel(original_log_level)

dataset/ETHPy150Open bipsandbytes/django-api/django_api/tests.py SimpleTest.test_api_accepts_decorator/VarMisuse@80/202 `rf`->`response_json`