summaryrefslogtreecommitdiff
path: root/tests/staticfiles_tests/test_management.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-01-03 18:27:50 -0500
committerTim Graham <timograham@gmail.com>2017-01-04 13:09:33 -0500
commita72fa7de3eddeb8791b5fdbc1f6576cae39d5ff5 (patch)
tree5b615af0143c943c7a051a5f6ad15a283212c47f /tests/staticfiles_tests/test_management.py
parentfe409c22e17562db8779a8fc11836a3bd29a160e (diff)
[1.10.x] Tested collectstatic's deleting of files/symlinks when toggling --link.
Backport of f60d4e704d71b8af3f5ed4651accd33851bdee23 from master
Diffstat (limited to 'tests/staticfiles_tests/test_management.py')
-rw-r--r--tests/staticfiles_tests/test_management.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/staticfiles_tests/test_management.py b/tests/staticfiles_tests/test_management.py
index d2ae7e2ed5..5eebdc8939 100644
--- a/tests/staticfiles_tests/test_management.py
+++ b/tests/staticfiles_tests/test_management.py
@@ -346,8 +346,8 @@ class TestCollectionLinks(TestDefaults, CollectionTestCase):
the standard file resolving tests here, to make sure using
``--link`` does not change the file-selection semantics.
"""
- def run_collectstatic(self, clear=False):
- super(TestCollectionLinks, self).run_collectstatic(link=True, clear=clear)
+ def run_collectstatic(self, clear=False, link=True, **kwargs):
+ super(TestCollectionLinks, self).run_collectstatic(link=link, clear=clear, **kwargs)
def test_links_created(self):
"""
@@ -364,6 +364,18 @@ class TestCollectionLinks(TestDefaults, CollectionTestCase):
self.run_collectstatic()
self.assertTrue(os.path.islink(path))
+ def test_symlinks_and_files_replaced(self):
+ """
+ Running collectstatic in non-symlink mode replaces symlinks with files,
+ while symlink mode replaces files with symlinks.
+ """
+ path = os.path.join(settings.STATIC_ROOT, 'test.txt')
+ self.assertTrue(os.path.islink(path))
+ self.run_collectstatic(link=False)
+ self.assertFalse(os.path.islink(path))
+ self.run_collectstatic(link=True)
+ self.assertTrue(os.path.islink(path))
+
def test_clear_broken_symlink(self):
"""
With ``--clear``, broken symbolic links are deleted.