MCPcopy Create free account
hub / github.com/mongodb/mongo-python-driver / test_upload_batching

Method test_upload_batching

test/test_gridfs_bucket.py:328–335  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

326
327 @patch("gridfs.synchronous.grid_file._UPLOAD_BUFFER_CHUNKS", 10)
328 def test_upload_batching(self):
329 with self.fs.open_upload_stream("test_file", chunk_size_bytes=1) as gin:
330 gin.write(b"s" * (10 - 1))
331 # No chunks were uploaded yet.
332 self.assertEqual(0, self.db.fs.chunks.count_documents({"files_id": gin._id}))
333 gin.write(b"s")
334 # All chunks were uploaded since we hit the _UPLOAD_BUFFER_CHUNKS limit.
335 self.assertEqual(10, self.db.fs.chunks.count_documents({"files_id": gin._id}))
336
337 def test_open_upload_stream(self):
338 gin = self.fs.open_upload_stream("from_stream")

Callers

nothing calls this directly

Calls 3

open_upload_streamMethod · 0.45
writeMethod · 0.45
count_documentsMethod · 0.45

Tested by

no test coverage detected