summaryrefslogtreecommitdiff
path: root/tests/utils_tests/test_encoding.py
diff options
context:
space:
mode:
authorUnai Zalakain <unai@gisa-elkartea.org>2014-10-31 17:43:34 +0200
committerTim Graham <timograham@gmail.com>2014-11-03 07:59:19 -0500
commitc548c8d0d1112d2c4bace2eebf73ede35300d842 (patch)
treea0d8e3089302139c6a24b6262d37ab2eb55fb4c8 /tests/utils_tests/test_encoding.py
parentd3db878e4beff057400dd780c24f3601a5d31f95 (diff)
Fixed #18456 -- Added path escaping to HttpRequest.get_full_path().
Diffstat (limited to 'tests/utils_tests/test_encoding.py')
-rw-r--r--tests/utils_tests/test_encoding.py14
1 files changed, 12 insertions, 2 deletions
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):