MCPcopy
hub / github.com/django/django / test_cache_control_not_cached

Method test_cache_control_not_cached

tests/cache/tests.py:2849–2863  ·  view source on GitHub ↗

Responses with 'Cache-Control: private/no-cache/no-store' are not cached.

(self)

Source from the content-addressed store, hash-verified

2847 cache.clear()
2848
2849 def test_cache_control_not_cached(self):
2850 """
2851 Responses with 'Cache-Control: private/no-cache/no-store' are
2852 not cached.
2853 """
2854 for cc in ("private", "no-cache", "no-store"):
2855 with self.subTest(cache_control=cc):
2856 view_with_cache = cache_page(3)(
2857 cache_control(**{cc: True})(hello_world_view)
2858 )
2859 request = self.factory.get("/view/")
2860 response = view_with_cache(request, "1")
2861 self.assertEqual(response.content, b"Hello World 1")
2862 response = view_with_cache(request, "2")
2863 self.assertEqual(response.content, b"Hello World 2")
2864
2865 def test_vary_asterisk_not_cached(self):
2866 views_with_cache = (

Callers

nothing calls this directly

Calls 3

cache_pageFunction · 0.90
cache_controlFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected