feat: added tests
This commit is contained in:
+20
@@ -0,0 +1,20 @@
|
||||
import tempfile
|
||||
|
||||
import pytest
|
||||
from django.core.management import call_command
|
||||
from django.test import override_settings
|
||||
|
||||
|
||||
@pytest.fixture(scope='session', autouse=True)
|
||||
def collected_static_files():
|
||||
"""{% static %} (usado en pattern.html/pattern_detail.html) necesita el
|
||||
manifest que genera collectstatic cuando STORAGES['staticfiles'] es
|
||||
CompressedManifestStaticFilesStorage (ver settings.py); sin esto,
|
||||
cualquier test que renderice una de esas plantillas falla con
|
||||
"Missing staticfiles manifest entry". Se recopila a un directorio
|
||||
temporal (no al STATIC_ROOT real del proyecto) para no depender de ―ni
|
||||
tocar― lo que ya haya en config/static/."""
|
||||
with tempfile.TemporaryDirectory() as static_root:
|
||||
with override_settings(STATIC_ROOT=static_root):
|
||||
call_command('collectstatic', interactive=False, verbosity=0)
|
||||
yield
|
||||
Reference in New Issue
Block a user