diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2008-08-27 22:21:14 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2008-08-27 22:21:14 +0000 |
| commit | ff420b43647dd7f149f000efd2c7eb077f6ba5cf (patch) | |
| tree | 5e183421e0d4b78fa607f5b0fd664c3d3b2c7f29 /tests | |
| parent | f58217cc02fe6779a69bdf092ce6095bb368401c (diff) | |
Fixed #8454: added a FILE_UPLOAD_PERMISSIONS setting to control the permissoin of files uploaded by the built-in file storage system. Thanks, dcwatson.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8640 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/file_storage/tests.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/regressiontests/file_storage/tests.py b/tests/regressiontests/file_storage/tests.py index 3f059c7f3c..181c551c24 100644 --- a/tests/regressiontests/file_storage/tests.py +++ b/tests/regressiontests/file_storage/tests.py @@ -86,9 +86,10 @@ u'custom_storage.2' # Tests for a race condition on file saving (#4948). # This is written in such a way that it'll always pass on platforms # without threading. - +import os import time from unittest import TestCase +from django.conf import settings from django.core.files.base import ContentFile from models import temp_storage try: @@ -117,3 +118,15 @@ class FileSaveRaceConditionTest(TestCase): temp_storage.delete('conflict') temp_storage.delete('conflict_') +class FileStoragePermissions(TestCase): + def setUp(self): + self.old_perms = settings.FILE_UPLOAD_PERMISSIONS + settings.FILE_UPLOAD_PERMISSIONS = 0666 + + def test_file_upload_permissions(self): + name = temp_storage.save("the_file", ContentFile("data")) + actual_mode = os.stat(temp_storage.path(name))[0] & 0777 + self.assertEqual(actual_mode, 0666) + + def tearDown(self): + settings.FILE_UPLOAD_PERMISSIONS = self.old_perms
\ No newline at end of file |
