'Check that 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] = (u'x' * 10000000)
    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_KEY_LENGTH)
