summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2011-09-21 15:58:32 +0000
committerJannis Leidel <jannis@leidel.info>2011-09-21 15:58:32 +0000
commitc4cc8756437de2c9b508910ebe84f75a8d98d699 (patch)
tree45a83c2c0b6e9e6163aaad73b419ecffe9232dd6 /tests
parenteb5df8e98db5c5592d5f0a0ca4680f9368ed0db5 (diff)
Fixed #16703 -- Raise an exception if the storage location of the DefaultStorageFinder is empty.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16863 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/file_storage/tests.py8
-rw-r--r--tests/regressiontests/staticfiles_tests/tests.py11
2 files changed, 17 insertions, 2 deletions
diff --git a/tests/regressiontests/file_storage/tests.py b/tests/regressiontests/file_storage/tests.py
index f00d502931..6a7a46af21 100644
--- a/tests/regressiontests/file_storage/tests.py
+++ b/tests/regressiontests/file_storage/tests.py
@@ -96,6 +96,14 @@ class FileStorageTests(unittest.TestCase):
shutil.rmtree(self.temp_dir)
shutil.rmtree(self.temp_dir2)
+ def test_emtpy_location(self):
+ """
+ Makes sure an exception is raised if the location is empty
+ """
+ storage = self.storage_class(location='')
+ self.assertEqual(storage.base_location, '')
+ self.assertEqual(storage.location, os.getcwd())
+
def test_file_access_options(self):
"""
Standard file access options are available, and work as expected.
diff --git a/tests/regressiontests/staticfiles_tests/tests.py b/tests/regressiontests/staticfiles_tests/tests.py
index 8a179141b9..5c141f695a 100644
--- a/tests/regressiontests/staticfiles_tests/tests.py
+++ b/tests/regressiontests/staticfiles_tests/tests.py
@@ -496,6 +496,9 @@ class TestMiscFinder(TestCase):
"""
A few misc finder tests.
"""
+ def setUp(self):
+ default_storage._wrapped = empty
+
def test_get_finder(self):
self.assertTrue(isinstance(finders.get_finder(
'django.contrib.staticfiles.finders.FileSystemFinder'),
@@ -509,13 +512,17 @@ class TestMiscFinder(TestCase):
self.assertRaises(ImproperlyConfigured,
finders.get_finder, 'foo.bar.FooBarFinder')
+ @override_settings(STATICFILES_DIRS='a string')
def test_non_tuple_raises_exception(self):
"""
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.
"""
- with self.settings(STATICFILES_DIRS='a string'):
- self.assertRaises(ImproperlyConfigured, finders.FileSystemFinder)
+ self.assertRaises(ImproperlyConfigured, finders.FileSystemFinder)
+
+ @override_settings(MEDIA_ROOT='')
+ def test_location_empty(self):
+ self.assertRaises(ImproperlyConfigured, finders.DefaultStorageFinder)
class TestTemplateTag(StaticFilesTestCase):