summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/staticfiles_tests/test_management.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/staticfiles_tests/test_management.py b/tests/staticfiles_tests/test_management.py
index 4cca344490..6ac9794b34 100644
--- a/tests/staticfiles_tests/test_management.py
+++ b/tests/staticfiles_tests/test_management.py
@@ -179,6 +179,7 @@ class TestCollectionClear(CollectionTestCase):
class TestInteractiveMessages(CollectionTestCase):
overwrite_warning_msg = "This will overwrite existing files!"
delete_warning_msg = "This will DELETE ALL FILES in this location!"
+ files_copied_msg = "static files copied"
@staticmethod
def mock_input(stdout):
@@ -209,6 +210,26 @@ class TestInteractiveMessages(CollectionTestCase):
self.assertIn(self.overwrite_warning_msg, output)
self.assertNotIn(self.delete_warning_msg, output)
+ def test_no_warning_when_staticdir_does_not_exist(self):
+ stdout = six.StringIO()
+ shutil.rmtree(six.text_type(settings.STATIC_ROOT))
+ call_command('collectstatic', interactive=True, stdout=stdout)
+ output = force_text(stdout.getvalue())
+ self.assertNotIn(self.overwrite_warning_msg, output)
+ self.assertNotIn(self.delete_warning_msg, output)
+ self.assertIn(self.files_copied_msg, output)
+
+ def test_no_warning_for_empty_staticdir(self):
+ stdout = six.StringIO()
+ static_dir = tempfile.mkdtemp(prefix='collectstatic_empty_staticdir_test')
+ with override_settings(STATIC_ROOT=static_dir):
+ call_command('collectstatic', interactive=True, stdout=stdout)
+ shutil.rmtree(six.text_type(static_dir))
+ output = force_text(stdout.getvalue())
+ self.assertNotIn(self.overwrite_warning_msg, output)
+ self.assertNotIn(self.delete_warning_msg, output)
+ self.assertIn(self.files_copied_msg, output)
+
class TestCollectionExcludeNoDefaultIgnore(TestDefaults, CollectionTestCase):
"""