Skip to content

Commit 370ac04

Browse files
committed
DesInventar(Testcase): add test cases and update cassettes
1 parent 420a344 commit 370ac04

File tree

4 files changed

+464
-22
lines changed

4 files changed

+464
-22
lines changed
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
interactions:
2+
- request:
3+
body: null
4+
headers:
5+
Connection:
6+
- close
7+
Host:
8+
- ifrcgo.org
9+
User-Agent:
10+
- Python-urllib/3.12
11+
method: GET
12+
uri: https://ifrcgo.org/monty-stac-extension/v1.1.0/schema.json
13+
response:
14+
body:
15+
string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\":
16+
\"https://ifrcgo.org/monty-stac-extension/v1.1.0/schema.json#\",\n \"title\":
17+
\"Monty Extension\",\n \"description\": \"STAC Monty Extension for STAC Items
18+
and STAC Collections.\",\n \"oneOf\": [\n {\n \"$comment\": \"This
19+
is the schema for STAC Items.\",\n \"allOf\": [\n {\n \"$ref\":
20+
\"#/definitions/stac_extensions\"\n },\n {\n \"type\":
21+
\"object\",\n \"required\": [\n \"type\",\n \"properties\"\n
22+
\ ],\n \"properties\": {\n \"type\": {\n \"const\":
23+
\"Feature\"\n },\n \"properties\": {\n \"allOf\":
24+
[\n {\n \"$comment\": \"Require fields here
25+
for Item Properties.\",\n \"required\": [\n \"monty:country_codes\",\n
26+
\ \"monty:hazard_codes\",\n \"monty:corr_id\",\n
27+
\ \"roles\"\n ]\n },\n {\n
28+
\ \"$ref\": \"#/definitions/fields\"\n },\n
29+
\ {\n \"$ref\": \"#/definitions/roles\"\n }\n
30+
\ ]\n }\n }\n }\n ]\n },\n
31+
\ {\n \"$comment\": \"This is the schema for STAC Collections.\",\n
32+
\ \"allOf\": [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n
33+
\ },\n {\n \"type\": \"object\",\n \"required\":
34+
[\n \"type\",\n \"providers\",\n \"license\"\n
35+
\ ],\n \"properties\": {\n \"type\": {\n \"const\":
36+
\"Collection\"\n }\n }\n },\n {\n \"$ref\":
37+
\"#/definitions/roles\"\n }\n ],\n \"anyOf\": [\n {\n
38+
\ \"$comment\": \"This is the schema for the fields in Summaries.
39+
By default, only checks the existence of the properties, but not the schema
40+
of the summaries.\",\n \"required\": [\n \"summaries\"\n
41+
\ ],\n \"properties\": {\n \"summaries\": {\n
42+
\ \"required\": [\n \"monty:country_codes\",\n
43+
\ \"monty:hazard_codes\"\n ]\n }\n }\n
44+
\ }\n ]\n }\n ],\n \"definitions\": {\n \"stac_extensions\":
45+
{\n \"type\": \"object\",\n \"required\": [\n \"stac_extensions\"\n
46+
\ ],\n \"properties\": {\n \"stac_extensions\": {\n \"type\":
47+
\"array\",\n \"contains\": {\n \"const\": \"https://ifrcgo.org/monty-stac-extension/v1.1.0/schema.json\"\n
48+
\ }\n }\n }\n },\n \"fields\": {\n \"$comment\":
49+
\"Monty prefixed fields\",\n \"type\": \"object\",\n \"properties\":
50+
{\n \"monty:episode_number\": {\n \"type\": \"integer\"\n
51+
\ },\n \"monty:country_codes\": {\n \"type\": \"array\",\n
52+
\ \"items\": {\n \"type\": \"string\",\n \"pattern\":
53+
\"^([A-Z]{3})|AB9$\",\n \"$comment\": \"AB9 is a special code for
54+
the Abyei area used by IDMC\"\n }\n },\n \"monty:hazard_codes\":
55+
{\n \"type\": \"array\",\n \"items\": {\n \"type\":
56+
\"string\",\n \"pattern\": \"^([A-Z]{2}(?:\\\\d{4}$){0,1})|([a-z]{3}-[a-z]{3}-[a-z]{3}-[a-z]{3})|([A-Z]{2})$\"\n
57+
\ }\n },\n \"monty:corr_id\": {\n \"type\":
58+
\"string\"\n },\n \"monty:hazard_detail\": {\n \"type\":
59+
\"object\",\n \"required\": [\n \"severity_value\",\n
60+
\ \"severity_unit\"\n ],\n \"properties\": {\n
61+
\ \"severity_value\": {\n \"type\": \"number\",\n \"description\":
62+
\"The estimated maximum hazard intensity/magnitude/severity value, as a number,
63+
without the units.\"\n },\n \"severity_unit\": {\n \"type\":
64+
\"string\"\n },\n \"severity_label\": {\n \"type\":
65+
\"string\"\n },\n \"estimate_type\": {\n \"$ref\":
66+
\"#/definitions/estimate_type\"\n }\n },\n \"additionalProperties\":
67+
true\n },\n \"monty:impact_detail\": {\n \"type\":
68+
\"object\",\n \"properties\": {\n \"category\": {\n \"type\":
69+
\"string\",\n \"enum\": [\n \"people\",\n \"crops\",\n
70+
\ \"women\",\n \"men\",\n \"children_0_4\",\n
71+
\ \"children_5_9\",\n \"children_10_14\",\n \"children_15_19\",\n
72+
\ \"adult_20_24\",\n \"adult_25_29\",\n \"adult_30_34\",\n
73+
\ \"adult_35_39\",\n \"adult_40_44\",\n \"adult_45_49\",\n
74+
\ \"adult_50_54\",\n \"adult_55_59\",\n \"adult_60_64\",\n
75+
\ \"elderly\",\n \"wheelchair_users\",\n \"roads\",\n
76+
\ \"railways\",\n \"vulnerable_employment\",\n
77+
\ \"buildings\",\n \"reconstruction_costs\",\n
78+
\ \"hospitals\",\n \"schools\",\n \"education_centers\",\n
79+
\ \"local_currency\",\n \"global_currency\",\n
80+
\ \"local_currency_adj\",\n \"global_currency_adj\",\n
81+
\ \"usd_uncertain\",\n \"cattle\",\n \"aid_general\",\n
82+
\ \"ifrc_contribution\",\n \"ifrc_requested\",\n
83+
\ \"alertscore\",\n \"total_affected\",\n \"households\"\n
84+
\ ]\n },\n \"type\": {\n \"type\":
85+
\"string\",\n \"enum\": [\n \"unspecified\",\n
86+
\ \"unaffected\",\n \"damaged\",\n \"destroyed\",\n
87+
\ \"potentially_damaged\",\n \"affected_total\",\n
88+
\ \"affected_direct\",\n \"affected_indirect\",\n
89+
\ \"death\",\n \"missing\",\n \"injured\",\n
90+
\ \"evacuated\",\n \"relocated\",\n \"assisted\",\n
91+
\ \"shelter_emergency\",\n \"shelter_temporary\",\n
92+
\ \"shelter_longterm\",\n \"in_need\",\n \"targeted\",\n
93+
\ \"disrupted\",\n \"cost\",\n \"homeless\",\n
94+
\ \"displaced_internal\",\n \"displaced_external\",\n
95+
\ \"displaced_total\",\n \"alertscore\",\n \"potentially_affected\",\n
96+
\ \"highest_risk\"\n ]\n },\n \"value\":
97+
{\n \"type\": \"number\"\n },\n \"unit\":
98+
{\n \"type\": \"string\"\n },\n \"estimate_type\":
99+
{\n \"$ref\": \"#/definitions/estimate_type\"\n },\n
100+
\ \"description\": {\n \"type\": \"string\"\n }\n
101+
\ },\n \"additionalProperties\": false\n }\n },\n
102+
\ \"patternProperties\": {\n \"^(?!monty:)\": {\n \"$comment\":
103+
\"Prevent additional monty prefixed field\"\n }\n },\n \"additionalProperties\":
104+
false\n },\n \"estimate_type\": {\n \"type\": \"string\",\n \"enum\":
105+
[\n \"primary\",\n \"secondary\",\n \"modelled\"\n ]\n
106+
\ },\n \"roles\": {\n \"$comment\": \"Roles field\",\n \"oneOf\":
107+
[\n {\n \"$comment\": \"Reference Event\",\n \"allOf\":
108+
[\n {\n \"$ref\": \"#/definitions/is_event\"\n },\n
109+
\ {\n \"$ref\": \"#/definitions/is_reference\"\n }\n
110+
\ ]\n },\n {\n \"$comment\": \"Source Event\",\n
111+
\ \"allOf\": [\n {\n \"$ref\": \"#/definitions/is_event\"\n
112+
\ },\n {\n \"$ref\": \"#/definitions/is_source\"\n
113+
\ }\n ]\n },\n {\n \"$comment\":
114+
\"Hazard\",\n \"allOf\": [\n {\n \"$ref\":
115+
\"#/definitions/is_hazard\"\n }\n ]\n },\n {\n
116+
\ \"$comment\": \"Impact\",\n \"allOf\": [\n {\n
117+
\ \"$ref\": \"#/definitions/is_impact\"\n }\n ]\n
118+
\ }\n ]\n },\n \"is_event\": {\n \"properties\": {\n
119+
\ \"roles\": {\n \"type\": \"array\",\n \"minItems\":
120+
2,\n \"contains\": {\n \"const\": \"event\"\n }\n
121+
\ }\n }\n },\n \"is_reference\": {\n \"properties\":
122+
{\n \"roles\": {\n \"type\": \"array\",\n \"minItems\":
123+
2,\n \"contains\": {\n \"const\": \"reference\"\n }\n
124+
\ }\n }\n },\n \"is_source\": {\n \"properties\": {\n
125+
\ \"roles\": {\n \"type\": \"array\",\n \"minItems\":
126+
2,\n \"contains\": {\n \"const\": \"source\"\n }\n
127+
\ }\n }\n },\n \"is_hazard\": {\n \"properties\": {\n
128+
\ \"roles\": {\n \"type\": \"array\",\n \"minItems\":
129+
1,\n \"contains\": {\n \"const\": \"hazard\"\n }\n
130+
\ },\n \"monty:hazard_codes\": {\n \"minItems\": 1,\n
131+
\ \"maxItems\": 3,\n \"uniqueItems\": true,\n \"$comment\":
132+
\"REQUIRED: Exactly 1 UNDRR-ISC 2025 code (format: 2 letters + 4 digits, e.g.,
133+
GH0101, MH0600). OPTIONAL: At most 1 GLIDE code (2 uppercase letters, e.g.,
134+
FL, EQ) and at most 1 EM-DAT code (nat-xxx-xxx-xxx format). LIMITATION: JSON
135+
Schema draft-07 cannot fully enforce 'at most 1 per type' - custom validation
136+
may be needed to prevent multiple codes of the same classification type.\",\n
137+
\ \"contains\": {\n \"type\": \"string\",\n \"pattern\":
138+
\"^[A-Z]{2}\\\\d{4}$\",\n \"$comment\": \"At least one UNDRR-ISC
139+
2025 code is required\"\n },\n \"items\": {\n \"type\":
140+
\"string\",\n \"anyOf\": [\n {\n \"pattern\":
141+
\"^[A-Z]{2}\\\\d{4}$\",\n \"$comment\": \"UNDRR-ISC 2025 format:
142+
2 uppercase letters + 4 digits (e.g., GH0101, MH0600)\"\n },\n
143+
\ {\n \"pattern\": \"^[A-Z]{2}$\",\n \"$comment\":
144+
\"GLIDE format: 2 uppercase letters (e.g., FL, EQ, TC)\"\n },\n
145+
\ {\n \"pattern\": \"^[a-z]{3}-[a-z]{3}-[a-z]{3}-[a-z]{3}$\",\n
146+
\ \"$comment\": \"EM-DAT format: 4 groups of 3 lowercase letters
147+
separated by dashes (e.g., nat-hyd-flo-flo)\"\n }\n ]\n
148+
\ }\n }\n }\n },\n \"is_impact\": {\n \"properties\":
149+
{\n \"roles\": {\n \"type\": \"array\",\n \"minItems\":
150+
1,\n \"contains\": {\n \"const\": \"impact\"\n }\n
151+
\ }\n }\n }\n }\n}\n"
152+
headers:
153+
Accept-Ranges:
154+
- bytes
155+
Access-Control-Allow-Origin:
156+
- '*'
157+
Age:
158+
- '408'
159+
Cache-Control:
160+
- max-age=600
161+
Connection:
162+
- close
163+
Content-Length:
164+
- '10393'
165+
Content-Type:
166+
- application/json; charset=utf-8
167+
Date:
168+
- Wed, 12 Nov 2025 06:06:39 GMT
169+
ETag:
170+
- '"690c54cc-2899"'
171+
Last-Modified:
172+
- Thu, 06 Nov 2025 07:57:00 GMT
173+
Server:
174+
- GitHub.com
175+
Vary:
176+
- Accept-Encoding
177+
Via:
178+
- 1.1 varnish
179+
X-Cache:
180+
- HIT
181+
X-Cache-Hits:
182+
- '2'
183+
X-Fastly-Request-ID:
184+
- 3d10e2d9d7d4f1613230d5f0ce8238223dea109f
185+
X-GitHub-Request-Id:
186+
- 9A3E:2F62DB:5BE57:72BDD:69141429
187+
X-Served-By:
188+
- cache-del21728-DEL
189+
X-Timer:
190+
- S1762927599.046775,VS0,VE0
191+
expires:
192+
- Wed, 12 Nov 2025 05:09:22 GMT
193+
x-proxy-cache:
194+
- MISS
195+
status:
196+
code: 200
197+
message: OK
198+
version: 1

0 commit comments

Comments
 (0)