diff --git a/src/ngohub/normalization/organization.py b/src/ngohub/normalization/organization.py index aa4e86e..d60ebe1 100644 --- a/src/ngohub/normalization/organization.py +++ b/src/ngohub/normalization/organization.py @@ -1,6 +1,6 @@ from typing import Any, Dict, List -from ngohub.models.locations import CityBase, County +from ngohub.models.locations import CityBase, County, Region from ngohub.models.nomenclatures import Domain from ngohub.models.organization import ( Application, @@ -37,10 +37,15 @@ def _normalize_organization_general(org_general_data: Dict) -> OrganizationGener def _normalize_organization_activity(org_activity_data: Dict) -> OrganizationActivity: org_domains: List[Domain] = [] + org_regions: List[Region] = [] for domain in org_activity_data["domains"]: org_domains.append(Domain(**domain)) + for region in org_activity_data["regions"]: + org_regions.append(Region(**region)) org_activity_data["domains"] = org_domains + org_activity_data["regions"] = org_regions + normal_data = OrganizationActivity(**org_activity_data) return normal_data diff --git a/tests/test_end_to_end/test_organization.py b/tests/test_end_to_end/test_organization.py index 94ff7a4..7fc9573 100644 --- a/tests/test_end_to_end/test_organization.py +++ b/tests/test_end_to_end/test_organization.py @@ -10,6 +10,8 @@ ORGANIZATION_SCHEMA, ) +TEST_ORGANIZATION_IDS = [1, 10, 23, 296] + def test_organization_profile(): hub = NGOHub(pytest.ngohub_api_url) @@ -25,7 +27,7 @@ def test_organization_profile_returns_401(): hub.get_raw_organization_profile(ngo_token="invalid_token") -@pytest.mark.parametrize("organization_id", [1, 10, 23, 296]) +@pytest.mark.parametrize("organization_id", TEST_ORGANIZATION_IDS) def test_raw_organization(organization_id): hub = NGOHub(pytest.ngohub_api_url) @@ -34,7 +36,7 @@ def test_raw_organization(organization_id): assert ORGANIZATION_SCHEMA.validate(response) -@pytest.mark.parametrize("organization_id", [1, 10, 23, 296]) +@pytest.mark.parametrize("organization_id", TEST_ORGANIZATION_IDS) def test_organization(organization_id): hub = NGOHub(pytest.ngohub_api_url)