diff options
| author | Carl Meyer <carl@oddbird.net> | 2011-02-01 14:57:10 +0000 |
|---|---|---|
| committer | Carl Meyer <carl@oddbird.net> | 2011-02-01 14:57:10 +0000 |
| commit | 7aad3d3fa8a8db8eb8ea9e64134d60b2400029f0 (patch) | |
| tree | e940c9be08092ce944c21c07de0ef8a368578146 /tests | |
| parent | 74d485c4ec2b754578482af98e3e8258d1575ad0 (diff) | |
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
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/staticfiles_tests/tests.py | 22 |
1 files changed, 20 insertions, 2 deletions
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) |
