'Construct a fake request with a referer and CSRF token over a secure connection.'

def _fake_request(self):

    factory = RequestFactory()
    factory.cookies[settings.CSRF_COOKIE_NAME] = self.CSRF_TOKEN
    request = factory.post(self.URL, HTTP_REFERER=self.REFERER, HTTP_X_CSRFTOKEN=self.CSRF_TOKEN)
    request.is_secure = (lambda : True)
    return request
