mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
62 lines
2.1 KiB
Python
62 lines
2.1 KiB
Python
from datetime import datetime
|
|
from typing import List
|
|
|
|
from backend.condition.domain.aspect_type import AspectType
|
|
from backend.condition.domain.element import Element
|
|
from backend.condition.domain.mapping.peabody.peabody_mapper import PeabodyMapper
|
|
from backend.condition.parsing.records.peabody.peabody_asset_condition import (
|
|
PeabodyAssetCondition,
|
|
)
|
|
from backend.condition.parsing.records.peabody.peabody_property import PeabodyProperty
|
|
from backend.condition.domain.asset_condition import AssetCondition
|
|
|
|
|
|
def test_peabody_mapper_maps_property():
|
|
# arrange
|
|
peabody_property = PeabodyProperty(
|
|
uprn=1,
|
|
assets=[
|
|
PeabodyAssetCondition(
|
|
lo_reference="1000RAND0000",
|
|
full_address="FLAT 1 RANDOM SQUARE FAKE STREET LONDON E1 1EE",
|
|
location_type_code=1,
|
|
parent_lo_reference="RAND1000",
|
|
element_code=130,
|
|
element="WINDOWS",
|
|
sub_element_code=1,
|
|
sub_element="Windows",
|
|
material_code=1,
|
|
material_or_answer="UPVC Double Glazed",
|
|
renewal_quantity=8,
|
|
renewal_year=2036,
|
|
renewal_cost=4800,
|
|
cloned="N",
|
|
lo_type_code=1,
|
|
condition_survey_date=datetime(2024, 2, 15, 12, 47, 0),
|
|
)
|
|
],
|
|
)
|
|
mapper = PeabodyMapper()
|
|
|
|
expected_assets: List[AssetCondition] = [
|
|
AssetCondition(
|
|
uprn=1,
|
|
element=Element.EXTERNAL_WINDOWS,
|
|
aspect_type=AspectType.MATERIAL,
|
|
value="UPVC Double Glazed",
|
|
quantity=8,
|
|
install_date=None,
|
|
renewal_year=2036,
|
|
element_instance=None,
|
|
source_system=None,
|
|
comments=None,
|
|
)
|
|
]
|
|
# act
|
|
actual_assets = mapper.map_asset_conditions_for_property(peabody_property)
|
|
|
|
# assert
|
|
assert len(actual_assets) == len(expected_assets)
|
|
|
|
for i, (actual, expected) in enumerate(zip(actual_assets, expected_assets)):
|
|
assert actual == expected, f"Mismatch at index {i}"
|