tests for url handling in views and responses a nonascii argument to httpredirect is handled properly a nonascii argument to httppermanentredirect is handled properly tests for url handling in views and responses a non ascii argument to httpredirect is handled properly a non ascii argument to httppermanentredirect is handled properly
from django.test import SimpleTestCase, override_settings


@override_settings(ROOT_URLCONF="view_tests.generic_urls")
class URLHandling(SimpleTestCase):
    

    redirect_target = "/%E4%B8%AD%E6%96%87/target/"

    def test_nonascii_redirect(self):
        
        response = self.client.get("/nonascii_redirect/")
        self.assertRedirects(response, self.redirect_target)

    def test_permanent_nonascii_redirect(self):
        
        response = self.client.get("/permanent_nonascii_redirect/")
        self.assertRedirects(response, self.redirect_target, status_code=301)