'Test that a POST HTTPS request with a bad referer is rejected'

def test_https_bad_referer(self):

    req = self._get_POST_request_with_token()
    req._is_secure = True
    req.META['HTTP_HOST'] = 'www.example.com'
    req.META['HTTP_REFERER'] = 'https://www.evil.org/somepage'
    req2 = CsrfViewMiddleware().process_view(req, post_form_view, (), {})
    self.assertNotEqual(None, req2)
    self.assertEquals(403, req2.status_code)
