title: Setting HttpReferrer In Unit Tests
body: <p>In my view.py I have the following check on several consecutive pages:</p>
  
  <pre><code>if(request.META.get('HTTP_REFERER') != request.build_absolute_uri(reverse('page1'))):
              return redirect('page1')
  </code></pre>
  
  <p>This is performed on every page, checking that the user was redirected from the previous page, so (for example), if a user tries to enter the url for page4 in the address bar, the test will fail and he will be sent to page3, then that pages test will fail and he will fall back to page2, and so on.</p>
  
  <p>Im doing this because I have several pages linked together which users must visit consecutively.</p>
  
  <p>The problem comes when I want to unit test.  The following test would throw an error because it fails the redirect test and therefore cannot test the logic of the page which im trying to test:</p>
  
  <pre><code>def test_user_information_updated_on_validation_success(self):
          user = User.objects.create_superuser('username')
          self.client.force_login(user)
  
          self.client.post(reverse('page_4'), {
              'exampleQuestion': 'exampleAnswer'
          })
          user.refresh_from_db()
  
          self.assertEqual(user.exampleform.somefield, 'exampleAnswer')
  </code></pre>
  
  <p>How can I access the page within a unit test as if it had been redirected.</p>
  
  <p>Thank you.</p>