mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #24116 -- Moved AdminSite.check_dependencies() to system checks.
This commit is contained in:
committed by
Tim Graham
parent
956cde8004
commit
0490d72f2a
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user