From 7fbab3ebaf8b60bbe847b772f895df47067a60d3 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Thu, 27 Jun 2013 10:59:30 +0200 Subject: Do not allow FileSystemStorage.delete to receive an empty name Refs #20660. --- tests/file_storage/tests.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests') diff --git a/tests/file_storage/tests.py b/tests/file_storage/tests.py index 6c3c559660..e6caabf9d9 100644 --- a/tests/file_storage/tests.py +++ b/tests/file_storage/tests.py @@ -364,6 +364,14 @@ class FileStorageTests(unittest.TestCase): with self.assertRaises(IOError): self.storage.save('error.file', f1) + def test_delete_no_name(self): + """ + Calling delete with an empty name should not try to remove the base + storage directory, but fail loudly (#20660). + """ + with self.assertRaises(AssertionError): + self.storage.delete('') + class CustomStorage(FileSystemStorage): def get_available_name(self, name): -- cgit v1.3