summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSergey Fedoseev <fedoseev.sergey@gmail.com>2018-03-04 00:56:39 +0500
committerTim Graham <timograham@gmail.com>2018-03-03 14:56:39 -0500
commit4ff29a53e68ef44b2f4947548a224b569d4b0394 (patch)
treeb520726c3052f35dc5940ac877bfdc1ec7390222 /tests
parent683341db4396d92e4578d348b7fcce3312df505d (diff)
Refs #17476 -- Removed obsolete simplification of timezone names in cache key generation.
Diffstat (limited to 'tests')
-rw-r--r--tests/cache/tests.py29
1 files changed, 0 insertions, 29 deletions
diff --git a/tests/cache/tests.py b/tests/cache/tests.py
index 86f5bdce38..95fa5d68e6 100644
--- a/tests/cache/tests.py
+++ b/tests/cache/tests.py
@@ -1855,10 +1855,7 @@ class CacheI18nTest(TestCase):
@override_settings(USE_I18N=False, USE_L10N=False, USE_TZ=True)
def test_cache_key_i18n_timezone(self):
request = self.factory.get(self.path)
- # This is tightly coupled to the implementation,
- # but it's the most straightforward way to test the key.
tz = timezone.get_current_timezone_name()
- tz = tz.encode('ascii', 'ignore').decode('ascii').replace(' ', '_')
response = HttpResponse()
key = learn_cache_key(request, response)
self.assertIn(tz, key, "Cache keys should include the time zone name when time zones are active")
@@ -1870,37 +1867,11 @@ class CacheI18nTest(TestCase):
request = self.factory.get(self.path)
lang = translation.get_language()
tz = timezone.get_current_timezone_name()
- tz = tz.encode('ascii', 'ignore').decode('ascii').replace(' ', '_')
response = HttpResponse()
key = learn_cache_key(request, response)
self.assertNotIn(lang, key, "Cache keys shouldn't include the language name when i18n isn't active")
self.assertNotIn(tz, key, "Cache keys shouldn't include the time zone name when i18n isn't active")
- @override_settings(USE_I18N=False, USE_L10N=False, USE_TZ=True)
- def test_cache_key_with_non_ascii_tzname(self):
- # Timezone-dependent cache keys should use ASCII characters only
- # (#17476). The implementation here is a bit odd (timezone.utc is an
- # instance, not a class), but it simulates the correct conditions.
- class CustomTzName(timezone.utc):
- pass
-
- request = self.factory.get(self.path)
- response = HttpResponse()
- with timezone.override(CustomTzName):
- CustomTzName.zone = 'Hora estándar de Argentina'.encode('UTF-8') # UTF-8 string
- sanitized_name = 'Hora_estndar_de_Argentina'
- self.assertIn(
- sanitized_name, learn_cache_key(request, response),
- "Cache keys should include the time zone name when time zones are active"
- )
-
- CustomTzName.name = 'Hora estándar de Argentina' # unicode
- sanitized_name = 'Hora_estndar_de_Argentina'
- self.assertIn(
- sanitized_name, learn_cache_key(request, response),
- "Cache keys should include the time zone name when time zones are active"
- )
-
@override_settings(
CACHE_MIDDLEWARE_KEY_PREFIX="test",
CACHE_MIDDLEWARE_SECONDS=60,