#11475: test.Client.session.save() raises error for anonymous users ----------------------------------------+----------------------------------- Reporter: egma...@gmail.com | Owner: nobody Status: new | Milestone: Component: Testing framework | Version: 1.1-beta-1 Resolution: | Keywords: Stage: Unreviewed | Has_patch: 0 Needs_docs: 0 | Needs_tests: 0 Needs_better_patch: 0 | ----------------------------------------+----------------------------------- Comment (by kra...@canonical.org):
Manoj: let's say that you have some view at `/blort` that will store something into the session. Then I think you can do this (although I haven't tested this code): {{{ class MyTestCase(TestCase): def setUp(self): # self.client = Client() (not necessary in modern Django) self.client.get('/blort') # after this, self.client.session is a real session s = self.client.session s['key'] = 'value' s.save() }}} Does that work for you? -- Ticket URL: <http://code.djangoproject.com/ticket/11475#comment:6> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---