diff options
| author | Paul J Stevens <p.stevens@lukkien.com> | 2016-06-17 10:30:40 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-06-18 12:46:42 -0400 |
| commit | d3b9c499194ea0d7902148c61de3997c0fcea821 (patch) | |
| tree | 9ec2224cba048950967645c9f38b4e55fe28bb66 | |
| parent | e2b266fdf78141a45277fb1664a6d430d7731c09 (diff) | |
[1.10.x] Refs #26772 -- Added a test for FileField reopening closed files.
Thanks Simon Charette for review.
Backport of b45852c2631d4f291fb22ef3348065f2a3c2e5e3 from master
| -rw-r--r-- | tests/file_storage/tests.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/file_storage/tests.py b/tests/file_storage/tests.py index ee708d5350..dcd27de5c7 100644 --- a/tests/file_storage/tests.py +++ b/tests/file_storage/tests.py @@ -735,6 +735,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)] |
