'Test that non-ASCII cookies set in JavaScript are properly decoded (#20557).'

def test_non_ascii_cookie(self):

    environ = RequestFactory().get(u'/').environ
    raw_cookie = u'want="caf\xe9"'
    if six.PY3:
        raw_cookie = raw_cookie.encode(u'utf-8').decode(u'iso-8859-1')
    environ[u'HTTP_COOKIE'] = raw_cookie
    request = WSGIRequest(environ)
    self.assertEqual(request.COOKIES[u'want'], force_str(u'caf\xe9'))
