#27027 closed Bug (fixed)
force_login() now requires an authentication backend if multiple are configured
Reported by: | Ben Demboski | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | 1.10 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I believe this was an unintentionally-breaking change introduced in the fix for #24855. The code in the test client's force_login()
that chooses a default authentication backend as the first one in settings was removed, but the new code added to the login()
method throws an exception if no backend is specified and multiple are configured in settings.
The result is that applications with multiple authentications backends that were previously using force_login()
without specifying a backend are broken when running on 1.10, and need to be updated to specify a backend. This doesn't seem like it's in keeping with the intent of the force_login()
test client helper, but if it is it should at least be documented as a (test code) breaking change.
Pull request addressing this here: https://github.com/django/django/pull/7034