title: Django testing stored session data in tests
body: <p>I have a view as such:</p>
  
  <pre><code>def ProjectInfo(request):
      if request.method == 'POST':
          form = ProjectInfoForm(request.POST)
          if form.is_valid():
              # if form is valid, iterate cleaned form data
              # and save data to session
              for k, v in form.cleaned_data.iteritems():
                  request.session[k] = v
              return HttpResponseRedirect('/next/')
          else:
              ...
      else:
          ...
  </code></pre>
  
  <p>And in my tests:</p>
  
  <pre><code>from django.test import TestCase, Client
  from django.core.urlresolvers import reverse
  from tool.models import Module, Model
  from django.contrib.sessions.models import Session
  
  def test_project_info_form_post_submission(self):
      """
      Test if project info form can be submitted via post.
      """
      # set up our POST data
      post_data = {
          'zipcode': '90210',
          'module': self.module1.name,
          'model': self.model1.name,
          'orientation': 1,
          'tilt': 1,
          'rails_direction': 1,
      }
      ...
      self.assertEqual(response.status_code, 302)
      # test if 'zipcode' in session is equal to posted value.
  </code></pre>
  
  <p>So, where the last comment is in my test, I want to test if a specific value is in the <code>session</code> dict and that the key:value pairing is correct. How do I go about this? Can I use <code>request.session</code>?</p>
  
  <p>Any help much appreciated.</p>