def test_loan_es_mapping(es_clear, db, loan_data_tmp, item_on_loan, location, library): """.""" search = current_circulation.loan_search mapping = get_mapping(search.Meta.index) assert mapping Loan.create(loan_data_tmp, dbcommit=True, reindex=True, delete_pid=True) assert mapping == get_mapping(search.Meta.index)
def loan(app, item_on_loan, location, library, loan_data): """.""" loan = Loan.create(data=loan_data, delete_pid=True, dbcommit=True, reindex=True) flush_index(current_circulation.loan_search.Meta.index) return loan
def test_loans_create(db, loan_data_tmp): """Test loananisation creation.""" loan = Loan.create(loan_data_tmp, delete_pid=True) assert loan == loan_data_tmp assert loan.get('loan_pid') == '1' assert loan.get('state') == 'ITEM_ON_LOAN' loan = Loan.get_record_by_pid('1') assert loan == loan_data_tmp fetched_pid = loan_pid_fetcher(loan.id, loan) assert fetched_pid.pid_value == '1'