summaryrefslogtreecommitdiff
path: root/tests/staticfiles_tests
diff options
context:
space:
mode:
authorLoic Bistuer <loic.bistuer@sixmedia.com>2013-12-10 00:29:39 +0700
committerTim Graham <timograham@gmail.com>2013-12-31 15:04:22 -0500
commit3fd16e6261f9c19a68ba69f1d97027a6eaf3a22b (patch)
tree02a9c77717acfe698a6c7dc4e2f1c95c9dc73aee /tests/staticfiles_tests
parenta228545026e30d3223b3fbb13a262b5e005101ae (diff)
[1.6.x] Fixed #21581 -- Fixed a number of issues with collectstatic.
When STATIC_ROOT wasn't set, collectstatic --clear would delete every files within the current directory and its descendants. This patch makes the following changes: Prevent collectstatic from running if STATIC_ROOT isn't set. Fixed an issue that prevented collectstatic from displaying the destination directory. Changed the warning header to notify when the command is run in dry-run mode. Backport of 4befb3015c from master
Diffstat (limited to 'tests/staticfiles_tests')
-rw-r--r--tests/staticfiles_tests/tests.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/staticfiles_tests/tests.py b/tests/staticfiles_tests/tests.py
index 912dcffe83..a2e50a1404 100644
--- a/tests/staticfiles_tests/tests.py
+++ b/tests/staticfiles_tests/tests.py
@@ -223,6 +223,17 @@ class TestFindStatic(CollectionTestCase, TestDefaults):
self.assertIn('apps', force_text(lines[1]))
+class TestConfiguration(StaticFilesTestCase):
+ def test_location_empty(self):
+ err = six.StringIO()
+ for root in ['', None]:
+ with override_settings(STATIC_ROOT=root):
+ with six.assertRaisesRegex(
+ self, ImproperlyConfigured,
+ 'without having set the STATIC_ROOT setting to a filesystem path'):
+ call_command('collectstatic', interactive=False, verbosity=0, stderr=err)
+
+
class TestCollection(CollectionTestCase, TestDefaults):
"""
Test ``collectstatic`` management command.