(self)
| 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") |
nothing calls this directly
no test coverage detected