Also allowed a non-overridden setting to be deleted

Refs #20032, #18824. Thanks ztorstri at gmail.com for the report.
This commit is contained in:
Claude Paroz 2014-04-12 15:31:37 +02:00
parent 3e3a7372f5
commit 3417ba0309
3 changed files with 13 additions and 2 deletions

View file

@ -232,10 +232,15 @@ class SettingsTests(TestCase):
Allow deletion of a setting in an overridden settings set (#18824)
"""
previous_i18n = settings.USE_I18N
previous_l10n = settings.USE_L10N
with self.settings(USE_I18N=False):
del settings.USE_I18N
self.assertRaises(AttributeError, getattr, settings, 'USE_I18N')
# Should also work for a non-overridden setting
del settings.USE_L10N
self.assertRaises(AttributeError, getattr, settings, 'USE_L10N')
self.assertEqual(settings.USE_I18N, previous_i18n)
self.assertEqual(settings.USE_L10N, previous_l10n)
def test_override_settings_nested(self):
"""