Manipulating the test client session doesn't work as documented
|Reported by:||Preston Timmons||Owned by:|
|Cc:||prestontimmons@…||Triage Stage:||Design decision needed|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The example for manipulating session variables at this url does not work as documented:
def test_something(self): session = self.client.session session['somekey'] = 'test' session.save()
The test client returns a dictionary rather than a session object, unless a session object is manually added to the client or a view is called that initiates a session.
Attached is a patch that modifies the client to return a session object whenever django.contrib.sessions is installed.
Change History (9)
comment:1 Changed 5 years ago by
|Patch needs improvement:||unset|
comment:4 Changed 5 years ago by
|Owner:||changed from Preston Timmons to Michael Radziej|
|Status:||reopened → new|