title: Django 1.0 Testing: how do I get a session to persist between test code and view being tested?
body: <p>I am trying to test how a view behaves when there is certain data stored in the session. To do so I have created the session in the test method and invoked an interactive shell at the very beginning of the view:</p>
  
  <p><strong>Test Method:</strong></p>
  
  <pre><code>def test_user_with_unused_tests(self):
      "User is given a test and sent to test start"
      # todo: insure that the user is given a test that he hasn't done
  
      #login
      login = self.client.login(username='xxx', password='xxx')
      self.failUnless(login)
  
      # build the screener
      user = User(username='xxx', password='xxx')
      user_screener = UserScreener(user=user)
  
      # put the screener in session
      self.client.session['user_screener'] = user_screener
  </code></pre>
  
  <p><strong>View That Is Tested:</strong></p>
  
  <pre><code>@login_required
  def screener_start(request):
  
      import code
      code.interact(local=locals())
  </code></pre>
  
  <p>But apparently the session does not persist between my test method and the call to the view:</p>
  
  <p><strong>Evidence of Nonpersistence:</strong></p>
  
  <pre><code>&gt;&gt;&gt; request.session.values()
  [1, 'django.contrib.auth.backends.ModelBackend']
  </code></pre>
  
  <p>Is there any way to fix this? Am I missing something essential?</p>
  
  <p>I am using Django 1.0.</p>
  
  <p>Thanks ahead of time for your thoughts.</p>