'The ensure_csrf_cookie() decorator works with the CsrfViewMiddleware
enabled.'

def test_ensures_csrf_cookie_with_middleware(self):

    req = self._get_GET_no_csrf_cookie_request()
    CsrfViewMiddleware().process_view(req, ensure_csrf_cookie_view, (), {})
    resp = ensure_csrf_cookie_view(req)
    resp2 = CsrfViewMiddleware().process_response(req, resp)
    self.assertTrue(resp2.cookies.get(settings.CSRF_COOKIE_NAME, False))
    self.assertIn('Cookie', resp2.get('Vary', ''))
