Ejemplo n.º 1
0
 def test_500_api(self):
     # Simulate an early API 500 not caught by DRF
     from olympia.api.middleware import IdentifyAPIRequestMiddleware
     request = RequestFactory().get('/api/v4/addons/addon/lol/')
     IdentifyAPIRequestMiddleware().process_exception(request, Exception())
     response = handler500(request)
     assert response.status_code == 500
     assert response['Content-Type'] == 'application/json'
     data = json.loads(response.content)
     assert data['detail'] == 'Internal Server Error'
Ejemplo n.º 2
0
 def test_api_identified(self):
     request = mock.Mock()
     request.path_info = '/api/v3/lol/'
     IdentifyAPIRequestMiddleware().process_request(request)
     assert request.is_api