Debian Codegraph @

debian/tests/smoke-import

raw
1 #!/bin/sh
2 # Superficial smoke test: confirm the widget can be imported and instantiated
3 # under a minimal Django environment.
4 set -eu
5
6 cd "$AUTOPKGTEST_TMP"
7
8 cat > settings.py <<'EOF'
9 SECRET_KEY = "autopkgtest"
10 INSTALLED_APPS = [
11 "django.contrib.contenttypes",
12 "django.contrib.auth",
13 "django_json_widget",
14 ]
15 DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:"}}
16 USE_TZ = True
17 EOF
18
19 DJANGO_SETTINGS_MODULE=settings python3 - <<'EOF'
20 import django
21 django.setup()
22 from django_json_widget.widgets import JSONEditorWidget
23
24 widget = JSONEditorWidget()
25 assert widget.template_name == "django_json_widget.html"
26 assert "modes" in widget.options
27 print("OK")
28 EOF