Skip to content

Commit

Permalink
Fix status code
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathangreen committed Jun 3, 2024
1 parent c9061ff commit 89c9818
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/palace/manager/api/odl.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def get_license_status_document(self, loan: Loan) -> dict[str, Any]:
)

response = self._get(url)
if not response.ok:
if not (200 <= response.status_code < 300):
header_string = ", ".join(
{f"{k}: {v}" for k, v in response.headers.items()}
)
Expand Down
4 changes: 2 additions & 2 deletions tests/manager/api/test_odl.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_get_license_status_document_success(
# With a new loan.
loan, _ = odl_api_test_fixture.license.loan_to(odl_api_test_fixture.patron)
odl_api_test_fixture.api.queue_response(
200, content=json.dumps(dict(status="ready"))
201, content=json.dumps(dict(status="ready"))
)
odl_api_test_fixture.api.get_license_status_document(loan)
requested_url = odl_api_test_fixture.api.requests[0][0]
Expand Down Expand Up @@ -139,7 +139,7 @@ def test_get_license_status_document_errors(
odl_api_test_fixture.api.get_license_status_document,
loan,
)
assert "returned status code 403. Expected 200." in caplog.text
assert "returned status code 403." in caplog.text
assert "just junk ..." in caplog.text

def test_checkin_success(
Expand Down

0 comments on commit 89c9818

Please sign in to comment.