diff options
| author | François Freitag <francois.freitag@polyconseil.fr> | 2016-08-26 17:54:06 -0700 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-09-02 14:53:18 -0400 |
| commit | 8c054ed71d579aef53e074fcdaea56f110f1764e (patch) | |
| tree | 84539f811afb3f0e56d7d74c923b3ec9cb33a7dd /tests/staticfiles_tests | |
| parent | f02dbbe1ae02c3258fced7b7a75d35d7745cc02a (diff) | |
Fixed #27108 -- Displayed collectstatic's delete/overwrite warnings only if some files exist in STATIC_ROOT.
Diffstat (limited to 'tests/staticfiles_tests')
| -rw-r--r-- | tests/staticfiles_tests/test_management.py | 21 |
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): """ |
