def test_search_loans_by_patron_pid(indexed_loans):
    """Test retrieve loan list belonging to a patron."""
    search_result = search_by_patron_pid("1").execute()
    assert search_result.hits.total == 8

    search_result = search_by_patron_pid("2").execute()
    assert search_result.hits.total == 3

    search_result = search_by_patron_pid("3").execute()
    assert search_result.hits.total == 1
Пример #2
0
def test_search_loans_by_patron_pid(indexed_loans):
    """Test retrieve loan list belonging to a patron."""
    search_result = search_by_patron_pid("1").execute()
    assert search_result.hits.total == 8

    search_result = search_by_patron_pid("2").execute()
    assert search_result.hits.total == 3

    search_result = search_by_patron_pid("3").execute()
    assert search_result.hits.total == 1
Пример #3
0
def test_search_loans_by_patron_pid(indexed_loans):
    """Test retrieve loan list belonging to a patron."""
    search_result = search_by_patron_pid("1").execute()
    _assert_total(search_result.hits.total, 8)

    search_result = search_by_patron_pid("2").execute()
    _assert_total(search_result.hits.total, 3)

    search_result = search_by_patron_pid("3").execute()
    _assert_total(search_result.hits.total, 1)
Пример #4
0
def get_loans(patron_pid):
    """Get referenced loans."""
    referenced = []
    loan_record_cls = current_app_ils.loan_record_cls
    for hit in search_by_patron_pid(patron_pid=patron_pid).scan():
        loan = loan_record_cls.get_record_by_pid(hit["pid"])
        referenced.append(dict(pid_type=CIRCULATION_LOAN_PID_TYPE,
                               record=loan))
    return referenced