mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #28500 -- Fixed crash in FileBasedCache._is_expired() if the cache file is empty.
This commit is contained in:
7
tests/cache/tests.py
vendored
7
tests/cache/tests.py
vendored
@@ -1366,6 +1366,13 @@ class FileBasedCacheTests(BaseCacheTests, TestCase):
|
||||
with self.assertRaises(IOError):
|
||||
cache.get('foo')
|
||||
|
||||
def test_empty_cache_file_considered_expired(self):
|
||||
cache_file = cache._key_to_file('foo')
|
||||
with open(cache_file, 'wb') as fh:
|
||||
fh.write(b'')
|
||||
with open(cache_file, 'rb') as fh:
|
||||
self.assertIs(cache._is_expired(fh), True)
|
||||
|
||||
|
||||
@override_settings(CACHES={
|
||||
'default': {
|
||||
|
||||
Reference in New Issue
Block a user