diff --git a/.idea/Model.iml b/.idea/Model.iml index 4413bb06..b0f9c00d 100644 --- a/.idea/Model.iml +++ b/.idea/Model.iml @@ -7,7 +7,7 @@ - + diff --git a/.idea/misc.xml b/.idea/misc.xml index 3b05c6ac..ca0e1cd9 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + diff --git a/backend/tests/test_property.py b/backend/tests/test_property.py index 8b452db7..76a299fc 100644 --- a/backend/tests/test_property.py +++ b/backend/tests/test_property.py @@ -8,6 +8,10 @@ from etl.epc_clean.EpcClean import EpcClean mock_epc_response = { "rows": [ { + "lmk-key": 1, + "uprn": 1, + "number-habitable-rooms": 5, + "property-type": "House", "inspection-date": "2023-06-01", "some-other-key": "some-value", "roof-description": "Roof Description", @@ -32,6 +36,10 @@ mock_epc_response = { "construction-age-band": "England and Wales: 1967-1975" }, { + "lmk-key": 2, + "uprn": 2, + "number-habitable-rooms": 5, + "property-type": "House", "inspection-date": "2023-05-01", "some-other-key": "some-other-value", "roof-description": "Roof Description", @@ -61,6 +69,10 @@ mock_epc_response = { mock_epc_response_dupe = { 'rows': [ { + "lmk-key": 1, + "uprn": 1, + "number-habitable-rooms": 5, + "property-type": "House", 'inspection-date': '2023-06-01', 'some-other-key': 'some-value', 'roof-description': 'Roof Description', 'walls-description': 'Walls Description', 'windows-description': 'Windows Description', 'mainheat-description': 'Main Heating Description', 'hotwater-description': 'Hot Water Description', @@ -81,6 +93,10 @@ mock_epc_response_dupe = { "construction-age-band": "England and Wales: 1967-1975" }, { + "lmk-key": 2, + "uprn": 2, + "number-habitable-rooms": 5, + "property-type": "House", 'inspection-date': '2023-05-01', 'some-other-key': 'some-other-value', 'roof-description': 'Roof Description', 'walls-description': 'Walls Description', 'windows-description': 'Windows Description', 'mainheat-description': 'Main Heating Description', @@ -102,6 +118,10 @@ mock_epc_response_dupe = { "construction-age-band": "England and Wales: 1967-1975" }, { + "lmk-key": 3, + "uprn": 3, + "number-habitable-rooms": 5, + "property-type": "House", 'inspection-date': '2023-06-01', 'some-other-key': 'duplicate-date', 'roof-description': 'Roof Description', 'walls-description': 'Walls Description', 'windows-description': 'Windows Description', @@ -173,9 +193,22 @@ class TestProperty: ) mock_cleaner = Mock(spec=cleaner_spec) + + walls_data = { + "original_description": "Walls Description", + "is_cavity_wall": True, + "is_solid_brick": False, + "is_timber_frame": False, + "is_system_built": False, + "is_park_home": False, + "is_cob": False, + "is_sandstone_or_limestone": False, + "is_granite_or_whinstone": False, + } + mock_cleaner.cleaned = { "roof-description": [{"original_description": "Roof Description"}], - "walls-description": [{"original_description": "Walls Description"}], + "walls-description": [walls_data], "windows-description": [{"original_description": "Windows Description"}], "mainheat-description": [{"original_description": "Main Heating Description"}], "hotwater-description": [{"original_description": "Hot Water Description"}], @@ -214,11 +247,23 @@ class TestProperty: # Verify that the components are set correctly assert property_instance.roof == {"original_description": "Roof Description"} - assert property_instance.walls == {"original_description": "Walls Description"} + assert property_instance.walls == { + "original_description": "Walls Description", + "is_cavity_wall": True, + "is_solid_brick": False, + "is_timber_frame": False, + "is_system_built": False, + "is_park_home": False, + "is_cob": False, + "is_sandstone_or_limestone": False, + "is_granite_or_whinstone": False, + } assert property_instance.windows == {"original_description": "Windows Description"} assert property_instance.main_heating == {"original_description": "Main Heating Description"} assert property_instance.hotwater == {"original_description": "Hot Water Description"} + assert property_instance.wall_type == "cavity" + def test_get_components_without_cleaned_data(self, property_instance, mock_cleaner): # Modify the mock EpcClean to not have cleaned data mock_cleaner.cleaned = {}