From 9db1eeb076b5fde0a802fca8ccf77a1b618d68dc Mon Sep 17 00:00:00 2001 From: Jonathan Green Date: Fri, 6 Sep 2024 15:03:08 -0300 Subject: [PATCH] Raise an exception when LCP fulfillment fails (#2033) Raise an exception if we get an unexpected status code while doing a LCP fulfillment. --- src/palace/manager/api/odl/api.py | 4 +++- tests/manager/api/odl/test_api.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/palace/manager/api/odl/api.py b/src/palace/manager/api/odl/api.py index 4c247a925..514c3bc8b 100644 --- a/src/palace/manager/api/odl/api.py +++ b/src/palace/manager/api/odl/api.py @@ -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 diff --git a/tests/manager/api/odl/test_api.py b/tests/manager/api/odl/test_api.py index f42ec34a9..32985a929 100644 --- a/tests/manager/api/odl/test_api.py +++ b/tests/manager/api/odl/test_api.py @@ -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,