From 7131efa154a3e4dd0121503578fa6ca676366431 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Tue, 14 Oct 2014 09:26:13 +0200 Subject: [PATCH] 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. --- tests/handlers/tests.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/handlers/tests.py b/tests/handlers/tests.py index 31a0ac38bb..689b0ed9d8 100644 --- a/tests/handlers/tests.py +++ b/tests/handlers/tests.py @@ -88,7 +88,10 @@ class HandlerTests(TestCase): environ = RequestFactory().get('/').environ environ['HTTP_COOKIE'] = 'x=W\x03c(h]\x8e' request = WSGIRequest(environ) - self.assertEqual(request.COOKIES, {}) + # We don't test COOKIES content, as the result might differ between + # Python version because parsing invalid content became stricter in + # latest versions. + self.assertIsInstance(request.COOKIES, dict) @override_settings(ROOT_URLCONF='handlers.urls')