summaryrefslogtreecommitdiff
path: root/tests/admin_docs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/admin_docs')
-rw-r--r--tests/admin_docs/tests.py18
1 files changed, 5 insertions, 13 deletions
diff --git a/tests/admin_docs/tests.py b/tests/admin_docs/tests.py
index 047bf920a2..66c125490f 100644
--- a/tests/admin_docs/tests.py
+++ b/tests/admin_docs/tests.py
@@ -4,6 +4,7 @@ from django.conf import settings
from django.contrib.sites.models import Site
from django.contrib.admindocs import utils
from django.contrib.auth.models import User
+from django.core.apps import app_cache
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.utils import override_settings
@@ -13,27 +14,18 @@ class MiscTests(TestCase):
urls = 'admin_docs.urls'
def setUp(self):
- self._old_installed = Site._meta.app_config.installed
User.objects.create_superuser('super', None, 'secret')
self.client.login(username='super', password='secret')
- def tearDown(self):
- Site._meta.app_config.installed = self._old_installed
-
- @override_settings(
- SITE_ID=None,
- INSTALLED_APPS=[app for app in settings.INSTALLED_APPS
- if app != 'django.contrib.sites'],
- )
def test_no_sites_framework(self):
"""
Without the sites framework, should not access SITE_ID or Site
objects. Deleting settings is fine here as UserSettingsHolder is used.
"""
- Site._meta.app_config.installed = False
- Site.objects.all().delete()
- del settings.SITE_ID
- self.client.get('/admindocs/views/') # should not raise
+ with self.settings(SITE_ID=None), app_cache._without_app('django.contrib.sites'):
+ Site.objects.all().delete()
+ del settings.SITE_ID
+ self.client.get('/admindocs/views/') # should not raise
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))