summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNick Pope <nick.pope@flightdataservices.com>2019-04-05 14:45:41 +0200
committerCarlton Gibson <carlton.gibson@noumenal.es>2019-04-05 16:35:01 +0200
commit6b4e57d79f49b3dfb297505840663ee13d7cf500 (patch)
tree4d9d78f1ef6442b3c8ee3d1ae4e136c943dc5c15 /tests
parentefb257a01764855a71051d5bcc7fd66c5ad6d210 (diff)
Refs #30324 -- Forced utf-8 encoding when loading templates for the technical 404 debug and congrats page.
Diffstat (limited to 'tests')
-rw-r--r--tests/view_tests/tests/test_debug.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py
index 51b27bf361..a61e4b24ff 100644
--- a/tests/view_tests/tests/test_debug.py
+++ b/tests/view_tests/tests/test_debug.py
@@ -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