From 6a8f95d812797a0c7af85df27c51f588c8649c69 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Mon, 25 Feb 2013 18:12:55 -0700 Subject: [PATCH] Fixed a caching test on Python 3. --- tests/regressiontests/cache/tests.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/regressiontests/cache/tests.py b/tests/regressiontests/cache/tests.py index 70d33a1ddf..24e510c5d2 100644 --- a/tests/regressiontests/cache/tests.py +++ b/tests/regressiontests/cache/tests.py @@ -1327,7 +1327,7 @@ class CacheI18nTest(TestCase): def check_accept_language_vary(self, accept_language, vary, reference_key): request = self._get_request() request.META['HTTP_ACCEPT_LANGUAGE'] = accept_language - request.META['HTTP_ACCEPT_ENCODING'] = 'gzip;q=1.0, identity; q=0.5, *;q=0' + request.META['HTTP_ACCEPT_ENCODING'] = b'gzip;q=1.0, identity; q=0.5, *;q=0' response = HttpResponse() response['Vary'] = vary key = learn_cache_key(request, response) @@ -1340,53 +1340,53 @@ class CacheI18nTest(TestCase): lang = translation.get_language() self.assertEqual(lang, 'en') request = self._get_request() - request.META['HTTP_ACCEPT_ENCODING'] = 'gzip;q=1.0, identity; q=0.5, *;q=0' + request.META['HTTP_ACCEPT_ENCODING'] = b'gzip;q=1.0, identity; q=0.5, *;q=0' response = HttpResponse() response['Vary'] = 'accept-encoding' key = learn_cache_key(request, response) self.assertIn(lang, key, "Cache keys should include the language name when translation is active") self.check_accept_language_vary( - 'en-us', + b'en-us', 'cookie, accept-language, accept-encoding', key ) self.check_accept_language_vary( - 'en-US', + b'en-US', 'cookie, accept-encoding, accept-language', key ) self.check_accept_language_vary( - 'en-US,en;q=0.8', + b'en-US,en;q=0.8', 'accept-encoding, accept-language, cookie', key ) self.check_accept_language_vary( - 'en-US,en;q=0.8,ko;q=0.6', + b'en-US,en;q=0.8,ko;q=0.6', 'accept-language, cookie, accept-encoding', key ) self.check_accept_language_vary( - 'ko-kr,ko;q=0.8,en-us;q=0.5,en;q=0.3 ', + b'ko-kr,ko;q=0.8,en-us;q=0.5,en;q=0.3 ', 'accept-encoding, cookie, accept-language', key ) self.check_accept_language_vary( - 'ko-KR,ko;q=0.8,en-US;q=0.6,en;q=0.4', + b'ko-KR,ko;q=0.8,en-US;q=0.6,en;q=0.4', 'accept-language, accept-encoding, cookie', key ) self.check_accept_language_vary( - 'ko;q=1.0,en;q=0.5', + b'ko;q=1.0,en;q=0.5', 'cookie, accept-language, accept-encoding', key ) self.check_accept_language_vary( - 'ko, en', + b'ko, en', 'cookie, accept-encoding, accept-language', key ) self.check_accept_language_vary( - 'ko-KR, en-US', + b'ko-KR, en-US', 'accept-encoding, accept-language, cookie', key )