summaryrefslogtreecommitdiff
path: root/tests/staticfiles_tests/test_management.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-01-03 19:03:08 -0500
committerTim Graham <timograham@gmail.com>2017-01-04 12:50:31 -0500
commitc85831e4b7b5a7e4249df10327175b7251cb012d (patch)
treeadd2d3d1811666d40316a3b22bd08a58483e68e0 /tests/staticfiles_tests/test_management.py
parentf60d4e704d71b8af3f5ed4651accd33851bdee23 (diff)
Fixed #27658 -- Prevented collectstatic from overwriting newer files in remote storages.
Thanks revimi for the initial patch.
Diffstat (limited to 'tests/staticfiles_tests/test_management.py')
-rw-r--r--tests/staticfiles_tests/test_management.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/staticfiles_tests/test_management.py b/tests/staticfiles_tests/test_management.py
index eb0b83bca9..bbb8567c2a 100644
--- a/tests/staticfiles_tests/test_management.py
+++ b/tests/staticfiles_tests/test_management.py
@@ -399,6 +399,23 @@ class TestCollectionNonLocalStorage(TestNoFilesCreated, CollectionTestCase):
storage.path('name')
+class TestCollectionNeverCopyStorage(CollectionTestCase):
+
+ @override_settings(STATICFILES_STORAGE='staticfiles_tests.storage.NeverCopyRemoteStorage')
+ def test_skips_newer_files_in_remote_storage(self):
+ """
+ collectstatic skips newer files in a remote storage.
+ run_collectstatic() in setUp() copies the static files, then files are
+ always skipped after NeverCopyRemoteStorage is activated since
+ NeverCopyRemoteStorage.get_modified_time() returns a datetime in the
+ future to simulate an unmodified file.
+ """
+ stdout = six.StringIO()
+ self.run_collectstatic(stdout=stdout, verbosity=2)
+ output = force_text(stdout.getvalue())
+ self.assertIn("Skipping 'test.txt' (not modified)", output)
+
+
@unittest.skipUnless(symlinks_supported(), "Must be able to symlink to run this test.")
class TestCollectionLinks(TestDefaults, CollectionTestCase):
"""