diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/csrf_tests/tests.py | 1 | ||||
-rw-r--r-- | tests/httpwrappers/tests.py | 3 | ||||
-rw-r--r-- | tests/responses/test_fileresponse.py | 6 |
3 files changed, 6 insertions, 4 deletions
diff --git a/tests/csrf_tests/tests.py b/tests/csrf_tests/tests.py index 834a92eecf..6db67c9190 100644 --- a/tests/csrf_tests/tests.py +++ b/tests/csrf_tests/tests.py @@ -375,6 +375,7 @@ class CsrfViewMiddlewareTestMixin(CsrfFunctionTestMixin): with self.assertLogs("django.security.csrf", "WARNING") as cm: resp = mw.process_view(req, post_form_view, (), {}) self.assertEqual(403, resp.status_code) + self.assertEqual(resp["Content-Type"], "text/html; charset=utf-8") self.assertEqual(cm.records[0].getMessage(), "Forbidden (%s): " % expected) def test_csrf_cookie_bad_or_missing_token(self): diff --git a/tests/httpwrappers/tests.py b/tests/httpwrappers/tests.py index 7ee20f9ce9..6ab0cc52cb 100644 --- a/tests/httpwrappers/tests.py +++ b/tests/httpwrappers/tests.py @@ -539,7 +539,6 @@ class HttpResponseSubclassesTests(SimpleTestCase): response = HttpResponseRedirect( "/redirected/", content="The resource has temporarily moved", - content_type="text/html", ) self.assertContains( response, "The resource has temporarily moved", status_code=302 @@ -592,7 +591,7 @@ class HttpResponseSubclassesTests(SimpleTestCase): self.assertEqual(response.status_code, 405) # Standard HttpResponse init args can be used response = HttpResponseNotAllowed( - ["GET"], content="Only the GET method is allowed", content_type="text/html" + ["GET"], content="Only the GET method is allowed" ) self.assertContains(response, "Only the GET method is allowed", status_code=405) diff --git a/tests/responses/test_fileresponse.py b/tests/responses/test_fileresponse.py index ebb7876be2..af90b1170d 100644 --- a/tests/responses/test_fileresponse.py +++ b/tests/responses/test_fileresponse.py @@ -101,8 +101,10 @@ class FileResponseTests(SimpleTestCase): self.assertEqual(response.headers["Content-Type"], "video/webm") def test_content_type_buffer_explicit_default(self): - response = FileResponse(io.BytesIO(b"binary content"), content_type="text/html") - self.assertEqual(response.headers["Content-Type"], "text/html") + response = FileResponse( + io.BytesIO(b"binary content"), content_type="text/html; charset=utf-8" + ) + self.assertEqual(response.headers["Content-Type"], "text/html; charset=utf-8") def test_content_type_buffer_named(self): test_tuples = ( |