#21331 closed Uncategorized (duplicate)

Could not login user using test.client.Client.login when 'django.contrib.sessions' is not in settings.INSTALLED_APPS

Reported by: anonymous Owned by: nobody
Component: Testing framework Version: 1.6-beta-1
Severity: Normal Keywords: test, client, login
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hello,

I'm using django session based on cache, so I don't put 'django.contrib.sessions' in INSTALLED_APPS. Everything works fine except the tests (user login attempt always fails).

In django.test.client.Client.login line 549, there is condition:

if user and user.is_active \
     and 'django.contrib.sessions' in settings.INSTALLED_APPS:
   ...

Why do we need this part:

'django.contrib.sessions' in settings.INSTALLED_APPS

?

Change History (2)

comment:1 Changed 17 months ago by mjtamlyn

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

I think perhaps the check should be for SESSION_BACKEND

comment:2 Changed 17 months ago by charettes

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #7836.

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