Skip to content

Commit

Permalink
Raise an exception when LCP fulfillment fails (#2033)
Browse files Browse the repository at this point in the history
Raise an exception if we get an unexpected status code while doing
a LCP fulfillment.
  • Loading branch information
jonathangreen authored Sep 6, 2024
1 parent 5fb1411 commit 9db1eeb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/palace/manager/api/odl/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,9 @@ def _lcp_fulfill(
if content_link is None or content_type is None:
raise CannotFulfill()

return FetchFulfillment(content_link, content_type)
return FetchFulfillment(
content_link, content_type, allowed_response_codes=["2xx"]
)

def _bearer_token_fulfill(
self, loan: Loan, delivery_mechanism: LicensePoolDeliveryMechanism
Expand Down
1 change: 1 addition & 0 deletions tests/manager/api/odl/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,7 @@ def test_fulfill_success(
assert isinstance(fulfillment, FetchFulfillment)
assert correct_link == fulfillment.content_link
assert correct_type == fulfillment.content_type
assert ["2xx"] == fulfillment.allowed_response_codes

def test_fulfill_open_access(
self,
Expand Down

0 comments on commit 9db1eeb

Please sign in to comment.