'Test fault serialized to JSON via file-extension and/or header.'

def test_413_fault_json(self):

    requests = [webob.Request.blank('/.json'), webob.Request.blank('/', headers={'Accept': 'application/json'})]
    for request in requests:
        exc = webob.exc.HTTPRequestEntityTooLarge
        fault = wsgi.Fault(exc(explanation='sorry', headers={'Retry-After': '4'}))
        response = request.get_response(fault)
        expected = {'overLimit': {'message': 'sorry', 'code': http_client.REQUEST_ENTITY_TOO_LARGE, 'retryAfter': '4'}}
        actual = jsonutils.loads(response.body)
        self.assertEqual('application/json', response.content_type)
        self.assertEqual(expected, actual)
