﻿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
11475	test.Client.session.save() raises error for anonymous users	egmanoj@…	nobody	"I am trying to save data into the session object for an anonymous user. While I can do this for ""real"" using `request.session[key] = value` I am not able to simulate this during testing (by calling  `test.Client.session.save()`). A quick round of debugging revealed that the test client uses a regular dictionary object for storing session data in the case of anonymous users (as opposed to a SessionStore object for known/authenticated users). This causes an error when I try to call `self.client.session.save()` from the `setUp()` method of my test class before running a test case.


{{{
from django.test import Client, TestCase

class MyTestCase(TestCase):
    def setUp(self):
        self.client = Client()
        self.client.session['key'] = 'value'
        self.client.session.save() # AttributeError: 'dict' object has no attribute 'save'

    def test_foo(self):
        self.assertEqual(1, 1)
}}}

I have included `django.contrib.sessions` in my `INSTALLED_APPS`. 
"	Bug	closed	Testing framework	1.1-beta	Normal	duplicate		egmanoj@… nodet bmihelac@… kitsunde@…	Accepted	0	0	0	0	0	0
