summaryrefslogtreecommitdiff
path: root/docs/topics/testing
diff options
context:
space:
mode:
authorDavid Wobrock <david.wobrock@gmail.com>2022-12-24 00:10:25 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-01-04 09:11:36 +0100
commit99bd5fb4c2d51f7bf8a19b2c12a603ab38b85ec9 (patch)
tree72023829a9296a0ae457523fe6f223525be6a576 /docs/topics/testing
parent0d3ccf7512edd48ac2461b7140977c16ee479d3e (diff)
Refs #34074 -- Used headers argument for RequestFactory and Client in docs and tests.
Diffstat (limited to 'docs/topics/testing')
-rw-r--r--docs/topics/testing/advanced.txt5
-rw-r--r--docs/topics/testing/tools.txt2
2 files changed, 5 insertions, 2 deletions
diff --git a/docs/topics/testing/advanced.txt b/docs/topics/testing/advanced.txt
index 3b5b234481..2cae3325a6 100644
--- a/docs/topics/testing/advanced.txt
+++ b/docs/topics/testing/advanced.txt
@@ -152,7 +152,10 @@ example, the test suite for docs.djangoproject.com includes the following::
class SearchFormTestCase(TestCase):
def test_empty_get(self):
- response = self.client.get('/en/dev/search/', HTTP_HOST='docs.djangoproject.dev:8000')
+ response = self.client.get(
+ "/en/dev/search/",
+ headers={"host": "docs.djangoproject.dev:8000"},
+ )
self.assertEqual(response.status_code, 200)
and the settings file includes a list of the domains supported by the project::
diff --git a/docs/topics/testing/tools.txt b/docs/topics/testing/tools.txt
index ff34e81b8f..139d66e64b 100644
--- a/docs/topics/testing/tools.txt
+++ b/docs/topics/testing/tools.txt
@@ -682,7 +682,7 @@ a name of :setting:`LANGUAGE_COOKIE_NAME` and a value of the language code::
or by including the ``Accept-Language`` HTTP header in the request::
def test_language_using_header(self):
- response = self.client.get('/', HTTP_ACCEPT_LANGUAGE='fr')
+ response = self.client.get("/", headers={"accept-language": "fr"})
self.assertEqual(response.content, b"Bienvenue sur mon site.")
More details are in :ref:`how-django-discovers-language-preference`.