def test_Keep_accepts_bsonBinary(self): from niprov.pictures import PictureCache myImg = Mock() myImg.provenance = {'id': '007'} pictures = PictureCache(sentinel.dependencies) pictures.keep(bson.Binary('/x10/x05/x5f'), for_=myImg) self.assertEqual('/x10/x05/x5f', pictures.getBytes(for_=myImg))
def test_Keep_accepts_bsonBinary(self): from niprov.pictures import PictureCache myImg = Mock() myImg.provenance = {'id':'007'} pictures = PictureCache(sentinel.dependencies) pictures.keep(bson.Binary('/x10/x05/x5f'), for_=myImg) self.assertEqual('/x10/x05/x5f', pictures.getBytes(for_=myImg))
def test_Stored_picture_can_be_retrieved_as_bytes(self): from niprov.pictures import PictureCache myImg = Mock() myImg.provenance = {'id': '007'} pictures = PictureCache(sentinel.dependencies) newPicture = pictures.new() newPicture.write('/x10/x05/x5f') pictures.keep(newPicture, for_=myImg) outBytes = pictures.getBytes(for_=myImg) self.assertEqual('/x10/x05/x5f', outBytes)
def test_Stored_picture_can_be_retrieved_as_bytes(self): from niprov.pictures import PictureCache myImg = Mock() myImg.provenance = {'id':'007'} pictures = PictureCache(sentinel.dependencies) newPicture = pictures.new() newPicture.write('/x10/x05/x5f') pictures.keep(newPicture, for_=myImg) outBytes = pictures.getBytes(for_=myImg) self.assertEqual('/x10/x05/x5f', outBytes)