diff options
| author | Tim Graham <timograham@gmail.com> | 2016-10-07 21:06:49 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-10-27 08:53:20 -0400 |
| commit | 414ad25b090a63eaaf297b1164c8f7d814a710a2 (patch) | |
| tree | e3d0e6fdffee0793baad41a339c2d63db742c33a /tests/cache | |
| parent | d84ffcc22b2a0dbc0a44a67d56da7e3647e2f87a (diff) | |
Fixed #27327 -- Simplified time zone handling by requiring pytz.
Diffstat (limited to 'tests/cache')
| -rw-r--r-- | tests/cache/tests.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/tests/cache/tests.py b/tests/cache/tests.py index 122017b54e..832727d53c 100644 --- a/tests/cache/tests.py +++ b/tests/cache/tests.py @@ -1832,17 +1832,16 @@ class CacheI18nTest(TestCase): @override_settings(USE_I18N=False, USE_L10N=False, USE_TZ=True) def test_cache_key_with_non_ascii_tzname(self): - # Regression test for #17476 - class CustomTzName(timezone.UTC): - name = '' - - def tzname(self, dt): - return self.name + # 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.name = 'Hora estándar de Argentina'.encode('UTF-8') # UTF-8 string + 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), |
