Skip to content

Commit cac8198

Browse files
authored
HDXDSYS-895 Split HAPI pipelines test into multiple tests (OCHA-DAP#138)
* Split HAPI pipelines test into multiple tests * Move org mapping checks to named file
1 parent af5ab67 commit cac8198

7 files changed

+320
-302
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,16 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

7+
## [0.9.40] - 2024-07-30
8+
9+
### Changed
10+
11+
- Split pipelines test into multiple tests
12+
713
## [0.9.39] - 2024-07-29
814

15+
### Fixed
16+
917
- COD and TCD operational presence update
1018

1119
## [0.9.38] - 2024-07-26

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ requires-python = ">=3.8"
3535

3636
dependencies = [
3737
"hapi-schema>=0.8.14",
38-
"hdx-python-api>= 6.3.1",
38+
"hdx-python-api>= 6.3.2",
3939
"hdx-python-country>= 3.7.7",
4040
"hdx-python-database[postgresql]>= 1.3.1",
4141
"hdx-python-scraper>= 2.4.0",

requirements.txt

+6-6
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ gspread==6.1.2
6060
# via hdx-python-scraper
6161
hapi-schema==0.8.14
6262
# via hapi-pipelines (pyproject.toml)
63-
hdx-python-api==6.3.1
63+
hdx-python-api==6.3.2
6464
# via
6565
# hapi-pipelines (pyproject.toml)
6666
# hdx-python-scraper
@@ -150,7 +150,7 @@ ply==3.11
150150
# libhxl
151151
pockets==0.9.1
152152
# via sphinxcontrib-napoleon
153-
pre-commit==3.7.1
153+
pre-commit==3.8.0
154154
# via hapi-pipelines (pyproject.toml)
155155
psycopg==3.2.1
156156
# via hdx-python-database
@@ -178,7 +178,7 @@ pyopenssl==24.2.1
178178
# ndg-httpsclient
179179
pyphonetics==0.5.3
180180
# via hdx-python-country
181-
pytest==8.3.1
181+
pytest==8.3.2
182182
# via
183183
# hapi-pipelines (pyproject.toml)
184184
# pytest-check
@@ -214,7 +214,7 @@ referencing==0.35.1
214214
# via
215215
# jsonschema
216216
# jsonschema-specifications
217-
regex==2024.5.15
217+
regex==2024.7.24
218218
# via hdx-python-scraper
219219
requests==2.32.3
220220
# via
@@ -232,7 +232,7 @@ rfc3986==2.0.0
232232
# via frictionless
233233
rich==13.7.1
234234
# via typer
235-
rpds-py==0.19.0
235+
rpds-py==0.19.1
236236
# via
237237
# jsonschema
238238
# referencing
@@ -242,7 +242,7 @@ ruamel-yaml==0.18.6
242242
# via hdx-python-utilities
243243
ruamel-yaml-clib==0.2.8
244244
# via ruamel-yaml
245-
setuptools==71.1.0
245+
setuptools==72.1.0
246246
# via ckanapi
247247
shellingham==1.5.4
248248
# via typer

tests/__init__.py

Whitespace-only changes.

tests/org_mappings.py

+172
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
from hapi.pipelines.database.org import OrgInfo
2+
3+
4+
def check_org_mappings(pipelines):
5+
org_map = pipelines.org._org_map
6+
iom = OrgInfo(
7+
"International Organization for Migration",
8+
"international organization for migration",
9+
"IOM",
10+
"iom",
11+
"447",
12+
True,
13+
True,
14+
)
15+
assert org_map[(None, "IOM")] == iom
16+
assert org_map[(None, "iom")] == iom
17+
assert (
18+
org_map[
19+
(
20+
None,
21+
"Organisation Internationale pour les Migrations",
22+
)
23+
]
24+
== iom
25+
)
26+
assert (
27+
org_map[
28+
(
29+
None,
30+
"organisation internationale pour les migrations",
31+
)
32+
]
33+
== iom
34+
)
35+
36+
iom = OrgInfo(
37+
"International Organization for Migration",
38+
"international organization for migration",
39+
"IOM",
40+
"iom",
41+
"447",
42+
False,
43+
False,
44+
)
45+
assert org_map[(None, "International Organisation for Migrations")] == iom
46+
assert org_map[(None, "international organisation for migrations")] == iom
47+
assert org_map[(None, "INTERNATIONALE ORGANISATION FOR MIGRATION")] == iom
48+
assert org_map[(None, "internationale organisation for migration")] == iom
49+
assert (
50+
org_map[
51+
(
52+
None,
53+
"Organisation Internationale des Migrations",
54+
)
55+
]
56+
== iom
57+
)
58+
assert (
59+
org_map[
60+
(
61+
None,
62+
"organisation internationale des migrations",
63+
)
64+
]
65+
== iom
66+
)
67+
assert (
68+
org_map[
69+
(
70+
None,
71+
"OIM - International Organization for Migration",
72+
)
73+
]
74+
== iom
75+
)
76+
assert (
77+
org_map[
78+
(
79+
None,
80+
"oim international organization for migration",
81+
)
82+
]
83+
== iom
84+
)
85+
86+
unicef = OrgInfo(
87+
"United Nations Children's Fund",
88+
"united nations childrens fund",
89+
"UNICEF",
90+
"unicef",
91+
"447",
92+
True,
93+
True,
94+
)
95+
assert org_map[(None, "United Nations Children's Fund")] == unicef
96+
assert org_map[(None, "united nations childrens fund")] == unicef
97+
assert org_map[(None, "UNICEF")] == unicef
98+
assert org_map[(None, "unicef")] == unicef
99+
assert org_map[(None, "Fonds des Nations Unies pour l'Enfance")] == unicef
100+
assert org_map[(None, "fonds des nations unies pour lenfance")] == unicef
101+
assert (
102+
org_map[
103+
(
104+
None,
105+
"UNICEF - Fondo de las Naciones Unidas para la Infancia",
106+
)
107+
]
108+
== unicef
109+
)
110+
assert (
111+
org_map[
112+
(
113+
None,
114+
"unicef fondo de las naciones unidas para la infancia",
115+
)
116+
]
117+
== unicef
118+
)
119+
120+
unicef = OrgInfo(
121+
"United Nations Children's Fund",
122+
"united nations childrens fund",
123+
"UNICEF",
124+
"unicef",
125+
"447",
126+
False,
127+
False,
128+
)
129+
assert (
130+
org_map[(None, "United Nations Children's Emergency Fund")] == unicef
131+
)
132+
assert org_map[(None, "united nations childrens emergency fund")] == unicef
133+
assert org_map[(None, "Fond des Nations Unies pour l'Enfance")] == unicef
134+
assert org_map[(None, "fond des nations unies pour lenfance")] == unicef
135+
assert (
136+
org_map[
137+
(
138+
None,
139+
"United Nations International Childrens Emergency Fund",
140+
)
141+
]
142+
== unicef
143+
)
144+
assert (
145+
org_map[
146+
(
147+
None,
148+
"united nations international childrens emergency fund",
149+
)
150+
]
151+
== unicef
152+
)
153+
154+
assert org_map[("AFG", "WEWORLD")] == OrgInfo(
155+
"WEWORLD",
156+
"weworld",
157+
"WEWORLD",
158+
"weworld",
159+
None,
160+
True,
161+
False,
162+
)
163+
164+
assert org_map[("NGA", "HECADF")] == OrgInfo(
165+
"HECADF",
166+
"hecadf",
167+
"HECADF",
168+
"hecadf",
169+
"441",
170+
True,
171+
True,
172+
)

0 commit comments

Comments
 (0)