# A very simple script to read a presite note and load to a postgres database import os from etl.surveyedData.surveryedData import surveyedDataProcessor from etl.db.db import get_db_session, init_db from etl.transform.preSiteNoteTypes import AssessorInfo import pytest from etl.jjc_old_lewis_manual_way_ import work_out_total_floor_area @pytest.fixture(scope="module") def pre_site_note_path(): """Fixture for the path to the example pre-site note.""" return os.path.join(os.getcwd(), "example_data", "pre_site_note.pdf") @pytest.fixture(scope="module") def local_survey(pre_site_note_path): """Fixture to create a surveyedDataProcessor instance.""" return surveyedDataProcessor("122 Fake Street", [pre_site_note_path]) def test_assessor_accreditation(local_survey): """Test that the assessor accreditation number is correct.""" assert local_survey.pre_site_note.assessor_information.accreditation_number == "QUID211435" def test_floor_area_calculator(local_survey): # Floor area is important to work out invoice, make a test to work out invoice correctly area = work_out_total_floor_area(local_survey.pre_site_note) assert area == ('73-97m', 91) def test_address_and_post_code(local_survey): assert local_survey.pre_site_note.survey_information.address == "10 Turnberry Close, ST. LEONARDS-ON-SEA" assert local_survey.pre_site_note.survey_information.postcode == "TN38 0WL"