diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2015-10-20 14:23:58 -0700 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2015-10-21 10:42:29 -0400 |
commit | 05248a1009c05985b1c227a1a48b871c3068cb12 (patch) | |
tree | 5ca809a4f6fea456b4b73cc16f07e8a1c7cc435a /tests/responses | |
parent | 1745aa000a4e859c21270371662634978371dda8 (diff) | |
download | django-05248a1009c05985b1c227a1a48b871c3068cb12.tar.gz |
Fixed #25576 -- Added IOBase methods required by TextIOWrapper to HttpResponse.
Diffstat (limited to 'tests/responses')
-rw-r--r-- | tests/responses/tests.py | 9 |
1 files changed, 9 insertions, 0 deletions
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 = '<HttpResponse status_code=201, "text/html; charset=utf-8">' 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)) |