1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #19031 -- Added a warning when using override_settings with 'DATABASES'

This commit is contained in:
Joeri Bekker
2013-05-18 13:43:51 +02:00
committed by Tim Graham
parent b82a2c4138
commit 66f3d57b79
6 changed files with 64 additions and 4 deletions

View File

@@ -203,6 +203,29 @@ class SettingsTests(TestCase):
'ALLOWED_INCLUDE_ROOTS', '/var/www/ssi/')
class TestComplexSettingOverride(TestCase):
def setUp(self):
self.old_warn_override_settings = signals.COMPLEX_OVERRIDE_SETTINGS.copy()
signals.COMPLEX_OVERRIDE_SETTINGS.add('TEST_WARN')
def tearDown(self):
signals.COMPLEX_OVERRIDE_SETTINGS = self.old_warn_override_settings
self.assertFalse('TEST_WARN' in signals.COMPLEX_OVERRIDE_SETTINGS)
def test_complex_override_warning(self):
"""Regression test for #19031"""
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
override = override_settings(TEST_WARN='override')
override.enable()
self.assertEqual('override', settings.TEST_WARN)
override.disable()
self.assertEqual(len(w), 1)
self.assertEqual('Overriding setting TEST_WARN can lead to unexpected behaviour.', str(w[-1].message))
class TrailingSlashURLTests(TestCase):
"""
Tests for the MEDIA_URL and STATIC_URL settings.