From 05248a1009c05985b1c227a1a48b871c3068cb12 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Tue, 20 Oct 2015 14:23:58 -0700 Subject: Fixed #25576 -- Added IOBase methods required by TextIOWrapper to HttpResponse. --- tests/responses/tests.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/responses') diff --git a/tests/responses/tests.py b/tests/responses/tests.py index a34228ffa7..6d0588daa7 100644 --- a/tests/responses/tests.py +++ b/tests/responses/tests.py @@ -2,6 +2,8 @@ from __future__ import unicode_literals +import io + from django.conf import settings from django.http import HttpResponse from django.http.response import HttpResponseBase @@ -112,3 +114,10 @@ class HttpResponseTests(SimpleTestCase): response = HttpResponse(content="Café :)".encode(UTF8), status=201) expected = '' self.assertEqual(repr(response), expected) + + def test_wrap_textiowrapper(self): + content = "Café :)" + r = HttpResponse() + with io.TextIOWrapper(r, UTF8) as buf: + buf.write(content) + self.assertEqual(r.content, content.encode(UTF8)) -- cgit v1.3