summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Schaffer <timshaffer@me.com>2014-06-10 22:52:14 +0200
committerClaude Paroz <claude@2xlibre.net>2014-06-10 23:04:24 +0200
commita1c6cd6a167f90fc4dfd76b2a2de87bc617b26e6 (patch)
tree3d6f0db87112c591d3c8a16dfdc4a04a4acc2f75 /tests
parent868ff4e37c1e4cfaf7283496c24f6e711ad66005 (diff)
Fixed #22780 -- Checked that LOCALE_PATHS is really a tuple
Diffstat (limited to 'tests')
-rw-r--r--tests/settings_tests/tests.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/settings_tests/tests.py b/tests/settings_tests/tests.py
index 6b2ca3e0a5..dc0d2a4e99 100644
--- a/tests/settings_tests/tests.py
+++ b/tests/settings_tests/tests.py
@@ -436,3 +436,24 @@ class IsOverriddenTest(TestCase):
self.assertFalse(settings.is_overridden('TEMPLATE_LOADERS'))
with override_settings(TEMPLATE_LOADERS=[]):
self.assertTrue(settings.is_overridden('TEMPLATE_LOADERS'))
+
+
+class TestTupleSettings(unittest.TestCase):
+ """
+ Make sure settings that should be tuples throw ImproperlyConfigured if they
+ are set to a string instead of a tuple.
+ """
+ tuple_settings = ("INSTALLED_APPS", "TEMPLATE_DIRS", "LOCALE_PATHS")
+
+ def test_tuple_settings(self):
+ settings_module = ModuleType('fake_settings_module')
+ settings_module.SECRET_KEY = 'foo'
+ for setting in self.tuple_settings:
+ setattr(settings_module, setting, ('non_tuple_value'))
+ sys.modules['fake_settings_module'] = settings_module
+ try:
+ with self.assertRaises(ImproperlyConfigured):
+ s = Settings('fake_settings_module')
+ finally:
+ del sys.modules['fake_settings_module']
+ delattr(settings_module, setting)