mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
GoogleSolarApiClient propagates exception after retry exhaustion 🟩
This commit is contained in:
parent
d1ca9be580
commit
b1933c07c3
1 changed files with 21 additions and 0 deletions
|
|
@ -87,3 +87,24 @@ def test_get_building_insights_raises_on_entity_not_found() -> None:
|
||||||
client.get_building_insights(longitude=-0.1278, latitude=51.5074)
|
client.get_building_insights(longitude=-0.1278, latitude=51.5074)
|
||||||
|
|
||||||
assert mock_get.call_count == 1
|
assert mock_get.call_count == 1
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Slice 4: Retry exhaustion propagates the exception to the caller
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_building_insights_propagates_exception_after_retry_exhaustion() -> None:
|
||||||
|
# Arrange
|
||||||
|
client = GoogleSolarApiClient(api_key="test-key")
|
||||||
|
|
||||||
|
error = requests.exceptions.ConnectionError("persistent failure")
|
||||||
|
error.response = None # type: ignore[attr-defined]
|
||||||
|
|
||||||
|
with patch("requests.get", side_effect=error) as mock_get:
|
||||||
|
with patch("time.sleep"):
|
||||||
|
# Act / Assert
|
||||||
|
with pytest.raises(requests.exceptions.ConnectionError):
|
||||||
|
client.get_building_insights(longitude=-0.1278, latitude=51.5074)
|
||||||
|
|
||||||
|
assert mock_get.call_count == GoogleSolarApiClient.MAX_RETRIES
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue