summaryrefslogtreecommitdiff
path: root/tests/utils_tests
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2013-03-22 17:55:12 +0100
committerClaude Paroz <claude@2xlibre.net>2013-03-22 17:55:12 +0100
commit164528acc8752f33a3af4c1255b24702a4c81240 (patch)
treebd377a43c36fcd00b8e98d66deb7605650d93492 /tests/utils_tests
parent829dc3c5a64d3fa203b8cc0055e83cf23addfee3 (diff)
Fixed #20108 -- Fixed filepath_to_uri decoding error
This was a regression due to unicode_literals usage. Thanks Ivan Virabyan for the report and the initial patch.
Diffstat (limited to 'tests/utils_tests')
-rw-r--r--tests/utils_tests/encoding.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/utils_tests/encoding.py b/tests/utils_tests/encoding.py
index d191845518..7aaba25a7a 100644
--- a/tests/utils_tests/encoding.py
+++ b/tests/utils_tests/encoding.py
@@ -2,7 +2,7 @@
from __future__ import unicode_literals
from django.utils import unittest
-from django.utils.encoding import force_bytes
+from django.utils.encoding import force_bytes, filepath_to_uri
class TestEncodingUtils(unittest.TestCase):
@@ -15,3 +15,9 @@ class TestEncodingUtils(unittest.TestCase):
exc = ValueError(error_msg)
result = force_bytes(exc)
self.assertEqual(result, error_msg.encode('utf-8'))
+
+ def test_filepath_to_uri(self):
+ self.assertEqual(filepath_to_uri('upload\\чубака.mp4'),
+ 'upload/%D1%87%D1%83%D0%B1%D0%B0%D0%BA%D0%B0.mp4')
+ self.assertEqual(filepath_to_uri('upload\\чубака.mp4'.encode('utf-8')),
+ 'upload/%D1%87%D1%83%D0%B1%D0%B0%D0%BA%D0%B0.mp4')