File: test_checks.py

package info (click to toggle)
python-daphne 4.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 396 kB
  • sloc: python: 2,565; makefile: 25
file content (21 lines) | stat: -rw-r--r-- 698 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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"