'If the token is longer than expected, it is ignored and a new token is
created.'

def test_process_view_token_too_long(self):

    req = self._get_GET_no_csrf_cookie_request()
    req.COOKIES[settings.CSRF_COOKIE_NAME] = ('x' * 100000)
    CsrfViewMiddleware().process_view(req, token_view, (), {})
    resp = token_view(req)
    resp2 = CsrfViewMiddleware().process_response(req, resp)
    csrf_cookie = resp2.cookies.get(settings.CSRF_COOKIE_NAME, False)
    self.assertEqual(len(csrf_cookie.value), CSRF_TOKEN_LENGTH)
