From 7aad3d3fa8a8db8eb8ea9e64134d60b2400029f0 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Tue, 1 Feb 2011 14:57:10 +0000 Subject: Fixed #15094 - Added check for forgetting trailing comma in STATICFILES_DIRS tuple. Also reorganized staticfiles settings-checks for better consistency. git-svn-id: http://code.djangoproject.com/svn/django/trunk@15386 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/staticfiles_tests/tests.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/regressiontests/staticfiles_tests/tests.py b/tests/regressiontests/staticfiles_tests/tests.py index ea1f6d2954..1fb043c715 100644 --- a/tests/regressiontests/staticfiles_tests/tests.py +++ b/tests/regressiontests/staticfiles_tests/tests.py @@ -10,8 +10,6 @@ from django.contrib.staticfiles import finders, storage from django.core.exceptions import ImproperlyConfigured from django.core.files.storage import default_storage from django.core.management import call_command -from django.db.models.loading import load_app -from django.template import Template, Context from django.test import TestCase from django.utils._os import rmtree_errorhandler @@ -383,7 +381,27 @@ class TestMiscFinder(TestCase): self.assertTrue(isinstance(finders.get_finder( 'django.contrib.staticfiles.finders.FileSystemFinder'), finders.FileSystemFinder)) + + def test_get_finder_bad_classname(self): self.assertRaises(ImproperlyConfigured, finders.get_finder, 'django.contrib.staticfiles.finders.FooBarFinder') + + def test_get_finder_bad_module(self): self.assertRaises(ImproperlyConfigured, finders.get_finder, 'foo.bar.FooBarFinder') + + +class TestStaticfilesDirsType(TestCase): + """ + We can't determine if STATICFILES_DIRS is set correctly just by looking at + the type, but we can determine if it's definitely wrong. + """ + def setUp(self): + self.old_settings_dir = settings.STATICFILES_DIRS + settings.STATICFILES_DIRS = 'a string' + + def tearDown(self): + settings.STATICFILES_DIRS = self.old_settings_dir + + def test_non_tuple_raises_exception(self): + self.assertRaises(ImproperlyConfigured, finders.FileSystemFinder) -- cgit v1.3