Skip to content

Commit 3fb0a1a

Browse files
committed
Refs #30521 -- Added tests for content of default error pages.
1 parent d6ea489 commit 3fb0a1a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/view_tests/tests/test_defaults.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ def test_page_not_found(self):
4747
for url in self.nonexistent_urls:
4848
response = self.client.get(url)
4949
self.assertEqual(response.status_code, 404)
50+
self.assertIn(b'<h1>Not Found</h1>', response.content)
51+
self.assertIn(
52+
b'<p>The requested resource was not found on this server.</p>',
53+
response.content,
54+
)
5055

5156
@override_settings(TEMPLATES=[{
5257
'BACKEND': 'django.template.backends.django.DjangoTemplates',
@@ -71,7 +76,7 @@ def test_csrf_token_in_404(self):
7176
def test_server_error(self):
7277
"The server_error view raises a 500 status"
7378
response = self.client.get('/server_error/')
74-
self.assertEqual(response.status_code, 500)
79+
self.assertContains(response, b'<h1>Server Error (500)</h1>', status_code=500)
7580

7681
def test_bad_request(self):
7782
request = self.request_factory.get('/')

0 commit comments

Comments
 (0)