summaryrefslogtreecommitdiff
path: root/tests/staticfiles_tests
diff options
context:
space:
mode:
authoraryabartar <bartararya@gmail.com>2021-06-05 17:00:04 +0430
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-06-07 07:56:20 +0200
commit651e527f9b3bc93f04ead654ca215d4252e25fb6 (patch)
treeb9f026dcad6bead1ced681f08a9726b1999a420b /tests/staticfiles_tests
parent7272e1963ffdf39c1d4fe225d5425a45dd095d11 (diff)
downloaddjango-651e527f9b3bc93f04ead654ca215d4252e25fb6.tar.gz
Fixed #32716 -- Fixed ManifestStaticFilesStorage crash when max_post_process_passes is 0.
Diffstat (limited to 'tests/staticfiles_tests')
-rw-r--r--tests/staticfiles_tests/storage.py4
-rw-r--r--tests/staticfiles_tests/test_storage.py12
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/staticfiles_tests/storage.py b/tests/staticfiles_tests/storage.py
index 79f406ca6c..6a319f934d 100644
--- a/tests/staticfiles_tests/storage.py
+++ b/tests/staticfiles_tests/storage.py
@@ -97,3 +97,7 @@ class ExtraPatternsStorage(ManifestStaticFilesStorage):
class NoneHashStorage(ManifestStaticFilesStorage):
def file_hash(self, name, content=None):
return None
+
+
+class NoPostProcessReplacedPathStorage(ManifestStaticFilesStorage):
+ max_post_process_passes = 0
diff --git a/tests/staticfiles_tests/test_storage.py b/tests/staticfiles_tests/test_storage.py
index db655f2453..d5aa1c1c9d 100644
--- a/tests/staticfiles_tests/test_storage.py
+++ b/tests/staticfiles_tests/test_storage.py
@@ -463,6 +463,18 @@ class TestCollectionNoneHashStorage(CollectionTestCase):
self.assertEqual(relpath, 'cached/styles.css')
+@override_settings(
+ STATICFILES_STORAGE='staticfiles_tests.storage.NoPostProcessReplacedPathStorage'
+)
+class TestCollectionNoPostProcessReplacedPaths(CollectionTestCase):
+ run_collectstatic_in_setUp = False
+
+ def test_collectstatistic_no_post_process_replaced_paths(self):
+ stdout = StringIO()
+ self.run_collectstatic(verbosity=1, stdout=stdout)
+ self.assertIn('post-processed', stdout.getvalue())
+
+
@override_settings(STATICFILES_STORAGE='staticfiles_tests.storage.SimpleStorage')
class TestCollectionSimpleStorage(CollectionTestCase):
hashed_file_path = hashed_file_path