def test_temp_location(self): # get a bib_id for something that's in temp location to make sure # that availabilityAtOrFrom uses that instead of the permanent location q = """ SELECT bib_id, item.item_id FROM bib_mfhd, mfhd_item, item WHERE ROWNUM = 1 AND item.temp_location = 682 AND item.item_id = mfhd_item.item_id AND mfhd_item.mfhd_id = bib_mfhd.mfhd_id """ bib_id, item_id = _fetch_one(q) a = get_availability(str(bib_id)) for o in a['offers']: if 'serialNumber' in o and o['serialNumber'] == str(item_id): self.assertEqual(o['availabilityAtOrFrom'].lower(), 'wrlc shared collections facility')
def test_temp_location(self): # get a bib_id for something that's in temp location to make sure # that availabilityAtOrFrom uses that instead of the permanent location q = """ SELECT bib_id, item.item_id FROM bib_mfhd, mfhd_item, item WHERE ROWNUM = 1 AND item.temp_location = 682 AND item.item_id = mfhd_item.item_id AND mfhd_item.mfhd_id = bib_mfhd.mfhd_id """ bib_id, item_id = _fetch_one(q) a = get_availability(str(bib_id)) for o in a['offers']: if 'serialNumber' in o and o['serialNumber'] == str(item_id): self.assertEqual( o['availabilityAtOrFrom'].lower(), 'wrlc shared collections facility' )
def test_checked_out(self): # get a bib_id for something that's checked out # 2382-12-31 due dates are indicators that the item # is in offsite storage q = """ SELECT bib_id, circ_transactions.circ_transaction_id FROM bib_mfhd, mfhd_item, item, circ_transactions WHERE ROWNUM = 1 AND circ_transactions.charge_due_date IS NOT NULL AND circ_transactions.charge_due_date < TO_DATE('2382-12-31', 'YYYY-MM-DD') AND circ_transactions.item_id = item.item_id AND item.item_id = mfhd_item.item_id AND mfhd_item.mfhd_id = bib_mfhd.mfhd_id """ bib_id, circ_id = _fetch_one(q) a = get_availability(str(bib_id)) found = False for offer in a['offers']: if 'availabilityStarts' in offer: found = True self.assertTrue(found)