def handle500(request, *args, **kwargs): """Returns a response indicating a failure within the server. This function is suitable for use as a Django view handling requests the ordinary servicing of which resulted in a fault or failure of some kind. Args: request: An http.HttpRequest. *args: Positional arguments associated with the request. **kwargs: Keyword arguments associated with the request. Returns: An http.HttpResponse indicating a failure within the server. """ return error.handle500()
def test500(self): """Tests that a reasonable 500 response is returned.""" response = error.handle500() self.assertEqual(httplib.INTERNAL_SERVER_ERROR, response.status_code) self.assertTrue(response.content)