Kaydet (Commit) b45852c2 authored tarafından Paul J Stevens's avatar Paul J Stevens Kaydeden (comit) Tim Graham

Refs #26772 -- Added a test for FileField reopening closed files.

Thanks Simon Charette for review.
üst cd217de6
......@@ -733,6 +733,14 @@ class FileFieldStorageTests(TestCase):
self.assertEqual(list(obj.normal.chunks(chunk_size=2)), [b"co", b"nt", b"en", b"t"])
obj.normal.close()
def test_filefield_reopen(self):
obj = Storage.objects.create(normal=SimpleUploadedFile('reopen.txt', b'content'))
with obj.normal as normal:
normal.open()
obj.normal.open()
obj.normal.file.seek(0)
obj.normal.close()
def test_duplicate_filename(self):
# Multiple files with the same name get _(7 random chars) appended to them.
objs = [Storage() for i in range(2)]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment