From 87133b4c73d5584e020f2761bb57f16afec2a23c Mon Sep 17 00:00:00 2001 From: Charlotte Kostelic Date: Fri, 23 Feb 2024 15:20:31 -0500 Subject: [PATCH] removed obsolete 409 error handling from query.py --- bookops_worldcat/query.py | 13 +------------ tests/test_query.py | 10 ---------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/bookops_worldcat/query.py b/bookops_worldcat/query.py index 1a99722..7dcc387 100644 --- a/bookops_worldcat/query.py +++ b/bookops_worldcat/query.py @@ -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( diff --git a/tests/test_query.py b/tests/test_query.py index b4f626b..78cc8d5 100644 --- a/tests/test_query.py +++ b/tests/test_query.py @@ -150,13 +150,3 @@ def test_query_unexpected_exception(stub_session, mock_unexpected_error): Query(stub_session, prepped) assert "Unexpected request error: " 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