-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
backend/hct_mis_api/apps/targeting/tests/test_xlsx_export_targeting_service.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters