def test_availability_info(self): data, raw = self.sample_json("overdrive_book_list.json") availability = OverdriveRepresentationExtractor.availability_link_list( raw) for item in availability: for key in 'availability_link', 'id', 'title': assert key in item
def test_availability_info_missing_data(self): data, raw = self.sample_json("overdrive_book_list_missing_data.json") [item] = OverdriveRepresentationExtractor.availability_link_list(raw) # We got a data structure for the item that has an ID but no title. # We did not get a data structure for the item that has a title # but no ID. eq_('title is missing', item['id']) eq_(None, item['title'])