mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Refs #34074 -- Used headers argument for RequestFactory and Client in docs and tests.
This commit is contained in:
parent
0d3ccf7512
commit
99bd5fb4c2
14 changed files with 113 additions and 74 deletions
6
tests/cache/tests.py
vendored
6
tests/cache/tests.py
vendored
|
@ -2004,7 +2004,7 @@ class CacheUtils(SimpleTestCase):
|
|||
|
||||
host = "www.example.com"
|
||||
path = "/cache/test/"
|
||||
factory = RequestFactory(HTTP_HOST=host)
|
||||
factory = RequestFactory(headers={"host": host})
|
||||
|
||||
def tearDown(self):
|
||||
cache.clear()
|
||||
|
@ -2095,9 +2095,9 @@ class CacheUtils(SimpleTestCase):
|
|||
"""
|
||||
get_cache_key keys differ by fully-qualified URL instead of path
|
||||
"""
|
||||
request1 = self.factory.get(self.path, HTTP_HOST="sub-1.example.com")
|
||||
request1 = self.factory.get(self.path, headers={"host": "sub-1.example.com"})
|
||||
learn_cache_key(request1, HttpResponse())
|
||||
request2 = self.factory.get(self.path, HTTP_HOST="sub-2.example.com")
|
||||
request2 = self.factory.get(self.path, headers={"host": "sub-2.example.com"})
|
||||
learn_cache_key(request2, HttpResponse())
|
||||
self.assertNotEqual(get_cache_key(request1), get_cache_key(request2))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue