From 6ca163d7cc451fafd3015fa2ee735d5377fa3065 Mon Sep 17 00:00:00 2001 From: Alex Morozov Date: Fri, 20 Nov 2015 23:59:34 +0300 Subject: Fixed #25784 -- Prevented an exception on collectstatic help Made the `manage.py help collectstatic` don't fail if the `STATIC_ROOT` setting is empty. --- tests/staticfiles_tests/test_management.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests') diff --git a/tests/staticfiles_tests/test_management.py b/tests/staticfiles_tests/test_management.py index 94166f9888..7c1c4223d0 100644 --- a/tests/staticfiles_tests/test_management.py +++ b/tests/staticfiles_tests/test_management.py @@ -6,6 +6,8 @@ import shutil import tempfile import unittest +from admin_scripts.tests import AdminScriptTestCase + from django.conf import settings from django.contrib.staticfiles import storage from django.contrib.staticfiles.management.commands import collectstatic @@ -130,6 +132,18 @@ class TestConfiguration(StaticFilesTestCase): storage.staticfiles_storage = staticfiles_storage +class TestCollectionHelpSubcommand(AdminScriptTestCase): + @override_settings(STATIC_ROOT=None) + def test_missing_settings_dont_prevent_help(self): + """ + Even if the STATIC_ROOT setting is not set, one can still call the + `manage.py help collectstatic` command. + """ + self.write_settings('settings.py', apps=['django.contrib.staticfiles']) + out, err = self.run_manage(['help', 'collectstatic']) + self.assertNoOutput(err) + + class TestCollection(CollectionTestCase, TestDefaults): """ Test ``collectstatic`` management command. -- cgit v1.3