diff --git a/backend/hct_mis_api/apps/targeting/tests/test_xlsx_export_targeting_service.py b/backend/hct_mis_api/apps/targeting/tests/test_xlsx_export_targeting_service.py new file mode 100644 index 0000000000..408260abf1 --- /dev/null +++ b/backend/hct_mis_api/apps/targeting/tests/test_xlsx_export_targeting_service.py @@ -0,0 +1,36 @@ +from hct_mis_api.apps.core.base_test_case import APITestCase +from hct_mis_api.apps.core.fixtures import create_afghanistan +from hct_mis_api.apps.targeting.fixtures import TargetPopulationFactory +from hct_mis_api.apps.targeting.models import TargetPopulation +from hct_mis_api.apps.targeting.services.xlsx_export_targeting_service import ( + XlsxExportTargetingService, +) + + +class TestXlsxExportTargetingService(APITestCase): + @classmethod + def setUpTestData(cls) -> None: + cls.business_area = create_afghanistan() + cls.target_population = TargetPopulationFactory( + business_area=cls.business_area, status=TargetPopulation.STATUS_OPEN + ) + + def test_add_version(self) -> None: + service = XlsxExportTargetingService(self.target_population) + service._create_workbook() + service._add_version() + self.assertEqual( + service.ws_meta[XlsxExportTargetingService.VERSION_CELL_NAME_COORDINATES].value, + XlsxExportTargetingService.VERSION_CELL_NAME, + ) + self.assertEqual( + service.ws_meta[XlsxExportTargetingService.VERSION_CELL_COORDINATES].value, + XlsxExportTargetingService.VERSION, + ) + + def test_add_standard_columns_headers(self) -> None: + service = XlsxExportTargetingService(self.target_population) + service._create_workbook() + service._add_standard_columns_headers() + headers = [cell.value for cell in service.ws_individuals[1]] + self.assertEqual(headers, ["Household unicef_id", "unicef_id", "Linked Households", "Bank account information"]) diff --git a/docker/Dockerfile b/docker/Dockerfile index 529ba7d03b..aad60c3e0d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -42,6 +42,7 @@ RUN apt-get update \ ENV PDM_PACKAGES=/packages ENV CODE=/code +ENV PDM_NO_SELF=True ENV PDM_PROJECT=$PDM_PACKAGES ENV PYPACKAGES=$PDM_PACKAGES/__pypackages__/3.11 ENV PYTHONPYCACHEPREFIX=/tmp/pycache \