Skip to content

Commit

Permalink
Add back in one test
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathangreen committed Jun 7, 2024
1 parent c88b569 commit e181090
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/manager/api/test_circulationapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,41 @@ def test_attempt_renew_with_local_loan_and_no_available_copies(
# NoAvailableCopies can happen if there are already people
# waiting in line for the book. This case gives a more
# specific error message.
#
# Contrast with the way NoAvailableCopies is handled in
# test_loan_becomes_hold_if_no_available_copies.
circulation_api.remote.queue_checkout(NoAvailableCopies())
circulation_api.remote.queue_checkout(NoAvailableCopies())
with pytest.raises(CannotRenew) as excinfo:
self.borrow(circulation_api)
assert "You cannot renew a loan if other patrons have the work on hold." in str(
excinfo.value
)

def test_loan_becomes_hold_if_no_available_copies(
self, circulation_api: CirculationAPIFixture
):
# We want to borrow this book but there are no copies.
circulation_api.remote.queue_checkout(NoAvailableCopies())
holdinfo = HoldInfo(
circulation_api.pool.collection,
circulation_api.pool.data_source,
circulation_api.identifier.type,
circulation_api.identifier.identifier,
None,
None,
10,
)
circulation_api.remote.queue_hold(holdinfo)

# As such, an attempt to renew our loan results in us actually
# placing a hold on the book.
loan, hold, is_new = self.borrow(circulation_api)
assert None == loan
assert True == is_new
assert circulation_api.pool == hold.license_pool
assert circulation_api.patron == hold.patron

def test_borrow_creates_hold_if_api_returns_hold_info(
self, circulation_api: CirculationAPIFixture
):
Expand Down

0 comments on commit e181090

Please sign in to comment.