summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2012-10-24 23:41:45 +0200
committerAymeric Augustin <aymeric.augustin@m4x.org>2012-10-25 08:49:51 +0200
commitda56e1bac6449daef9aeab8d076d2594d9fd5b44 (patch)
treec1b2735a8121be942b2ef61ad1021e9677e65a7c /tests
parentce1eb320e59b577a600eb84d7f423a1897be3576 (diff)
Fixed #18796 -- Refactored conversion to bytes in HttpResponse
Thanks mrmachine for the review.
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/httpwrappers/tests.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/regressiontests/httpwrappers/tests.py b/tests/regressiontests/httpwrappers/tests.py
index 8e20c80de3..d908e33fb7 100644
--- a/tests/regressiontests/httpwrappers/tests.py
+++ b/tests/regressiontests/httpwrappers/tests.py
@@ -330,11 +330,12 @@ class HttpResponseTests(unittest.TestCase):
self.assertEqual(r.content, b'123\xde\x9e')
#with Content-Encoding header
- r = HttpResponse([1,1,2,4,8])
+ r = HttpResponse()
r['Content-Encoding'] = 'winning'
- self.assertEqual(r.content, b'11248')
- r.content = ['\u079e',]
- self.assertRaises(UnicodeEncodeError,
+ r.content = [b'abc', b'def']
+ self.assertEqual(r.content, b'abcdef')
+ r.content = ['\u079e']
+ self.assertRaises(TypeError if six.PY3 else UnicodeEncodeError,
getattr, r, 'content')
# .content can safely be accessed multiple times.