Fixed #27836 -- Allowed FileSystemStorage.delete() to remove directories.

This commit is contained in:
chillaranand 2017-02-22 20:14:25 +05:30 committed by Tim Graham
parent 339d526d55
commit e4025563ea
2 changed files with 12 additions and 4 deletions

View file

@ -495,6 +495,11 @@ class FileStorageTests(SimpleTestCase):
with self.assertRaises(AssertionError):
self.storage.delete('')
def test_delete_deletes_directories(self):
tmp_dir = tempfile.TemporaryDirectory(dir=self.storage.location)
self.storage.delete(tmp_dir.name)
self.assertFalse(os.path.exists(tmp_dir.name))
@override_settings(
MEDIA_ROOT='media_root',
MEDIA_URL='media_url/',