mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Move the EpcClientService package (client + _retry + exceptions + tests) from the dying backend/ tree to infrastructure/epc_client/ as the New-EPC-API Fetcher; update the two callers (address2UPRN, a script). All 14 client tests pass. Add SolarRepository port + SolarPostgresRepository persisting Google Solar building insights as JSONB (solar_building_insights table), one row per Property. The EPC repo half of this slice already landed in #1129. pyright strict clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
48 lines
1.2 KiB
Python
48 lines
1.2 KiB
Python
import json
|
|
import pathlib
|
|
import pytest
|
|
|
|
from infrastructure.epc_client.epc_client_service import EpcClientService
|
|
|
|
SAMPLES_DIR = pathlib.Path("backend/epc_api/json_samples")
|
|
|
|
|
|
@pytest.fixture
|
|
def rdsap_21_0_0_cert():
|
|
return json.loads((SAMPLES_DIR / "RdSAP-Schema-21.0.0/epc.json").read_text())
|
|
|
|
|
|
@pytest.fixture
|
|
def rdsap_21_0_1_cert():
|
|
return json.loads((SAMPLES_DIR / "RdSAP-Schema-21.0.1/epc.json").read_text())
|
|
|
|
|
|
@pytest.fixture
|
|
def epc_service():
|
|
return EpcClientService(auth_token="test-token")
|
|
|
|
|
|
def make_search_row(
|
|
cert_num="CERT-001",
|
|
address_line_1="1 Test Street",
|
|
postcode="SW1A 1AA",
|
|
post_town="London",
|
|
uprn=100023336956,
|
|
band="D",
|
|
registration_date="2024-01-01",
|
|
address_line_2=None,
|
|
address_line_3=None,
|
|
address_line_4=None,
|
|
):
|
|
return {
|
|
"certificateNumber": cert_num,
|
|
"addressLine1": address_line_1,
|
|
"addressLine2": address_line_2,
|
|
"addressLine3": address_line_3,
|
|
"addressLine4": address_line_4,
|
|
"postcode": postcode,
|
|
"postTown": post_town,
|
|
"uprn": uprn,
|
|
"currentEnergyEfficiencyBand": band,
|
|
"registrationDate": registration_date,
|
|
}
|