MCPcopy
hub / github.com/django/django / test_not_a_directory

Method test_not_a_directory

tests/file_uploads/tests.py:890–899  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

888 )
889
890 def test_not_a_directory(self):
891 default_storage.delete(UPLOAD_TO)
892 # Create a file with the upload directory name
893 with SimpleUploadedFile(UPLOAD_TO, b"x") as file:
894 default_storage.save(UPLOAD_FOLDER, file)
895 self.addCleanup(default_storage.delete, UPLOAD_TO)
896 msg = "%s exists and is not a directory." % UPLOAD_TO
897 with self.assertRaisesMessage(FileExistsError, msg):
898 with SimpleUploadedFile("foo.txt", b"x") as file:
899 self.obj.testfile.save("foo.txt", file, save=False)
900
901
902class MultiParserTests(SimpleTestCase):

Callers

nothing calls this directly

Calls 4

SimpleUploadedFileClass · 0.90
assertRaisesMessageMethod · 0.80
deleteMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected