diff options
| author | Claude Paroz <claude@2xlibre.net> | 2013-03-22 17:55:12 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2013-03-22 17:58:36 +0100 |
| commit | deec020bf5927abbdd667912f80794c32c03e609 (patch) | |
| tree | 384ebba3b5ddbf35c9fdf4983be4176ec8702137 /tests/regressiontests/utils/encoding.py | |
| parent | dd897e4eeb20cab9ac708c46f34c5f09758205c8 (diff) | |
[1.5.x] 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.
Backport of 164528acc8 from master.
Diffstat (limited to 'tests/regressiontests/utils/encoding.py')
| -rw-r--r-- | tests/regressiontests/utils/encoding.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/regressiontests/utils/encoding.py b/tests/regressiontests/utils/encoding.py index d191845518..7aaba25a7a 100644 --- a/tests/regressiontests/utils/encoding.py +++ b/tests/regressiontests/utils/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') |
