Skip to content

Commit

Permalink
Allow returns when API on licensepool is None (#22)
Browse files Browse the repository at this point in the history
* Allow returns when API on licensepool is None

In the case where we are pulling in ACSM files, they are not
open access, but they also have no API assoicated. So we should
allow a return.

* Allow return of ACSM content.
  • Loading branch information
jonathangreen authored Jul 29, 2021
1 parent f79fd86 commit 9c0169e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions api/circulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,8 +1017,8 @@ def revoke_loan(self, patron, pin, licensepool):
on_multiple='interchangeable'
)
if loan:
if not licensepool.open_access and not licensepool.self_hosted:
api = self.api_for_license_pool(licensepool)
api = self.api_for_license_pool(licensepool)
if not (api is None or licensepool.open_access or licensepool.self_hosted):
try:
api.checkin(patron, pin, licensepool)
except NotCheckedOut, e:
Expand Down
3 changes: 2 additions & 1 deletion tests/test_circulationapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,8 @@ def yes_we_can(*args, **kwargs):

@parameterized.expand([
('open_access', True, False),
('self_hosted', False, True)
('self_hosted', False, True),
('neither', False, False),
])
def test_revoke_loan(self, _, open_access=False, self_hosted=False):
self.pool.open_access = open_access
Expand Down

0 comments on commit 9c0169e

Please sign in to comment.