Skip to content

Commit

Permalink
removed obsolete 409 error handling from query.py
Browse files Browse the repository at this point in the history
  • Loading branch information
charlottekostelic committed Feb 23, 2024
1 parent d046159 commit 87133b4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
13 changes: 1 addition & 12 deletions bookops_worldcat/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,7 @@ def __init__(

try:
self.response = session.send(prepared_request, timeout=timeout)

if "/ih/data" in prepared_request.url: # type: ignore
if self.response.status_code == 409:
# HTTP 409 code returns when trying to set/unset
# holdings on already set/unset record
# It is reasonable not to raise any exceptions
# in this case
pass # pragma: no cover
else:
self.response.raise_for_status()
else:
self.response.raise_for_status()
self.response.raise_for_status()

except HTTPError as exc:
raise WorldcatRequestError(
Expand Down
10 changes: 0 additions & 10 deletions tests/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,3 @@ def test_query_unexpected_exception(stub_session, mock_unexpected_error):
Query(stub_session, prepped)

assert "Unexpected request error: <class 'Exception'>" in str(exc.value)


@pytest.mark.http_code(409)
def test_query_holding_endpoint_409_http_code(stub_session, mock_session_response):
req = Request("POST", "https://worldcat.org/ih/data", params={"foo": "bar"})
prepped = stub_session.prepare_request(req)
with does_not_raise():
query = Query(stub_session, prepped)

assert query.response.status_code == 409

0 comments on commit 87133b4

Please sign in to comment.