MCPcopy
hub / github.com/django/django / test_error_pages

Method test_error_pages

tests/view_tests/tests/test_defaults.py:195–208  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

193 server_error(request, template_name="nonexistent")
194
195 def test_error_pages(self):
196 request = self.request_factory.get("/")
197 for response, title in (
198 (bad_request(request, Exception()), b"Bad Request (400)"),
199 (permission_denied(request, Exception()), b"403 Forbidden"),
200 (page_not_found(request, Http404()), b"Not Found"),
201 (server_error(request), b"Server Error (500)"),
202 ):
203 with self.subTest(title=title):
204 self.assertIn(b"<!doctype html>", response.content)
205 self.assertIn(b'<html lang="en">', response.content)
206 self.assertIn(b"<head>", response.content)
207 self.assertIn(b"<title>%s</title>" % title, response.content)
208 self.assertIn(b"<body>", response.content)

Callers

nothing calls this directly

Calls 6

bad_requestFunction · 0.90
permission_deniedFunction · 0.90
page_not_foundFunction · 0.90
Http404Class · 0.90
server_errorFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected