'Test that a POST HTTPS request with a good referer is accepted'

@override_settings(ALLOWED_HOSTS=[u'www.example.com'])
def test_https_good_referer(self):

    req = self._get_POST_request_with_token()
    req._is_secure_override = True
    req.META[u'HTTP_HOST'] = u'www.example.com'
    req.META[u'HTTP_REFERER'] = u'https://www.example.com/somepage'
    req2 = CsrfViewMiddleware().process_view(req, post_form_view, (), {})
    self.assertEqual(None, req2)
