Skip to content

fix: test retry with 502 status code instead of 500 #152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions _test_unstructured_client/unit/test_custom_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def test_unit_retry_with_backoff_does_retry(caplog):
)

with requests_mock.Mocker() as mock:
# mock a 500 status code for POST requests to the api
mock.post("https://api.unstructuredapp.io/general/v0/general", status_code=500)
# mock a 502 status code for POST requests to the api
mock.post("https://api.unstructuredapp.io/general/v0/general", status_code=502)
session = UnstructuredClient(api_key_auth=FAKE_KEY)

with open(filename, "rb") as f:
Expand All @@ -35,7 +35,7 @@ def test_unit_retry_with_backoff_does_retry(caplog):

with pytest.raises(Exception) as excinfo:
resp = session.general.partition(req, retries=retries)
assert resp.status_code == 500
assert resp.status_code == 502
assert "API error occurred" in str(excinfo.value)

# the number of retries varies
Expand Down