'When get_token is used, check that the cookie is created and headers
patched.'

def test_process_response_get_token_used(self):

    req = self._get_GET_no_csrf_cookie_request()
    with self.settings(CSRF_COOKIE_NAME=u'myname', CSRF_COOKIE_DOMAIN=u'.example.com', CSRF_COOKIE_PATH=u'/test/', CSRF_COOKIE_SECURE=True, CSRF_COOKIE_HTTPONLY=True):
        CsrfViewMiddleware().process_view(req, token_view, (), {})
        resp = token_view(req)
        resp2 = CsrfViewMiddleware().process_response(req, resp)
    csrf_cookie = resp2.cookies.get(u'myname', False)
    self.assertNotEqual(csrf_cookie, False)
    self.assertEqual(csrf_cookie[u'domain'], u'.example.com')
    self.assertEqual(csrf_cookie[u'secure'], True)
    self.assertEqual(csrf_cookie[u'httponly'], True)
    self.assertEqual(csrf_cookie[u'path'], u'/test/')
    self.assertTrue((u'Cookie' in resp2.get(u'Vary', u'')))
