MCPcopy
hub / github.com/django/django / test_get_cache_key_with_query

Method test_get_cache_key_with_query

tests/cache/tests.py:3041–3054  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3039 )
3040
3041 def test_get_cache_key_with_query(self):
3042 request = self.factory.get(self.path, {"test": 1})
3043 template = engines["django"].from_string("This is a test")
3044 response = TemplateResponse(HttpRequest(), template)
3045 # Expect None if no headers have been set yet.
3046 self.assertIsNone(get_cache_key(request))
3047 # Set headers to an empty list.
3048 learn_cache_key(request, response)
3049 # The querystring is taken into account.
3050 self.assertEqual(
3051 get_cache_key(request),
3052 "views.decorators.cache.cache_page.settingsprefix.GET."
3053 "0f1c2d56633c943073c4569d9a9502fe.d41d8cd98f00b204e9800998ecf8427e",
3054 )
3055
3056
3057class TestMakeTemplateFragmentKey(SimpleTestCase):

Callers

nothing calls this directly

Calls 6

TemplateResponseClass · 0.90
HttpRequestClass · 0.90
get_cache_keyFunction · 0.90
learn_cache_keyFunction · 0.90
getMethod · 0.45
from_stringMethod · 0.45

Tested by

no test coverage detected