MCPcopy
hub / github.com/django/django / test_cache_key_varies_by_url

Method test_cache_key_varies_by_url

tests/cache/tests.py:2245–2253  ·  view source on GitHub ↗

get_cache_key keys differ by fully-qualified URL instead of path

(self)

Source from the content-addressed store, hash-verified

2243 )
2244
2245 def test_cache_key_varies_by_url(self):
2246 """
2247 get_cache_key keys differ by fully-qualified URL instead of path
2248 """
2249 request1 = self.factory.get(self.path, headers={"host": "sub-1.example.com"})
2250 learn_cache_key(request1, HttpResponse())
2251 request2 = self.factory.get(self.path, headers={"host": "sub-2.example.com"})
2252 learn_cache_key(request2, HttpResponse())
2253 self.assertNotEqual(get_cache_key(request1), get_cache_key(request2))
2254
2255 def test_learn_cache_key(self):
2256 request = self.factory.head(self.path)

Callers

nothing calls this directly

Calls 4

learn_cache_keyFunction · 0.90
HttpResponseClass · 0.90
get_cache_keyFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected