summaryrefslogtreecommitdiff
path: root/tests/utils_tests/test_encoding.py
diff options
context:
space:
mode:
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):