Skip to content

Commit

Permalink
Test handler404 and friends
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Feb 12, 2024
1 parent 361eb7b commit aaf2715
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/testapp/test_feincms3.py
Original file line number Diff line number Diff line change
Expand Up @@ -1508,6 +1508,9 @@ def test_404_for_resolvable_app_path(self):
response = self.client.get("/blog/0/")
self.assertEqual(response.status_code, 404)

# Our custom 404 handler handles the 404 response in the apps URLconf
self.assertContains(response, "My not found handler", status_code=404)

def test_append_slash(self):
"""Requests without slash are redirected if APPEND_SLASH and target exists"""

Expand Down
4 changes: 4 additions & 0 deletions tests/testapp/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ def not_found(request):
raise Http404


def handler404(request, exception):
return HttpResponse("My not found handler", status=404)


urlpatterns = i18n_patterns(
path("i18n/", lambda request: HttpResponse(request.LANGUAGE_CODE))
) + [
Expand Down

0 comments on commit aaf2715

Please sign in to comment.