MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / test_basic

Method test_basic

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

Source from the content-addressed store, hash-verified

93 )
94
95 def test_basic(self):
96 oid = self.fs.upload_from_stream("test_filename", b"hello world")
97 self.assertEqual(b"hello world", (self.fs.open_download_stream(oid)).read())
98 self.assertEqual(1, self.db.fs.files.count_documents({}))
99 self.assertEqual(1, self.db.fs.chunks.count_documents({}))
100
101 self.fs.delete(oid)
102 with self.assertRaises(NoFile):
103 self.fs.open_download_stream(oid)
104 self.assertEqual(0, self.db.fs.files.count_documents({}))
105 self.assertEqual(0, self.db.fs.chunks.count_documents({}))
106
107 def test_multi_chunk_delete(self):
108 self.assertEqual(0, self.db.fs.files.count_documents({}))

Callers

nothing calls this directly

Calls 5

upload_from_streamMethod · 0.45
readMethod · 0.45
open_download_streamMethod · 0.45
count_documentsMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected