From 17ae1d3262e777c0d3c62e30090050363de5a679 Mon Sep 17 00:00:00 2001 From: Luke Plant Date: Fri, 3 Sep 2010 19:04:29 +0000 Subject: [PATCH] [1.2.X] Fixed #13754 - Add a note about a test client session property gotcha Thanks SmileyChris for report and patch. Backport of [13685] from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@13686 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/topics/testing.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/topics/testing.txt b/docs/topics/testing.txt index c5f8f0040d3b2..074f948461408 100644 --- a/docs/topics/testing.txt +++ b/docs/topics/testing.txt @@ -935,6 +935,15 @@ can access these properties as part of a test condition. A dictionary-like object containing session information. See the :doc:`session documentation` for full details. + To modify the session and then save it, it must be stored in a variable + first (because a new ``SessionStore`` is created every time this property + is accessed):: + + def test_something(self): + session = self.client.session + session['somekey'] = 'test' + session.save() + .. _Cookie module documentation: http://docs.python.org/library/cookie.html Example