Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pywcmp/wcmp2/ets.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,8 @@ def test_requirement_links(self):
if link['channel'].startswith(('origin/a/wis2', 'cache/a/wis2')): # noqa
centre_id = link['channel'].split('/')[3]

if centre_id not in self.th.topics[3]:
if (not centre_id.endswith('-test') and
centre_id not in self.th.topics[3]):
status['code'] = 'FAILED'
status['message'] = 'Invalid WIS2 topic (unknown centre-id) for Pub/Sub link channel' # noqa
return status
Expand Down
96 changes: 96 additions & 0 deletions tests/data/wcmp2-passing-test-centre-id-in-topic.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"id": "urn:wmo:md:int-wmo-test:cap",
"conformsTo": [
"http://wis.wmo.int/spec/wcmp/2/conf/core"
],
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-180.0,
-90.0
],
[
-180.0,
90.0
],
[
180.0,
90.0
],
[
180.0,
-90.0
],
[
-180.0,
-90.0
]
]
]
},
"properties": {
"identifier": "urn:wmo:md:int-wmo-test:cap",
"title": "CAP Alerts test dataset",
"description": "CAP Alerts test dataset",
"themes": [
{
"concepts": [
{
"id": "weather"
}
],
"scheme": "https://codes.wmo.int/wis/topic-hierarchy/earth-system-discipline"
}
],
"type": "dataset",
"created": "2023-03-26T00:00:00Z",
"updated": "2025-06-17T01:59:32Z",
"rights": "WMO Unified Policy for the International Exchange of Earth System Data",
"contacts": [
{
"roles": [
"host"
],
"organization": "World Meteorological Organisation",
"name": "Firstname Lastname",
"position": "Position Name",
"hoursOfService": "0800h - 1600h UTC",
"contactInstructions": "email",
"links": [
{
"rel": "canonical",
"type": "text/html",
"href": "https://www.wmo.int/"
}
]
}
],
"keywords": [
"CAP",
"warnings",
"alerts"
],
"wmo:dataPolicy": "core",
"id": "urn:wmo:md:int-wmo-test:cap"
},
"time": {
"interval": [
"2024-07-02",
".."
],
"resolution": "PT1H"
},
"links": [
{
"href": "mqtt://everyone:everyone@localhost:1883",
"type": "application/json",
"name": "origin/a/wis2/int-wmo-test/data/core/weather/advisories-warnings",
"rel": "items",
"channel": "origin/a/wis2/int-wmo-test/data/core/weather/advisories-warnings",
"title": "Notifications"
}
]
}
10 changes: 10 additions & 0 deletions tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ def test_centre_id(self):
self.assertEqual(codes.count('PASSED'), 12)
self.assertEqual(codes.count('SKIPPED'), 0)

with open(get_test_file_path('data/wcmp2-passing-test-centre-id-in-topic.json')) as fh: # noqa
ts = WMOCoreMetadataProfileTestSuite2(json.load(fh))
results = ts.run_tests(fail_on_schema_validation=True)

codes = [r['code'] for r in results['tests']]

self.assertEqual(codes.count('FAILED'), 0)
self.assertEqual(codes.count('PASSED'), 12)
self.assertEqual(codes.count('SKIPPED'), 0)

with open(get_test_file_path('data/wcmp2-failing-invalid-centre-id.json')) as fh: # noqa
ts = WMOCoreMetadataProfileTestSuite2(json.load(fh))
results = ts.run_tests()
Expand Down