8000 [1.7.x] Adapted invalid cookie test to all Python versions · alex-python/django@555952c · GitHub
[go: up one dir, main page]

Skip to content

Commit 555952c

Browse files
committed
[1.7.x] Adapted invalid cookie test to all Python versions
Refs #23638. Older Python versions are less strict when parsing invalid cookie content. The test just has to ensure Django doesn't crash.
1 parent 6398eba commit 555952c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/handlers/tests.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ def test_invalid_unicode_cookie(self):
8888
environ = RequestFactory().get('/').environ
8989
environ['HTTP_COOKIE'] = 'x=W\x03c(h]\x8e'
9090
request = WSGIRequest(environ)
91-
self.assertEqual(request.COOKIES, {})
91+
# We don't test COOKIES content, as the result might differ between
92+
# Python version because parsing invalid content became stricter in
93+
# latest versions.
94+
self.assertIsInstance(request.COOKIES, dict)
9295

9396

9497
class TransactionsPerRequestTests(TransactionTestCase):

0 commit comments

Comments
 (0)
0