From c548c8d0d1112d2c4bace2eebf73ede35300d842 Mon Sep 17 00:00:00 2001 From: Unai Zalakain Date: Fri, 31 Oct 2014 17:43:34 +0200 Subject: Fixed #18456 -- Added path escaping to HttpRequest.get_full_path(). --- tests/utils_tests/test_encoding.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'tests/utils_tests/test_encoding.py') diff --git a/tests/utils_tests/test_encoding.py b/tests/utils_tests/test_encoding.py index 1685c82def..3119b6467a 100644 --- a/tests/utils_tests/test_encoding.py +++ b/tests/utils_tests/test_encoding.py @@ -5,8 +5,10 @@ import unittest import datetime from django.utils import six -from django.utils.encoding import (filepath_to_uri, force_bytes, force_text, - iri_to_uri, uri_to_iri) +from django.utils.encoding import ( + filepath_to_uri, force_bytes, force_text, escape_uri_path, + iri_to_uri, uri_to_iri, +) from django.utils.http import urlquote_plus @@ -40,6 +42,14 @@ class TestEncodingUtils(unittest.TestCase): today = datetime.date.today() self.assertEqual(force_bytes(today, strings_only=True), today) + def test_escape_uri_path(self): + self.assertEqual( + escape_uri_path('/;some/=awful/?path/:with/@lots/&of/+awful/chars'), + '/%3Bsome/%3Dawful/%3Fpath/:with/@lots/&of/+awful/chars' + ) + self.assertEqual(escape_uri_path('/foo#bar'), '/foo%23bar') + self.assertEqual(escape_uri_path('/foo?bar'), '/foo%3Fbar') + class TestRFC3987IEncodingUtils(unittest.TestCase): -- cgit v1.3