diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2010-09-11 03:25:44 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2010-09-11 03:25:44 +0000 |
| commit | 4eb78b89ce198dc27daea4bbe1ab71ba4bd5cb89 (patch) | |
| tree | 6f74c20d9b4abaafef68256a4096cea8a566914b /tests | |
| parent | dc00873da09e49afb3a3d31248e61175f4b4fea4 (diff) | |
[1.2.X] Improved unicode-type, ASCII-convertible header handling in
HttpResponse.
Fixed #8765. Thanks to SmileyChris and semenov for working on this one.
Backport of r13740 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@13748 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/httpwrappers/tests.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/regressiontests/httpwrappers/tests.py b/tests/regressiontests/httpwrappers/tests.py index 23aa526a37..d3991aad86 100644 --- a/tests/regressiontests/httpwrappers/tests.py +++ b/tests/regressiontests/httpwrappers/tests.py @@ -204,9 +204,18 @@ class HttpResponseTests(unittest.TestCase): r['value'] = u'test value' self.failUnless(isinstance(r['value'], str)) - # An error is raised When a unicode object with non-ascii is assigned. + # An error is raised ~hen a unicode object with non-ascii is assigned. self.assertRaises(UnicodeEncodeError, r.__setitem__, 'value', u't\xebst value') + # An error is raised when a unicode object with non-ASCII format is + # passed as initial mimetype or content_type. + self.assertRaises(UnicodeEncodeError, HttpResponse, + mimetype=u't\xebst value') + + # HttpResponse headers must be convertible to ASCII. + self.assertRaises(UnicodeEncodeError, HttpResponse, + content_type=u't\xebst value') + # The response also converts unicode keys to strings.) r[u'test'] = 'testing key' l = list(r.items()) |
