summaryrefslogtreecommitdiff
path: root/tests/settings_tests
diff options
context:
space:
mode:
authororlnub123 <orlnub123@gmail.com>2019-03-03 03:23:18 +0300
committerTim Graham <timograham@gmail.com>2019-03-05 09:52:08 -0500
commit163236ea0e5df1a301371e79ec35fc67b7a1b7a6 (patch)
tree94a199d0bb179db36485a8ecbe370550122102f6 /tests/settings_tests
parent9681e968ebdcd58cac99c1e60f0a6932abd4e5c9 (diff)
Fixed #30234 -- Disallowed non-upper settings in settings.configure().
Diffstat (limited to 'tests/settings_tests')
-rw-r--r--tests/settings_tests/tests.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/settings_tests/tests.py b/tests/settings_tests/tests.py
index bfd580b600..280f46f2aa 100644
--- a/tests/settings_tests/tests.py
+++ b/tests/settings_tests/tests.py
@@ -1,7 +1,7 @@
import os
import sys
import unittest
-from types import ModuleType
+from types import ModuleType, SimpleNamespace
from unittest import mock
from django.conf import ENVIRONMENT_VARIABLE, LazySettings, Settings, settings
@@ -318,6 +318,17 @@ class SettingsTests(SimpleTestCase):
with self.assertRaisesMessage(RuntimeError, 'Settings already configured.'):
settings.configure()
+ def test_nonupper_settings_prohibited_in_configure(self):
+ s = LazySettings()
+ with self.assertRaisesMessage(TypeError, "Setting 'foo' must be uppercase."):
+ s.configure(foo='bar')
+
+ def test_nonupper_settings_ignored_in_default_settings(self):
+ s = LazySettings()
+ s.configure(SimpleNamespace(foo='bar'))
+ with self.assertRaises(AttributeError):
+ getattr(s, 'foo')
+
@requires_tz_support
@mock.patch('django.conf.global_settings.TIME_ZONE', 'test')
def test_incorrect_timezone(self):