예제 #1
0
 def test_fetch_attachment_not_found_while_migrating(self):
     obj = mod.BlobHelper({
         "_id": "fetch-fail",
         "_attachments": {"migrating...": {}},
         "external_blobs": {"not-found.txt": {"id": "nope"}},
     }, self.couch)
     self.assertTrue(obj.migrating_blobs_from_couch)
     with self.assertRaisesMessage(mod.ResourceNotFound, '{} attachment'.format(obj._id)):
         obj.fetch_attachment("not-found.txt")
예제 #2
0
 def test_fetch_attachment_do_not_hit_couch_when_not_migrating(self):
     def fetch_fail(*args, **kw):
         raise Exception("fail!")
     couch = FakeCouchDatabase()
     couch.fetch_attachment = fetch_fail
     obj = mod.BlobHelper({
         "_id": "fetch-fail",
         "external_blobs": {"not-found.txt": {"id": "hahaha"}},
     }, couch)
     self.assertFalse(obj.migrating_blobs_from_couch)
     with self.assertRaisesMessage(mod.ResourceNotFound, '{} attachment'.format(obj._id)):
         obj.fetch_attachment("not-found.txt")