(self)
| 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) |
nothing calls this directly
no test coverage detected