summaryrefslogtreecommitdiff
path: root/tests/admin_checks
diff options
context:
space:
mode:
authorVincenzo Pandolfo <pandolfovince@gmail.com>2015-12-10 12:45:21 +0000
committerTim Graham <timograham@gmail.com>2016-01-22 18:29:56 -0500
commit0490d72f2a309ee2c6d73cdc5aa5cc381e14ae98 (patch)
treed41cba82ed4b6154acedac8d2b3ba269347ec4d8 /tests/admin_checks
parent956cde800490d2d9e1e5fcc83755a9226de27f24 (diff)
downloaddjango-0490d72f2a309ee2c6d73cdc5aa5cc381e14ae98.tar.gz
Fixed #24116 -- Moved AdminSite.check_dependencies() to system checks.
Diffstat (limited to 'tests/admin_checks')
-rw-r--r--tests/admin_checks/tests.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/admin_checks/tests.py b/tests/admin_checks/tests.py
index 280af17e1f..56437c4a49 100644
--- a/tests/admin_checks/tests.py
+++ b/tests/admin_checks/tests.py
@@ -54,6 +54,44 @@ class SystemChecksTestCase(SimpleTestCase):
admin.site.unregister(Song)
admin.sites.system_check_errors = []
+ @override_settings(INSTALLED_APPS=['django.contrib.admin'])
+ def test_contenttypes_dependency(self):
+ errors = admin.checks.check_dependencies()
+ expected = [
+ checks.Error(
+ "'django.contrib.contenttypes' must be in "
+ "INSTALLED_APPS in order to use the admin application.",
+ id="admin.E401",
+ )
+ ]
+ self.assertEqual(errors, expected)
+
+ @override_settings(
+ INSTALLED_APPS=[
+ 'django.contrib.admin',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ ],
+ TEMPLATES=[{
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': [],
+ 'APP_DIRS': True,
+ 'OPTIONS': {
+ 'context_processors': [],
+ },
+ }],
+ )
+ def test_auth_contextprocessor_dependency(self):
+ errors = admin.checks.check_dependencies()
+ expected = [
+ checks.Error(
+ "'django.contrib.auth.context_processors.auth' must be in "
+ "TEMPLATES in order to use the admin application.",
+ id="admin.E402",
+ )
+ ]
+ self.assertEqual(errors, expected)
+
@override_settings(DEBUG=True)
def test_custom_adminsite(self):
class CustomAdminSite(admin.AdminSite):