From 40976fd395f06a63ff07a030347d5a8ce218b891 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Fri, 19 Jan 2024 17:46:44 +0000 Subject: [PATCH] fixed ventialtion recs --- .../tests/test_ventilation_recommendations.py | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/recommendations/tests/test_ventilation_recommendations.py b/recommendations/tests/test_ventilation_recommendations.py index 3242b1d1..aa992253 100644 --- a/recommendations/tests/test_ventilation_recommendations.py +++ b/recommendations/tests/test_ventilation_recommendations.py @@ -1,13 +1,15 @@ from backend.Property import Property from recommendations.VentilationRecommendations import VentilationRecommendations from recommendations.tests.test_data.materials import materials +from etl.epc.Record import EPCRecord class TestVentilationRecommendations: def test_natural_ventilation(self): - input_property1 = Property(id=1, postcode="F4k3 6", address="623 fake street") - input_property1.data = {"mechanical-ventilation": "natural"} + epc_record = EPCRecord() + epc_record.prepared_epc = {"mechanical-ventilation": "natural"} + input_property1 = Property(id=1, postcode="F4k3 6", address="623 fake street", epc_record=epc_record) recommender = VentilationRecommendations( property_instance=input_property1, @@ -27,8 +29,9 @@ class TestVentilationRecommendations: assert recommender.recommendation[0]["parts"][0]["quantity"] == 2 def test_missing_ventilation(self): - input_property2 = Property(id=1, postcode="F4k3 6", address="623 fake street") - input_property2.data = {"mechanical-ventilation": None} + epc_record = EPCRecord() + epc_record.prepared_epc = {"mechanical-ventilation": None} + input_property2 = Property(id=1, postcode="F4k3 6", address="623 fake street", epc_record=epc_record) recommender2 = VentilationRecommendations( property_instance=input_property2, @@ -48,8 +51,9 @@ class TestVentilationRecommendations: assert recommender2.recommendation[0]["parts"][0]["quantity"] == 2 def test_nodata_ventilation(self): - input_property3 = Property(id=1, postcode="F4k3 6", address="623 fake street") - input_property3.data = {"mechanical-ventilation": "NO DATA!!"} + epc_record = EPCRecord() + epc_record.prepared_epc = {"mechanical-ventilation": "NO DATA!!"} + input_property3 = Property(id=1, postcode="F4k3 6", address="623 fake street", epc_record=epc_record) recommender3 = VentilationRecommendations( property_instance=input_property3, @@ -69,8 +73,9 @@ class TestVentilationRecommendations: assert recommender3.recommendation[0]["parts"][0]["quantity"] == 2 def test_existing_ventilation_1(self): - input_property4 = Property(id=1, postcode="F4k3 6", address="623 fake street") - input_property4.data = {"mechanical-ventilation": 'mechanical, extract only'} + epc_record = EPCRecord() + epc_record.prepared_epc = {"mechanical-ventilation": "mechanical, extract only"} + input_property4 = Property(id=1, postcode="F4k3 6", address="623 fake street", epc_record=epc_record) recommender4 = VentilationRecommendations( property_instance=input_property4, @@ -85,8 +90,9 @@ class TestVentilationRecommendations: assert recommender4.has_ventilaion def test_existing_ventilation_2(self): - input_property5 = Property(id=1, postcode="F4k3 6", address="623 fake street") - input_property5.data = {"mechanical-ventilation": 'mechanical, supply and extract'} + epc_record = EPCRecord() + epc_record.prepared_epc = {"mechanical-ventilation": "mechanical, supply and extract"} + input_property5 = Property(id=1, postcode="F4k3 6", address="623 fake street", epc_record=epc_record) recommender5 = VentilationRecommendations( property_instance=input_property5,