mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-18 05:51:26 +02:00
Do not deploy frontend during tests
This commit is contained in:
@@ -51,6 +51,12 @@ class Command(BaseCommand):
|
||||
default=False,
|
||||
help="Setup dev environment. DO NOT USE IN PRODUCTION",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--no-frontend",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help="Omit everything related to frontend initialisation",
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
"""Command entry point."""
|
||||
@@ -90,6 +96,14 @@ class Command(BaseCommand):
|
||||
else:
|
||||
signals.initial_data_loaded.send(sender=self.__class__, extname=extname)
|
||||
|
||||
if options["extra_fixtures"]:
|
||||
from modoboa.admin import factories
|
||||
|
||||
factories.populate_database()
|
||||
|
||||
if options["no_frontend"]:
|
||||
return
|
||||
|
||||
app_model = get_application_model()
|
||||
allowed_host = getattr(settings, "ALLOWED_HOSTS", None)
|
||||
if allowed_host is not None:
|
||||
@@ -136,8 +150,3 @@ class Command(BaseCommand):
|
||||
}}
|
||||
"""
|
||||
)
|
||||
|
||||
if options["extra_fixtures"]:
|
||||
from modoboa.admin import factories
|
||||
|
||||
factories.populate_database()
|
||||
|
||||
@@ -65,7 +65,7 @@ class ModoTestCase(ParametersMixin, TestCase):
|
||||
def setUpTestData(cls): # noqa
|
||||
"""Create a default user."""
|
||||
super(ModoTestCase, cls).setUpTestData()
|
||||
management.call_command("load_initial_data")
|
||||
management.call_command("load_initial_data", "--no-frontend")
|
||||
|
||||
def setUp(self, username="admin", password="password"):
|
||||
"""Initiate test context."""
|
||||
|
||||
Reference in New Issue
Block a user