daphne/tests/test_checks.py
Carlton Gibson 2b13b74ce2
Added runserver to Daphne. (#429)
* Made daphne installable as a Django app.
* Added system check to ensure daphne is installed before
  django.contrib.staticfiles.
* Moved runserver command from Channels.
* Added changelog entry for runserver command.
2022-08-08 14:10:03 +02:00

22 lines
698 B
Python

import django
from django.conf import settings
from django.test.utils import override_settings
from daphne.checks import check_daphne_installed
def test_check_daphne_installed():
"""
Test check error is raised if daphne is not listed before staticfiles, and vice versa.
"""
settings.configure(
INSTALLED_APPS=["daphne.apps.DaphneConfig", "django.contrib.staticfiles"]
)
django.setup()
errors = check_daphne_installed(None)
assert len(errors) == 0
with override_settings(INSTALLED_APPS=["django.contrib.staticfiles", "daphne"]):
errors = check_daphne_installed(None)
assert len(errors) == 1
assert errors[0].id == "daphne.E001"