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

Method test_corrupt_chunk

test/asynchronous/test_gridfs.py:164–178  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

162 self.assertNotIn("md5", raw)
163
164 async def test_corrupt_chunk(self):
165 files_id = await self.fs.put(b"foobar")
166 await self.db.fs.chunks.update_one(
167 {"files_id": files_id}, {"$set": {"data": Binary(b"foo", 0)}}
168 )
169 try:
170 out = await self.fs.get(files_id)
171 with self.assertRaises(CorruptGridFile):
172 await out.read()
173
174 out = await self.fs.get(files_id)
175 with self.assertRaises(CorruptGridFile):
176 await out.readline()
177 finally:
178 await self.fs.delete(files_id)
179
180 async def test_put_ensures_index(self):
181 chunks = self.db.fs.chunks

Callers

nothing calls this directly

Calls 7

BinaryClass · 0.90
putMethod · 0.45
update_oneMethod · 0.45
getMethod · 0.45
readMethod · 0.45
readlineMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected