﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
27542	Client.force_login() shouldn't use authentication backends without a get_user() method	Tom Forbes	nobody	"In the current code if no `backend` is passed to the TestClient.force_login it simply uses the first one:

https://github.com/django/django/blob/master/django/test/client.py#L635

I think this could be improved. Libraries like `django-rules` are implemented as an authentication backend but don't implement a `get_user` method. This leads to confusing errors, as described in this ticket: https://github.com/dfunckt/django-rules/issues/46

Perhaps rather than doing `backend = settings.AUTHENTICATION_BACKENDS[0]` it could filter out backends that don't implement a `get_user` method, or follow the usual chain of authentication backends (i.e skipping ones that return None)?"	Cleanup/optimization	closed	Testing framework	dev	Normal	fixed		django@… desecho@…	Accepted	1	0	0	0	0	0
