diff --git a/cubedash/_stac.py b/cubedash/_stac.py index e917edd84..5a8cb8413 100644 --- a/cubedash/_stac.py +++ b/cubedash/_stac.py @@ -96,6 +96,7 @@ def root(): return _stac_response( dict( **stac_endpoint_information(), + type="Catalog", links=[ dict( title="Collections", @@ -383,6 +384,7 @@ def arrivals(): dict( id="Arrivals", title="Dataset Arrivals", + type="Catalog", license="various", description="The most recently added Items to this index", properties={}, diff --git a/integration_tests/test_stac.py b/integration_tests/test_stac.py index b3a558d9b..ea8257fd4 100644 --- a/integration_tests/test_stac.py +++ b/integration_tests/test_stac.py @@ -598,6 +598,7 @@ def test_huge_page_request(stac_client: FlaskClient): def test_stac_collections(stac_client: FlaskClient): response = get_json(stac_client, "/stac") + _CATALOG_SCHEMA.validate(response) assert response["id"] == "odc-explorer", "Expected default unconfigured endpoint id" assert ( @@ -662,6 +663,22 @@ def test_stac_collections(stac_client: FlaskClient): ) +def test_arrivals_page_validation(stac_client: FlaskClient): + # Does the virtual 'arrivals' catalog validate? + # (this is actually not tested in the above root-catalog, surprisingly, as it has no expected dataset count.) + arrivals_collection = get_json(stac_client, "/stac/arrivals") + _CATALOG_SCHEMA.validate(arrivals_collection) + + [items_page_url] = [ + i["href"] for i in arrivals_collection["links"] if i["rel"] == "items" + ] + + # Get and validate items. + response = get_items(stac_client, items_page_url) + # Sanity check. + assert len(response["features"]) == OUR_PAGE_SIZE + + def test_stac_collection_items(stac_client: FlaskClient): """ Follow the links to the "high_tide_comp_20p" collection and ensure it includes