django.test.client._session should check for session middleware instead
|Reported by:||trevor||Owned by:||nobody|
|Cc:||charette.s@…, vlastimil@…, unai@…||Triage Stage:||Accepted|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The django test client class allows you to use self.client.session only if you have 'django.contrib.sessions' in your INSTALLED_APPS setting. That is, it assumes you are using sessions if and only if you have the sessions app installed.
This assumption breaks down when you are using the sessions middleware independently of the sessions app, for instance if you are using a cache backend for sessions.
I propose that django.test.client._session check for the sessions middleware class in MIDDLEWARE_CLASSES instead of the sessions app in INSTALLED_APPS to make it easier for people using the session middleware independently of the sessions app to use self.client.sesssion in tests.
Change History (14)
comment:1 Changed 7 years ago by trevor
- Component changed from Uncategorized to Unit test system
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:2 Changed 7 years ago by programmerq
- Triage Stage changed from Unreviewed to Design decision needed
comment:3 Changed 5 years ago by mtredinnick
- Triage Stage changed from Design decision needed to Accepted
comment:7 Changed 4 years ago by ramiro
- Easy pickings unset
- Resolution fixed deleted
- Status changed from closed to reopened
- UI/UX unset