diff --git a/api/circulation.py b/api/circulation.py index d12624c2d3..9dffc303b7 100644 --- a/api/circulation.py +++ b/api/circulation.py @@ -1057,8 +1057,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 as e: diff --git a/tests/test_circulationapi.py b/tests/test_circulationapi.py index 5135c9262d..e48a61bd4f 100644 --- a/tests/test_circulationapi.py +++ b/tests/test_circulationapi.py @@ -1006,7 +1006,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