Skip to content

Commit 09b1ddb

Browse files
committed
fix test centre-id handling in topic
1 parent a7e008e commit 09b1ddb

File tree

3 files changed

+108
-1
lines changed

3 files changed

+108
-1
lines changed

pywcmp/wcmp2/ets.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,8 @@ def test_requirement_links(self):
508508
if link['channel'].startswith(('origin/a/wis2', 'cache/a/wis2')): # noqa
509509
centre_id = link['channel'].split('/')[3]
510510

511-
if centre_id not in self.th.topics[3]:
511+
if (not centre_id.endswith('-test') and
512+
centre_id not in self.th.topics[3]):
512513
status['code'] = 'FAILED'
513514
status['message'] = 'Invalid WIS2 topic (unknown centre-id) for Pub/Sub link channel' # noqa
514515
return status
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{
2+
"id": "urn:wmo:md:int-wmo-test:cap",
3+
"conformsTo": [
4+
"http://wis.wmo.int/spec/wcmp/2/conf/core"
5+
],
6+
"type": "Feature",
7+
"geometry": {
8+
"type": "Polygon",
9+
"coordinates": [
10+
[
11+
[
12+
-180.0,
13+
-90.0
14+
],
15+
[
16+
-180.0,
17+
90.0
18+
],
19+
[
20+
180.0,
21+
90.0
22+
],
23+
[
24+
180.0,
25+
-90.0
26+
],
27+
[
28+
-180.0,
29+
-90.0
30+
]
31+
]
32+
]
33+
},
34+
"properties": {
35+
"identifier": "urn:wmo:md:int-wmo-test:cap",
36+
"title": "CAP Alerts test dataset",
37+
"description": "CAP Alerts test dataset",
38+
"themes": [
39+
{
40+
"concepts": [
41+
{
42+
"id": "weather"
43+
}
44+
],
45+
"scheme": "https://codes.wmo.int/wis/topic-hierarchy/earth-system-discipline"
46+
}
47+
],
48+
"type": "dataset",
49+
"created": "2023-03-26T00:00:00Z",
50+
"updated": "2025-06-17T01:59:32Z",
51+
"rights": "WMO Unified Policy for the International Exchange of Earth System Data",
52+
"contacts": [
53+
{
54+
"roles": [
55+
"host"
56+
],
57+
"organization": "World Meteorological Organisation",
58+
"name": "Firstname Lastname",
59+
"position": "Position Name",
60+
"hoursOfService": "0800h - 1600h UTC",
61+
"contactInstructions": "email",
62+
"links": [
63+
{
64+
"rel": "canonical",
65+
"type": "text/html",
66+
"href": "https://www.wmo.int/"
67+
}
68+
]
69+
}
70+
],
71+
"keywords": [
72+
"CAP",
73+
"warnings",
74+
"alerts"
75+
],
76+
"wmo:dataPolicy": "core",
77+
"id": "urn:wmo:md:int-wmo-test:cap"
78+
},
79+
"time": {
80+
"interval": [
81+
"2024-07-02",
82+
".."
83+
],
84+
"resolution": "PT1H"
85+
},
86+
"links": [
87+
{
88+
"href": "mqtt://everyone:everyone@localhost:1883",
89+
"type": "application/json",
90+
"name": "origin/a/wis2/int-wmo-test/data/core/weather/advisories-warnings",
91+
"rel": "items",
92+
"channel": "origin/a/wis2/int-wmo-test/data/core/weather/advisories-warnings",
93+
"title": "Notifications"
94+
}
95+
]
96+
}

tests/run_tests.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,16 @@ def test_centre_id(self):
9494
self.assertEqual(codes.count('PASSED'), 12)
9595
self.assertEqual(codes.count('SKIPPED'), 0)
9696

97+
with open(get_test_file_path('data/wcmp2-passing-test-centre-id-in-topic.json')) as fh: # noqa
98+
ts = WMOCoreMetadataProfileTestSuite2(json.load(fh))
99+
results = ts.run_tests(fail_on_schema_validation=True)
100+
101+
codes = [r['code'] for r in results['tests']]
102+
103+
self.assertEqual(codes.count('FAILED'), 0)
104+
self.assertEqual(codes.count('PASSED'), 12)
105+
self.assertEqual(codes.count('SKIPPED'), 0)
106+
97107
with open(get_test_file_path('data/wcmp2-failing-invalid-centre-id.json')) as fh: # noqa
98108
ts = WMOCoreMetadataProfileTestSuite2(json.load(fh))
99109
results = ts.run_tests()

0 commit comments

Comments
 (0)