diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/releases/6.2.txt | 4 | ||||
| -rw-r--r-- | docs/topics/testing/tools.txt | 12 |
2 files changed, 12 insertions, 4 deletions
diff --git a/docs/releases/6.2.txt b/docs/releases/6.2.txt index 74ba31f171..b949b0aa24 100644 --- a/docs/releases/6.2.txt +++ b/docs/releases/6.2.txt @@ -222,7 +222,9 @@ Templates Tests ~~~~~ -* ... +* :meth:`~django.test.Client.force_login` now skips members of + :setting:`AUTHENTICATION_BACKENDS` not implementing ``(a)get_user()``, e.g. + permission-only backends. URLs ~~~~ diff --git a/docs/topics/testing/tools.txt b/docs/topics/testing/tools.txt index da9dd38eec..6eeb96817b 100644 --- a/docs/topics/testing/tools.txt +++ b/docs/topics/testing/tools.txt @@ -479,15 +479,21 @@ Use the ``django.test.Client`` class to make requests. The user will have its ``backend`` attribute set to the value of the ``backend`` argument (which should be a dotted Python path string), or - to ``settings.AUTHENTICATION_BACKENDS[0]`` if a value isn't provided. - The :func:`~django.contrib.auth.authenticate` function called by - :meth:`login` normally annotates the user like this. + if a value isn't provided, the first backend from + :setting:`AUTHENTICATION_BACKENDS` implementing ``get_user()`` or + ``aget_user()``. The :func:`~django.contrib.auth.authenticate` function + called by :meth:`login` normally annotates the user like this. This method is faster than ``login()`` since the expensive password hashing algorithms are bypassed. Also, you can speed up ``login()`` by :ref:`using a weaker hasher while testing <speeding-up-tests-auth-hashers>`. + .. versionchanged:: 6.2 + + On older versions, backends not implementing ``(a)get_user()`` were + eligible to be selected. + .. method:: Client.logout() .. method:: Client.alogout() |
