Skip to content

Commit a77b706

Browse files
committed
DAS-2427: Adds error test for no retry case.
1 parent 04ffd59 commit a77b706

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/test_client.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,6 +1601,36 @@ def test_handle_error_response_invalid_json():
16011601
# Check retries
16021602
assert len(responses.calls) == 9 # (1 + 4 + 4)
16031603

1604+
@responses.activate
1605+
def test_handle_non_transient_error_no_retry():
1606+
job_id = '89733-badc-1324'
1607+
collection = Collection(id='F229040468263-STRP')
1608+
request = Request(
1609+
collection=collection,
1610+
spatial=BBox(-107, 40, -105, 42)
1611+
)
1612+
responses.add(
1613+
responses.POST,
1614+
expected_submit_url(collection.id),
1615+
status=200,
1616+
json=expected_job(collection.id, 'abcd-1234')
1617+
)
1618+
responses.add(
1619+
responses.GET,
1620+
expected_status_url(job_id),
1621+
status=431,
1622+
json='no-retry error'
1623+
)
1624+
1625+
Client(should_validate_auth=False).submit(request)
1626+
1627+
with pytest.raises(Exception) as e:
1628+
Client(should_validate_auth=False).status(job_id)
1629+
assert "431 Client Error: Request Header Fields Too Large for url" in str(e.value)
1630+
1631+
# Check no retries
1632+
assert len(responses.calls) == 2
1633+
16041634
@responses.activate(registry=registries.OrderedRegistry)
16051635
def test_handle_transient_error_responses():
16061636
job_id = '3141592653-acbd-1234'

0 commit comments

Comments
 (0)