Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#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.

Change History (3)

comment:1 by Ben Demboski, 8 years ago

Pull request addressing this here: https://github.com/django/django/pull/7034

comment:2 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: newclosed

In fc8f097:

Fixed #27027 -- Restored Client.force_login() defaulting to the first auth backend.

comment:3 by Tim Graham <timograham@…>, 8 years ago

In d68b145:

[1.10.x] Fixed #27027 -- Restored Client.force_login() defaulting to the first auth backend.

Backport of fc8f097117af7ada616fad20ae5b417fcf740413 from master

Note: See TracTickets for help on using tickets.
Back to Top