summaryrefslogtreecommitdiff
path: root/tests/staticfiles_tests
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-03-17 07:55:00 -0400
committerGitHub <noreply@github.com>2017-03-17 07:55:00 -0400
commitb536dcf6568ceb4d8aad22cd4e1d38c850980fb4 (patch)
treee6a629849830d436fc2d1cccd8a2387ef43f1b09 /tests/staticfiles_tests
parent6b4f018b2b3478d2a4a441ed52d43f6268ac89f3 (diff)
Fixed #27948 -- Removed incorrect unquote() in static serving views.
Diffstat (limited to 'tests/staticfiles_tests')
-rw-r--r--tests/staticfiles_tests/apps/test/static/test/%2F.txt1
-rw-r--r--tests/staticfiles_tests/cases.py3
-rw-r--r--tests/staticfiles_tests/test_views.py4
3 files changed, 6 insertions, 2 deletions
diff --git a/tests/staticfiles_tests/apps/test/static/test/%2F.txt b/tests/staticfiles_tests/apps/test/static/test/%2F.txt
new file mode 100644
index 0000000000..d98b646c7c
--- /dev/null
+++ b/tests/staticfiles_tests/apps/test/static/test/%2F.txt
@@ -0,0 +1 @@
+%2F content
diff --git a/tests/staticfiles_tests/cases.py b/tests/staticfiles_tests/cases.py
index 81faf6d7d9..3adf5cf211 100644
--- a/tests/staticfiles_tests/cases.py
+++ b/tests/staticfiles_tests/cases.py
@@ -128,3 +128,6 @@ class TestDefaults:
Can find a file with capital letters.
"""
self.assertFileContains('test/camelCase.txt', 'camelCase')
+
+ def test_filename_with_percent_sign(self):
+ self.assertFileContains('test/%2F.txt', '%2F content')
diff --git a/tests/staticfiles_tests/test_views.py b/tests/staticfiles_tests/test_views.py
index fa817a6ef1..d16f4a2cec 100644
--- a/tests/staticfiles_tests/test_views.py
+++ b/tests/staticfiles_tests/test_views.py
@@ -1,4 +1,5 @@
import posixpath
+from urllib.parse import quote
from django.conf import settings
from django.test import override_settings
@@ -12,8 +13,7 @@ class TestServeStatic(StaticFilesTestCase):
Test static asset serving view.
"""
def _response(self, filepath):
- return self.client.get(
- posixpath.join(settings.STATIC_URL, filepath))
+ return self.client.get(quote(posixpath.join(settings.STATIC_URL, filepath)))
def assertFileContains(self, filepath, text):
self.assertContains(self._response(filepath), text)