From 2ac89012d8ff750ea5443b6f6f347dacb697e059 Mon Sep 17 00:00:00 2001 From: SusanTan Date: Wed, 7 Aug 2013 01:07:16 -0700 Subject: Fixed #12288 -- Added unique validation for INSTALLED_APPS --- tests/settings_tests/tests.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests') diff --git a/tests/settings_tests/tests.py b/tests/settings_tests/tests.py index 3673031447..4031d09a58 100644 --- a/tests/settings_tests/tests.py +++ b/tests/settings_tests/tests.py @@ -226,6 +226,27 @@ class TestComplexSettingOverride(TestCase): self.assertEqual('Overriding setting TEST_WARN can lead to unexpected behaviour.', str(w[-1].message)) +class UniqueSettngsTests(TestCase): + """ + Tests for the INSTALLED_APPS setting. + """ + settings_module = settings + + def setUp(self): + self._installed_apps = self.settings_module.INSTALLED_APPS + + def tearDown(self): + self.settings_module.INSTALLED_APPS = self._installed_apps + + def test_unique(self): + """ + An ImproperlyConfigured exception is raised if the INSTALLED_APPS contains + any duplicate strings. + """ + with self.assertRaises(ImproperlyConfigured): + self.settings_module.INSTALLED_APPS = ("myApp1", "myApp1", "myApp2", "myApp3") + + class TrailingSlashURLTests(TestCase): """ Tests for the MEDIA_URL and STATIC_URL settings. -- cgit v1.3