1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Refs #34100 -- Made file upload tests use Storage.exists() where appropriate.

This commit is contained in:
Francesco Panico
2022-12-30 12:47:59 +01:00
committed by Mariusz Felisiak
parent 6e9e7ec472
commit c179ad9fe7
4 changed files with 17 additions and 9 deletions

View File

@@ -120,9 +120,12 @@ class FileFieldTests(TestCase):
with TemporaryUploadedFile(
"foo.txt", "text/plain", 1, "utf-8"
) as tmp_file:
Document.objects.create(myfile=tmp_file)
self.assertTrue(
os.path.exists(os.path.join(tmp_dir, "unused", "foo.txt"))
document = Document.objects.create(myfile=tmp_file)
self.assertIs(
document.myfile.storage.exists(
os.path.join("unused", "foo.txt")
),
True,
)
def test_pickle(self):