diff --git a/pywcmp/wcmp2/ets.py b/pywcmp/wcmp2/ets.py index adde06a..8954d1e 100644 --- a/pywcmp/wcmp2/ets.py +++ b/pywcmp/wcmp2/ets.py @@ -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 diff --git a/tests/data/wcmp2-passing-test-centre-id-in-topic.json b/tests/data/wcmp2-passing-test-centre-id-in-topic.json new file mode 100644 index 0000000..95f2e5f --- /dev/null +++ b/tests/data/wcmp2-passing-test-centre-id-in-topic.json @@ -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" + } + ] +} diff --git a/tests/run_tests.py b/tests/run_tests.py index 8b7fec7..3663ccd 100644 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -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()