summaryrefslogtreecommitdiff
path: root/tests/staticfiles_tests/test_management.py
diff options
context:
space:
mode:
authorMads Jensen <mje@inducks.org>2018-01-15 13:37:03 +0100
committerTim Graham <timograham@gmail.com>2018-01-15 11:15:14 -0500
commit59b1aaa5a5136702f5b7b2ab718d91128473b9c3 (patch)
tree6cca575d820f096febd0855a9c4fb8b82add2587 /tests/staticfiles_tests/test_management.py
parent4fcd28d442c2fec56f544f99cb658f33f847824c (diff)
Added a couple tests for collectstatic.
Diffstat (limited to 'tests/staticfiles_tests/test_management.py')
-rw-r--r--tests/staticfiles_tests/test_management.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/staticfiles_tests/test_management.py b/tests/staticfiles_tests/test_management.py
index 54c271b793..a6db5ef1c5 100644
--- a/tests/staticfiles_tests/test_management.py
+++ b/tests/staticfiles_tests/test_management.py
@@ -15,7 +15,7 @@ from django.contrib.staticfiles.management.commands import (
collectstatic, runserver,
)
from django.core.exceptions import ImproperlyConfigured
-from django.core.management import call_command
+from django.core.management import CommandError, call_command
from django.test import override_settings
from django.test.utils import extend_sys_path
from django.utils import timezone
@@ -237,6 +237,12 @@ class TestInteractiveMessages(CollectionTestCase):
self.assertNotIn(self.delete_warning_msg, output)
self.assertIn(self.files_copied_msg, output)
+ def test_cancelled(self):
+ self.run_collectstatic()
+ with mock.patch('builtins.input', side_effect=lambda _: 'no'):
+ with self.assertRaisesMessage(CommandError, 'Collecting static files cancelled'):
+ call_command('collectstatic', interactive=True)
+
class TestCollectionExcludeNoDefaultIgnore(TestDefaults, CollectionTestCase):
"""
@@ -467,3 +473,8 @@ class TestCollectionLinks(TestDefaults, CollectionTestCase):
os.symlink(nonexistent_file_path, broken_symlink_path)
self.run_collectstatic(clear=True)
self.assertFalse(os.path.lexists(broken_symlink_path))
+
+ @override_settings(STATICFILES_STORAGE='staticfiles_tests.storage.PathNotImplementedStorage')
+ def test_no_remote_link(self):
+ with self.assertRaisesMessage(CommandError, "Can't symlink to a remote destination."):
+ self.run_collectstatic()