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

Method test_corrupt_chunk

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

Source from the content-addressed store, hash-verified

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