summaryrefslogtreecommitdiff
path: root/tests/files/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/files/tests.py')
-rw-r--r--tests/files/tests.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/files/tests.py b/tests/files/tests.py
index 5e165a998f..a414a81ad3 100644
--- a/tests/files/tests.py
+++ b/tests/files/tests.py
@@ -12,7 +12,8 @@ from django.core.files.base import ContentFile
from django.core.files.move import file_move_safe
from django.core.files.temp import NamedTemporaryFile
from django.core.files.uploadedfile import (
- InMemoryUploadedFile, SimpleUploadedFile, UploadedFile,
+ InMemoryUploadedFile, SimpleUploadedFile, TemporaryUploadedFile,
+ UploadedFile,
)
try:
@@ -214,6 +215,13 @@ class InMemoryUploadedFileTests(unittest.TestCase):
self.assertEqual(f.read(), '1')
+class TemporaryUploadedFileTests(unittest.TestCase):
+ def test_extension_kept(self):
+ """The temporary file name has the same suffix as the original file."""
+ with TemporaryUploadedFile('test.txt', 'text/plain', 1, 'utf8') as temp_file:
+ self.assertTrue(temp_file.file.name.endswith('.upload.txt'))
+
+
class DimensionClosingBug(unittest.TestCase):
"""
get_image_dimensions() properly closes files (#8817)