From 3f43dacfb934210c8d90bf9d0da6be7eb2bb6416 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Thu, 21 May 2026 15:59:22 +0000 Subject: [PATCH] =?UTF-8?q?GoogleSolarApi=20delegates=20get=5Fbuilding=5Fi?= =?UTF-8?q?nsights=20to=20GoogleSolarApiClient=20=F0=9F=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../solar/test_google_solar_api_wiring.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/infrastructure/solar/test_google_solar_api_wiring.py diff --git a/tests/infrastructure/solar/test_google_solar_api_wiring.py b/tests/infrastructure/solar/test_google_solar_api_wiring.py new file mode 100644 index 00000000..52618f9d --- /dev/null +++ b/tests/infrastructure/solar/test_google_solar_api_wiring.py @@ -0,0 +1,26 @@ +from typing import Any +from unittest.mock import MagicMock, patch + +from backend.apis.GoogleSolarApi import GoogleSolarApi +from infrastructure.solar.google_solar_api_client import ( + BuildingInsightsNotFoundError, + GoogleSolarApiClient, +) + + +# --------------------------------------------------------------------------- +# Slice 1: get_building_insights delegates to _solar_client +# --------------------------------------------------------------------------- + + +def test_get_building_insights_delegates_to_solar_client() -> None: + # Arrange + payload: dict[str, Any] = {"solarPotential": {"maxArrayPanelsCount": 20}} + with patch.object(GoogleSolarApiClient, "get_building_insights", return_value=payload): + api = GoogleSolarApi(api_key="test-key", solar_materials=[]) + + # Act + result = api.get_building_insights(longitude=-0.1278, latitude=51.5074) + + # Assert + assert result == payload