Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.2.X] Fixed #13754 - Add a note about a test client session propert…

…y 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
  • Loading branch information...
commit 17ae1d3262e777c0d3c62e30090050363de5a679 1 parent 4b4168b
Luke Plant authored September 03, 2010

Showing 1 changed file with 9 additions and 0 deletions. Show diff stats Hide diff stats

  1. 9  docs/topics/testing.txt
9  docs/topics/testing.txt
@@ -935,6 +935,15 @@ can access these properties as part of a test condition.
935 935
     A dictionary-like object containing session information. See the
936 936
     :doc:`session documentation</topics/http/sessions>` for full details.
937 937
 
  938
+    To modify the session and then save it, it must be stored in a variable
  939
+    first (because a new ``SessionStore`` is created every time this property
  940
+    is accessed)::
  941
+
  942
+        def test_something(self):
  943
+            session = self.client.session
  944
+            session['somekey'] = 'test'
  945
+            session.save()
  946
+
938 947
 .. _Cookie module documentation: http://docs.python.org/library/cookie.html
939 948
 
940 949
 Example

0 notes on commit 17ae1d3

Please sign in to comment.
Something went wrong with that request. Please try again.