Ticket #22780: ticket_22780_test.diff

File ticket_22780_test.diff, 1.1 KB (added by Tim Shaffer, 10 years ago)
  • tests/settings_tests/tests.py

    diff --git a/tests/settings_tests/tests.py b/tests/settings_tests/tests.py
    index 6b2ca3e..d9df8f7 100644
    a b class IsOverriddenTest(TestCase):  
    436436        self.assertFalse(settings.is_overridden('TEMPLATE_LOADERS'))
    437437        with override_settings(TEMPLATE_LOADERS=[]):
    438438            self.assertTrue(settings.is_overridden('TEMPLATE_LOADERS'))
     439
     440
     441class TestTupleSettings(TestCase):
     442    """
     443    Make sure settings that should be tuples throw ImproperlyConfigured if they
     444    are set to a string instead of a tuple.
     445    """
     446
     447    def test_locale_paths_string(self):
     448        settings_module = ModuleType('fake_settings_module')
     449        settings_module.SECRET_KEY = 'foo'
     450        settings_module.LOCALE_PATHS = ('/path/to/locale/')
     451        sys.modules['fake_settings_module'] = settings_module
     452        try:
     453            with self.assertRaises(ImproperlyConfigured):
     454                s = Settings('fake_settings_module')
     455        finally:
     456            del sys.modules['fake_settings_module']
Back to Top