Add test case for admin disabled
This commit is contained in:
parent
a316eb928b
commit
d50952a6e5
1 changed files with 20 additions and 0 deletions
|
@ -13,3 +13,23 @@ class ContextInjectorTestCase(BaseTestCase):
|
||||||
for key in SETTINGS_KEYS:
|
for key in SETTINGS_KEYS:
|
||||||
self.assertIn(key, response.context['django_settings'])
|
self.assertIn(key, response.context['django_settings'])
|
||||||
self.assertEqual(response.context['django_settings'][key], getattr(settings, key))
|
self.assertEqual(response.context['django_settings'][key], getattr(settings, key))
|
||||||
|
|
||||||
|
|
||||||
|
class DjangoAdminDisabledTestCase(BaseTestCase):
|
||||||
|
def test_admin_enabled(self):
|
||||||
|
with self.settings(ENABLE_ADMIN=True):
|
||||||
|
response = self.client.get('/django-admin/login/', follow=True)
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
with self.settings(DEBUG=True):
|
||||||
|
response = self.client.get('/django-admin/login/', follow=True)
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
def test_admin_disabled(self):
|
||||||
|
with self.settings(ENABLE_ADMIN=False):
|
||||||
|
response = self.client.get('/django-admin/login/', follow=True)
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
with self.settings(DEBUG=False):
|
||||||
|
response = self.client.get('/django-admin/login/', follow=True)
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
Reference in a new issue