GoogleSolarApi delegates get_building_insights to GoogleSolarApiClient 🟥

This commit is contained in:
Daniel Roth 2026-05-21 15:59:22 +00:00 committed by Jun-te Kim
parent 074cbf2f5a
commit 3f43dacfb9

View file

@ -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