mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Dropped AppCache._empty, _with_app and _without_app.
It's now easier to achieve the same effect with modify_settings or override_settings.
This commit is contained in:
parent
5241763c81
commit
da16bb30ff
21 changed files with 121 additions and 228 deletions
|
@ -1,13 +1,12 @@
|
|||
import unittest
|
||||
|
||||
from django.apps import app_cache
|
||||
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.urlresolvers import reverse
|
||||
from django.test import TestCase
|
||||
from django.test.utils import override_settings
|
||||
from django.test.utils import modify_settings, override_settings
|
||||
|
||||
|
||||
class MiscTests(TestCase):
|
||||
|
@ -17,15 +16,16 @@ class MiscTests(TestCase):
|
|||
User.objects.create_superuser('super', None, 'secret')
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
@modify_settings(INSTALLED_APPS={'remove': 'django.contrib.sites'})
|
||||
@override_settings(SITE_ID=None) # will restore SITE_ID after the test
|
||||
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.
|
||||
"""
|
||||
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
|
||||
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',))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue