summaryrefslogtreecommitdiff
path: root/tests/cache
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-09-02 21:09:22 -0400
committerTim Graham <timograham@gmail.com>2017-09-22 12:51:18 -0400
commit48d57788ee56811fa77cd37b9edf40535f82d87e (patch)
tree287dccd8f73cc4ef5d0f57eb5607fa1076a75bc0 /tests/cache
parent4502489a466b89cccd9d2c1b8d21b2f153d71b4b (diff)
downloaddjango-48d57788ee56811fa77cd37b9edf40535f82d87e.tar.gz
Refs #26447 -- Removed the USE_ETAGS setting per deprecation timeline.
Diffstat (limited to 'tests/cache')
-rw-r--r--tests/cache/tests.py38
1 files changed, 2 insertions, 36 deletions
diff --git a/tests/cache/tests.py b/tests/cache/tests.py
index d3c9513303..57e4ec15b4 100644
--- a/tests/cache/tests.py
+++ b/tests/cache/tests.py
@@ -32,15 +32,13 @@ from django.template.context_processors import csrf
from django.template.response import TemplateResponse
from django.test import (
RequestFactory, SimpleTestCase, TestCase, TransactionTestCase,
- ignore_warnings, override_settings,
+ override_settings,
)
from django.test.signals import setting_changed
from django.utils import timezone, translation
from django.utils.cache import (
- get_cache_key, learn_cache_key, patch_cache_control,
- patch_response_headers, patch_vary_headers,
+ get_cache_key, learn_cache_key, patch_cache_control, patch_vary_headers,
)
-from django.utils.deprecation import RemovedInDjango21Warning
from django.views.decorators.cache import cache_page
from .models import Poll, expensive_calculation
@@ -1838,11 +1836,9 @@ class CacheI18nTest(TestCase):
"Cache keys should include the time zone name when time zones are active"
)
- @ignore_warnings(category=RemovedInDjango21Warning) # USE_ETAGS=True
@override_settings(
CACHE_MIDDLEWARE_KEY_PREFIX="test",
CACHE_MIDDLEWARE_SECONDS=60,
- USE_ETAGS=True,
USE_I18N=True,
)
def test_middleware(self):
@@ -1884,14 +1880,6 @@ class CacheI18nTest(TestCase):
# The cache can be recovered
self.assertIsNotNone(get_cache_data)
self.assertEqual(get_cache_data.content, en_message.encode())
- # ETags are used.
- self.assertTrue(get_cache_data.has_header('ETag'))
- # ETags can be disabled.
- with self.settings(USE_ETAGS=False):
- request._cache_update_cache = True
- set_cache(request, 'en', en_message)
- get_cache_data = FetchFromCacheMiddleware().process_request(request)
- self.assertFalse(get_cache_data.has_header('ETag'))
# change the session language and set content
request = self.factory.get(self.path)
request._cache_update_cache = True
@@ -1911,7 +1899,6 @@ class CacheI18nTest(TestCase):
@override_settings(
CACHE_MIDDLEWARE_KEY_PREFIX="test",
CACHE_MIDDLEWARE_SECONDS=60,
- USE_ETAGS=True,
)
def test_middleware_doesnt_cache_streaming_response(self):
request = self.factory.get(self.path)
@@ -2232,27 +2219,6 @@ class TestWithTemplateResponse(SimpleTestCase):
'0f1c2d56633c943073c4569d9a9502fe.d41d8cd98f00b204e9800998ecf8427e'
)
- @override_settings(USE_ETAGS=False)
- def test_without_etag(self):
- template = engines['django'].from_string("This is a test")
- response = TemplateResponse(HttpRequest(), template)
- self.assertFalse(response.has_header('ETag'))
- patch_response_headers(response)
- self.assertFalse(response.has_header('ETag'))
- response = response.render()
- self.assertFalse(response.has_header('ETag'))
-
- @ignore_warnings(category=RemovedInDjango21Warning)
- @override_settings(USE_ETAGS=True)
- def test_with_etag(self):
- template = engines['django'].from_string("This is a test")
- response = TemplateResponse(HttpRequest(), template)
- self.assertFalse(response.has_header('ETag'))
- patch_response_headers(response)
- self.assertFalse(response.has_header('ETag'))
- response = response.render()
- self.assertTrue(response.has_header('ETag'))
-
class TestMakeTemplateFragmentKey(SimpleTestCase):
def test_without_vary_on(self):