def test_run_request_bib_item__not_found(self): """ Tests manager bib-item requesting. NOTE THAT THIS WILL REALLY ATTEMPT THE REQUEST. """ basics = { 'API_URL_ROOT': self.api_url_root, 'API_KEY': self.api_key, 'PARTNERSHIP_ID': self.partnership_id, 'UNIVERSITY_CODE': self.university_code, 'PICKUP_LOCATION': self.pickup_location, } bd = BorrowDirect(basics) (title, author, year) = ( 'Zen and the art of motorcycle maintenance - an inquiry into values', ['Pirsig, Robert M'], '1874') log.debug('title, ```%s```' % title) bd.run_request_bib_item(self.patron_barcode, title, author, year) self.assertEqual( { 'Problem': { 'ErrorCode': 'PUBRI003', 'ErrorMessage': 'No result' } }, bd.request_result)
def setUp(self): time.sleep(SLEEP_SECONDS) self.LOG_PATH = os.environ[ 'BDPY3_TEST__LOG_PATH'] # if None ...outputs to console bd = BorrowDirect({'LOG_PATH': self.LOG_PATH}) self.patron_barcode = os.environ['BDPY3_TEST__PATRON_BARCODE'] self.api_url_root = os.environ['BDPY3_TEST__API_URL_ROOT'] self.api_key = os.environ['BDPY3_TEST__API_KEY'] self.university_code = os.environ['BDPY3_TEST__UNIVERSITY_CODE'] self.partnership_id = os.environ['BDPY3_TEST__PARTNERSHIP_ID'] self.isbn_found_and_available = os.environ[ 'BDPY3_TEST__ISBN_FOUND_AND_AVAILABLE'] self.isbn_found_and_unavailable = os.environ[ 'BDPY3_TEST__ISBN_FOUND_AND_UNAVAILABLE'] self.isbn_not_found = os.environ['BDPY3_TEST__ISBN_NOT_FOUND']
# -*- coding: utf-8 -*- import os, pprint, time from bdpy3 import BorrowDirect """ Assumes bdpy3 has already been pip-installed, as per the main README.md """ print('exact-search example...') search_defaults = { 'API_URL_ROOT': os.environ['BDPY3_SAMPLE_SCRIPT__API_URL_ROOT'], 'API_KEY': os.environ['BDPY3_SAMPLE_SCRIPT__API_KEY'], 'PARTNERSHIP_ID': os.environ['BDPY3_SAMPLE_SCRIPT__PARTNERSHIP_ID'], 'UNIVERSITY_CODE': os.environ['BDPY3_SAMPLE_SCRIPT__UNIVERSITY_CODE'] } bd = BorrowDirect(search_defaults) patron_barcode = os.environ['BDPY3_SAMPLE_SCRIPT__PATRON_BARCODE'] bd.run_search_exact_item(patron_barcode, 'ISBN', '9780688002305') print('exact-search-result...') pprint.pprint(bd.search_result) print('---') print(' ') time.sleep(1) # being nice to the server print('bib-search example...') search_defaults = { 'API_URL_ROOT': os.environ['BDPY3_SAMPLE_SCRIPT__API_URL_ROOT'], 'API_KEY': os.environ['BDPY3_SAMPLE_SCRIPT__API_KEY'], 'PARTNERSHIP_ID': os.environ['BDPY3_SAMPLE_SCRIPT__PARTNERSHIP_ID'], 'UNIVERSITY_CODE': os.environ['BDPY3_SAMPLE_SCRIPT__UNIVERSITY_CODE'] } bd = BorrowDirect(search_defaults) patron_barcode = os.environ['BDPY3_SAMPLE_SCRIPT__PATRON_BARCODE']