mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
31 lines
1.4 KiB
Python
31 lines
1.4 KiB
Python
import pytest
|
|
|
|
from datatypes.epc.domain.mapper import EpcPropertyDataMapper
|
|
from datatypes.epc.domain.epc_property_data import EpcPropertyData
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Test 1: from_api_response with RdSAP-Schema-21.0.0 fixture → EpcPropertyData
|
|
# ---------------------------------------------------------------------------
|
|
|
|
def test_from_api_response_rdsap_21_0_0(rdsap_21_0_0_cert):
|
|
result = EpcPropertyDataMapper.from_api_response(rdsap_21_0_0_cert)
|
|
assert isinstance(result, EpcPropertyData)
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Test 2: from_api_response with RdSAP-Schema-21.0.1 fixture → EpcPropertyData
|
|
# ---------------------------------------------------------------------------
|
|
|
|
def test_from_api_response_rdsap_21_0_1(rdsap_21_0_1_cert):
|
|
result = EpcPropertyDataMapper.from_api_response(rdsap_21_0_1_cert)
|
|
assert isinstance(result, EpcPropertyData)
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Test 3: unknown schema_type → ValueError
|
|
# ---------------------------------------------------------------------------
|
|
|
|
def test_from_api_response_unknown_schema_raises():
|
|
with pytest.raises(ValueError, match="Unsupported EPC schema"):
|
|
EpcPropertyDataMapper.from_api_response({"schema_type": "RdSAP-Schema-99.0.0"})
|