def handle404(request, *args, **kwargs): """Returns a response appropriate for a nonexistent path. This function is suitable for use as a Django view handling requests not captured by any other view. Args: request: An http.HttpRequest. *args: Positional arguments associated with the request. **kwargs: Keyword arguments associated with the request. Returns: An http.HttpResponse appropriate for a nonexistent path. """ return error.handle404()
def test404(self): """Tests that a reasonable 404 response is returned.""" response = error.handle404() self.assertEqual(httplib.NOT_FOUND, response.status_code) self.assertTrue(response.content)