Skip to content

Commit

Permalink
Add test for collectstatic
Browse files Browse the repository at this point in the history
  • Loading branch information
atodorov committed Aug 31, 2023
1 parent 5d0e57b commit 0dbcc40
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tcms/core/tests/test_collectstatic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import tempfile

from django.conf import settings
from django.core.management import call_command
from django.test import TestCase, override_settings
from parameterized import parameterized


class TestCollectstatic(TestCase):
"""
Test manage.py collectstatic --noinput --link
with different versions of STATICFILES_STORAGE. See
https://github.com/sehmaschine/django-grappelli/issues/1022
"""

@parameterized.expand(
[
"django.contrib.staticfiles.storage.StaticFilesStorage",
"django.contrib.staticfiles.storage.ManifestStaticFilesStorage",
"tcms.tests.storage.RaiseWhenFileNotFound",
]
)
def test_collect_static(self, storage): # pylint: disable=no-self-use
with override_settings(
STATICFILES_STORAGE=storage,
STATIC_ROOT=tempfile.mkdtemp(),
STATICFILES_DIRS=[ # pylint: disable=avoid-list-comprehension
dir
for dir in settings.STATICFILES_DIRS
if not dir.endswith("node_modules")
],
):
call_command("collectstatic", "--noinput", "--link")

0 comments on commit 0dbcc40

Please sign in to comment.