summaryrefslogtreecommitdiff
path: root/tests/admin_docs
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-12-18 13:16:33 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-12-22 11:39:17 +0100
commit9b3389b7268e48c16ed79256e516af787ad652df (patch)
treeb26a26e29dcb05d61d586ef91c9257360921bb5a /tests/admin_docs
parent972babc3b45971a69a6b2a49fc498d92db674cae (diff)
Removed the app_config.installed flag.
Since applications that aren't installed no longer have an application configuration, it is now always True in practice. Provided an abstraction to temporarily add or remove applications as several tests messed with app_config.installed to achieve this effect. For now this API is _-prefixed because it looks dangerous.
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',))