def test_Add(self): from niprov.jsonfile import JsonFile repo = JsonFile(self.dependencies) img1 = self.imageWithProvenance({'location': '1', 'foo': 'baz'}) repo.all = Mock() repo.all.return_value = [img1] image = self.imageWithProvenance({'location': '2', 'foo': 'bar'}) repo.add(image) self.serializer.serializeList.assert_called_with([img1, image]) self.filesys.write.assert_called_with(repo.datafile, self.serializer.serializeList())
def test_Add(self): from niprov.jsonfile import JsonFile repo = JsonFile(self.dependencies) img1 = self.imageWithProvenance({'location':'1','foo':'baz'}) repo.all = Mock() repo.all.return_value = [img1] image = self.imageWithProvenance({'location': '2','foo':'bar'}) repo.add(image) self.serializer.serializeList.assert_called_with( [img1, image]) self.filesys.write.assert_called_with(repo.datafile, self.serializer.serializeList())
def test_Will_tell_PictureCache_to_persist_known_Snapshot(self): from niprov.jsonfile import JsonFile repo = JsonFile(self.dependencies) img = self.imageWithProvenance({'location': '1', 'foo': 'baz'}) repo.add(img) self.pictureCache.saveToDisk.assert_called_with(for_=img)
def test_Will_tell_PictureCache_to_persist_known_Snapshot(self): from niprov.jsonfile import JsonFile repo = JsonFile(self.dependencies) img = self.imageWithProvenance({'location':'1','foo':'baz'}) repo.add(img) self.pictureCache.saveToDisk.assert_called_with(for_=img)