Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
pavlo-mk committed May 10, 2024
1 parent 4c909db commit 727afa9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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"])
1 change: 1 addition & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit 727afa9

Please sign in to comment.