1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Refs #30324 -- Forced utf-8 encoding when loading templates for the technical 404 debug and congrats page.

This commit is contained in:
Nick Pope
2019-04-05 14:45:41 +02:00
committed by Carlton Gibson
parent efb257a017
commit 6b4e57d79f
2 changed files with 15 additions and 2 deletions

View File

@@ -224,6 +224,19 @@ class DebugViewTests(SimpleTestCase):
status_code=404
)
def test_template_encoding(self):
"""
The templates are loaded directly, not via a template loader, and
should be opened as utf-8 charset as is the default specified on
template engines.
"""
with mock.patch.object(DebugPath, 'open') as m:
default_urlconf(None)
m.assert_called_once_with(encoding='utf-8')
m.reset_mock()
technical_404_response(mock.MagicMock(), mock.Mock())
m.assert_called_once_with(encoding='utf-8')
class DebugViewQueriesAllowedTests(SimpleTestCase):
# May need a query to initialize MySQL connection