diff --git a/tests/test_data/unit-label-or-symbol.json b/tests/test_data/label-or-symbol-unit.json similarity index 100% rename from tests/test_data/unit-label-or-symbol.json rename to tests/test_data/label-or-symbol-unit.json diff --git a/tests/test_data/landing-page.json b/tests/test_data/landing-page.json new file mode 100644 index 0000000..40cc3a2 --- /dev/null +++ b/tests/test_data/landing-page.json @@ -0,0 +1,47 @@ +{ + "links": [ + { + "href": "https://api.dataplatform.knmi.nl/edr/", + "rel": "self", + "title": "Landing Page in JSON" + }, + { + "href": "https://api.dataplatform.knmi.nl/edr/docs", + "rel": "service-desc", + "title": "API description in HTML" + }, + { + "href": "https://api.dataplatform.knmi.nl/edr/openapi.json", + "rel": "service-desc", + "title": "API description in JSON" + }, + { + "href": "https://api.dataplatform.knmi.nl/edr/conformance", + "rel": "data", + "title": "Conformance Declaration in JSON" + }, + { + "href": "https://api.dataplatform.knmi.nl/edr/collections", + "rel": "data", + "title": "Collections metadata in JSON" + } + ], + "title": "Observations API EDR", + "description": "The observation api in EDR format from the KNMI", + "keywords": [ + "Weather", + "Temperature", + "Wind", + "Humidity", + "Pressure", + "Clouds", + "Radiation" + ], + "provider": { + "name": "KNMI - Koninklijk Nederlands Meteorologisch Instituut", + "url": "dataplatform.knmi.nl" + }, + "contact": { + "email": "opendata@knmi.nl" + } +} diff --git a/tests/test_edr.py b/tests/test_edr.py index 83aa8ba..03d1830 100644 --- a/tests/test_edr.py +++ b/tests/test_edr.py @@ -2,6 +2,7 @@ from pathlib import Path import pytest +from edr_pydantic.capabilities import LandingPageModel from edr_pydantic.collections import Collections from edr_pydantic.collections import Instance from edr_pydantic.unit import Unit @@ -11,6 +12,7 @@ ("knmi-example-collections.json", Collections), ("doc-example-collections.json", Collections), ("simple-instance.json", Instance), + ("landing-page.json", LandingPageModel), ] @@ -33,7 +35,7 @@ def test_happy_cases(file_name, object_type): assert object_type.model_validate_json(json_string).model_dump_json(exclude_none=True) == json_string -error_cases = [("unit-label-or-symbol.json", Unit, r"Either 'label' or 'symbol' should be set")] +error_cases = [("label-or-symbol-unit.json", Unit, r"Either 'label' or 'symbol' should be set")] @pytest.mark.parametrize("file_name, object_type, error_message", error_cases)