diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8ec8b9f4..bd91f88e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,12 +9,11 @@ on: [ push, pull_request ] jobs: main: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 strategy: matrix: include: - - python-version: 3.7 - # - python-version: 3.8 + - python-version: 3.10.12 steps: - name: Checkout ✅ uses: actions/checkout@v2 @@ -27,7 +26,6 @@ jobs: - name: Install Requirements 📦 run: | python -m pip install --upgrade pip - pip install wheel pip install -r requirements.txt pip install -r requirements-dev.txt diff --git a/.readthedocs.yaml b/.readthedocs.yaml index ab2923ef..010baf4b 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -20,3 +20,6 @@ sphinx: python: install: - requirements: docs/requirements.txt + +formats: + - pdf diff --git a/GeoHealthCheck/plugins/probe/wfs.py b/GeoHealthCheck/plugins/probe/wfs.py index bdb3b120..feaa3b37 100644 --- a/GeoHealthCheck/plugins/probe/wfs.py +++ b/GeoHealthCheck/plugins/probe/wfs.py @@ -27,7 +27,7 @@ class WfsGetFeatureBbox(Probe): xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - @@ -77,6 +77,14 @@ class WfsGetFeatureBbox(Probe): 'required': True, 'range': None }, + 'max_count': { + 'type': 'string', + 'description': 'Maximum amount of features to select', + 'default': '5', + 'value': '5', + 'required': True, + 'range': None + }, 'bbox': { 'type': 'bbox', 'description': 'The tile image extension', diff --git a/pavement.py b/pavement.py index 4b048aa8..d4cd1e4f 100644 --- a/pavement.py +++ b/pavement.py @@ -123,7 +123,8 @@ def setup(): # install leafletjs to static/lib info('Getting leaflet') - leafletjs = 'http://cdn.leafletjs.com/downloads/leaflet-0.7.5.zip' + leaflet_cdn_url = 'https://leafletjs-cdn.s3.amazonaws.com/content/leaflet' + leafletjs = '{}/v1.9.4/leaflet.zip'.format(leaflet_cdn_url) zipstr = BytesIO(urlopen(leafletjs).read()) zipfile_obj = zipfile.ZipFile(zipstr) diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 00000000..8bae8bc7 --- /dev/null +++ b/tests/README.md @@ -0,0 +1,12 @@ +# Unit Tests + +Unit tests are run with the built-in Python module `unittest`. + +Fastest way to run, best in a Virtual Environment: + +`python3 run_tests.py` + +Or using the Docker Image: + +`docker run --entrypoint "/run-tests.sh" geopython/geohealthcheck:latest` + diff --git a/tests/data/fixtures.json b/tests/data/fixtures.json index 299af403..201f2bc1 100644 --- a/tests/data/fixtures.json +++ b/tests/data/fixtures.json @@ -26,12 +26,12 @@ "pdok" ] }, - "WOUDC WFS": { + "RCE WFS": { "owner": "admin", "resource_type": "OGC:WFS", "active": true, - "title": "WOUDC Web Feature Service", - "url": "http://geo.woudc.org/ows", + "title": "RCE - Rijksdienst Cultureel Erfgoed WFS", + "url": "https://services.rce.geovoorziening.nl/landschapsatlas/wfs", "tags": [ "ows" ] @@ -47,45 +47,33 @@ "pdok" ] }, - "WOUDC CSW": { + "PDOK CSW": { "owner": "admin", "resource_type": "OGC:CSW", "active": true, - "title": "WOUDC Catalogue Service", - "url": "http://geo.woudc.org/csw", + "title": "PDOK Catalogue Service", + "url": "https://nationaalgeoregister.nl/geonetwork/srv/dut/csw", "tags": [ "ows" ] }, - "PDOK CP WMTS": { + "PDOK BRK WMTS": { "owner": "admin", "resource_type": "OGC:WMTS", "active": true, - "title": "Dutch Kadaster PDOK BRT WMTS", + "title": "Dutch Kadaster PDOK BRK WMTS", "url": "https://service.pdok.nl/kadaster/kadastralekaart/wmts/v5_0", "tags": [ "ows", "tiling" ] }, - "PDOK BRT WMTS": { - "owner": "admin", - "resource_type": "OGC:WMTS", - "active": true, - "title": "Dutch PDOK Luchtfoto WMTS", - "url": "https://service.pdok.nl/brt/achtergrondkaart/wmts/v2_0", - "tags": [ - "ows", - "tiling", - "pdok" - ] - }, "WOUDC LINK": { "owner": "admin", "resource_type": "WWW:LINK", "active": true, - "title": "WOUDC Definitions Service", - "url": "http://geo.woudc.org/def", + "title": "WOUDC Landing Page", + "url": "https://api.woudc.org/", "tags": [] }, "OPENGEOGROEP TMS": { @@ -162,8 +150,8 @@ "drilldown_level": "minor" } }, - "WOUDC WFS - GetCaps": { - "resource": "WOUDC WFS", + "RCE WFS - GetCaps": { + "resource": "RCE WFS", "probe_class": "GeoHealthCheck.plugins.probe.owsgetcaps.WfsGetCaps", "parameters": { "service": "WFS", @@ -178,6 +166,7 @@ "type_ns_prefix": "bag", "type_ns_uri": "http://bag.geonovum.nl", "srs": "EPSG:28992", + "max_count": "1", "bbox": ["180635", "455870", "180961", "456050"] } }, @@ -189,27 +178,28 @@ "type_ns_prefix": "bag", "type_ns_uri": "http://bag.geonovum.nl", "srs": "EPSG:28992", + "max_count": "1", "bbox": ["180635", "455870", "180961", "456050"] } }, - "WOUDC CSW - GetCaps": { - "resource": "WOUDC CSW", + "PDOK CSW - GetCaps": { + "resource": "PDOK CSW", "probe_class": "GeoHealthCheck.plugins.probe.owsgetcaps.CswGetCaps", "parameters": { "service": "CSW", "version": "2.0.2" } }, - "PDOK CP WMTS - GetCaps": { - "resource": "PDOK CP WMTS", + "PDOK BRK WMTS - GetCaps": { + "resource": "PDOK BRK WMTS", "probe_class": "GeoHealthCheck.plugins.probe.owsgetcaps.WmtsGetCaps", "parameters": { "service": "WMTS", "version": "1.0.0" } }, - "PDOK CP WMTS - GetTileREST": { - "resource": "PDOK CP WMTS", + "PDOK BRK WMTS - GetTileREST": { + "resource": "PDOK BRK WMTS", "probe_class": "GeoHealthCheck.plugins.probe.wmts.WmtsGetTile", "parameters": { "layers": ["Kadastralekaart"], @@ -223,8 +213,8 @@ "kvprest": "REST" } }, - "PDOK CP WMTS - GetTileKVP": { - "resource": "PDOK CP WMTS", + "PDOK BRK WMTS - GetTileKVP": { + "resource": "PDOK BRK WMTS", "probe_class": "GeoHealthCheck.plugins.probe.wmts.WmtsGetTile", "parameters": { "layers": ["Kadastralekaart"], @@ -238,8 +228,8 @@ "kvprest": "KVP" } }, - "PDOK BRT WMTS - GetTileAllKVP": { - "resource": "PDOK BRT WMTS", + "PDOK BRK WMTS - GetTileAllKVP": { + "resource": "PDOK BRK WMTS", "probe_class": "GeoHealthCheck.plugins.probe.wmts.WmtsGetTileAll", "parameters": { "layers": ["All layers"], @@ -310,8 +300,8 @@ "check_class": "GeoHealthCheck.plugins.check.checks.HttpHasImageContentType", "parameters": {} }, - "WOUDC WFS - GetCaps - XML Parse": { - "probe_vars": "WOUDC WFS - GetCaps", + "RCE WFS - GetCaps - XML Parse": { + "probe_vars": "RCE WFS - GetCaps", "check_class": "GeoHealthCheck.plugins.check.checks.XmlParse", "parameters": {} }, @@ -353,13 +343,13 @@ "strings": ["FeatureCollection"] } }, - "WOUDC CSW - GetCaps - XML Parse": { - "probe_vars": "WOUDC CSW - GetCaps", + "PDOK CSW - GetCaps - XML Parse": { + "probe_vars": "PDOK CSW - GetCaps", "check_class": "GeoHealthCheck.plugins.check.checks.XmlParse", "parameters": {} }, - "PDOK CP WMTS - GetCaps - XML Parse": { - "probe_vars": "PDOK CP WMTS - GetCaps", + "PDOK BRK WMTS - GetCaps - XML Parse": { + "probe_vars": "PDOK BRK WMTS - GetCaps", "check_class": "GeoHealthCheck.plugins.check.checks.XmlParse", "parameters": {} }, @@ -372,7 +362,7 @@ "probe_vars": "WOUDC LINK - PING", "check_class": "GeoHealthCheck.plugins.check.checks.ContainsStrings", "parameters": { - "strings": ["RDF>"] + "strings": ["Ozone"] } }, "OPENGEOGROEP TMS - HTTP - NoError": { @@ -397,33 +387,33 @@ "check_class": "GeoHealthCheck.plugins.check.checks.HttpHasImageContentType", "parameters": {} }, - "PDOK CP WMTS - GetTileREST - No Exception": { - "probe_vars": "PDOK CP WMTS - GetTileREST", + "PDOK BRK WMTS - GetTileREST - No Exception": { + "probe_vars": "PDOK BRK WMTS - GetTileREST", "check_class": "GeoHealthCheck.plugins.check.checks.NotContainsOwsException", "parameters": {"strings": ["ExceptionReport>", "ServiceException>"]} }, - "PDOK CP WMTS - GetTileREST - Content Type": { - "probe_vars": "PDOK CP WMTS - GetTileREST", + "PDOK BRK WMTS - GetTileREST - Content Type": { + "probe_vars": "PDOK BRK WMTS - GetTileREST", "check_class": "GeoHealthCheck.plugins.check.checks.HttpHasImageContentType", "parameters": {} }, - "PDOK CP WMTS - GetTileKVP - No Exception": { - "probe_vars": "PDOK CP WMTS - GetTileKVP", + "PDOK BRK WMTS - GetTileKVP - No Exception": { + "probe_vars": "PDOK BRK WMTS - GetTileKVP", "check_class": "GeoHealthCheck.plugins.check.checks.NotContainsOwsException", "parameters": {"strings": ["ExceptionReport>", "ServiceException>"]} }, - "PDOK CP WMTS - GetTileKVP - Content Type": { - "probe_vars": "PDOK CP WMTS - GetTileKVP", + "PDOK BRK WMTS - GetTileKVP - Content Type": { + "probe_vars": "PDOK BRK WMTS - GetTileKVP", "check_class": "GeoHealthCheck.plugins.check.checks.HttpHasImageContentType", "parameters": {} }, - "PDOK BRT WMTS - GetTileAllKVP - No Exception": { - "probe_vars": "PDOK BRT WMTS - GetTileAllKVP", + "PDOK BRK WMTS - GetTileAllKVP - No Exception": { + "probe_vars": "PDOK BRK WMTS - GetTileAllKVP", "check_class": "GeoHealthCheck.plugins.check.checks.NotContainsOwsException", "parameters": {"strings": ["ExceptionReport>", "ServiceException>"]} }, - "PDOK BRT WMTS - GetTileAllKVP - Content Type": { - "probe_vars": "PDOK BRT WMTS - GetTileAllKVP", + "PDOK BRK WMTS - GetTileAllKVP - Content Type": { + "probe_vars": "PDOK BRK WMTS - GetTileAllKVP", "check_class": "GeoHealthCheck.plugins.check.checks.HttpHasImageContentType", "parameters": {} } diff --git a/tests/data/resources.json b/tests/data/resources.json deleted file mode 100644 index c893ee00..00000000 --- a/tests/data/resources.json +++ /dev/null @@ -1,356 +0,0 @@ -{ - "users": { - "admin": { - "username": "admin", - "password": "admin", - "email": "foo@example.com", - "role": "admin" - } - }, - "tags": { - "ows": "ows", - "tiling": "tiling", - "pdok": "pdok" - }, - "resources": { - "PDOK AHN WCS": { - "owner": "admin", - "resource_type": "OGC:WCS", - "active": true, - "title": "PDOK AHN Web Coverage Service", - "url": "https://service.pdok.nl/rws/ahn/wcs/v1_0", - "tags": [ - "ows", - "pdok" - ] - }, - "PDOK BAG WMS": { - "owner": "admin", - "resource_type": "OGC:WMS", - "active": true, - "title": "PDOK BAG Web Map Service", - "url": "https://service.pdok.nl/lv/bag/wms/v2_0", - "tags": [ - "ows", - "pdok" - ] - }, - "PDOK BAG WMS2": { - "owner": "admin", - "resource_type": "OGC:WMS", - "active": true, - "title": "PDOK BAG Web Map Service", - "url": "https://service.pdok.nl/lv/bag/wms/v2_0", - "tags": [ - "ows", - "pdok" - ] - }, - "WOUDC WFS": { - "owner": "admin", - "resource_type": "OGC:WFS", - "active": true, - "title": "WOUDC Web Feature Service", - "url": "http://geo.woudc.org/ows", - "tags": [ - "ows" - ] - }, - "PDOK BAG WFS": { - "owner": "admin", - "resource_type": "OGC:WFS", - "active": true, - "title": "PDOK BAG Web Feature Service", - "url": "https://service.pdok.nl/lv/bag/wfs/v2_0", - "tags": [ - "ows", - "pdok" - ] - }, - "WOUDC CSW": { - "owner": "admin", - "resource_type": "OGC:CSW", - "active": true, - "title": "WOUDC Catalogue Service", - "url": "http://geo.woudc.org/csw", - "tags": [ - "ows" - ] - }, - "WOUDC WMTS": { - "owner": "admin", - "resource_type": "OGC:WMTS", - "active": true, - "title": "NASA Global Imagery Browse Services for EOSDIS", - "url": "https://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi", - "tags": [ - "ows", - "tiling" - ] - }, - "WOUDC LINK": { - "owner": "admin", - "resource_type": "WWW:LINK", - "active": true, - "title": "WOUDC Definitions Service", - "url": "http://geo.woudc.org/def", - "tags": [] - }, - "OPENGEOGROEP TMS": { - "owner": "admin", - "resource_type": "OSGeo:TMS", - "active": true, - "title": "Tile Map Service", - "url": "https://www.openbasiskaart.nl/mapcache/tms/1.0.0/", - "tags": [ - "tiling" - ] - } - }, - "probe_vars": { - "PDOK AHN WCS - GetCaps": { - "resource": "PDOK AHN WCS", - "probe_class": "GeoHealthCheck.plugins.probe.owsgetcaps.WcsGetCaps", - "parameters": { - "service": "WCS", - "version": "2.0.1" - } - }, - "PDOK AHN WCS - GetCoverage v2.0.1": { - "resource": "PDOK AHN WCS", - "probe_class": "GeoHealthCheck.plugins.probe.wcs.WcsGetCoverage", - "parameters": { - "layers": ["dsm_05m"], - "format": "image/png", - "subset": ["10000", "300000", "280000", "619700"], - "subsetting_crs": "http://www.opengis.net/def/crs/EPSG/0/28992", - "height": "256", - "width": "256", - "exceptions": "application/vnd.ogc.se_xml" - } - }, - "PDOK BAG WMS - GetCaps": { - "resource": "PDOK BAG WMS", - "probe_class": "GeoHealthCheck.plugins.probe.owsgetcaps.WmsGetCaps", - "parameters": { - "service": "WMS", - "version": "1.0.0" - } - }, - "PDOK BAG WMS - GetMap Single": { - "resource": "PDOK BAG WMS", - "probe_class": "GeoHealthCheck.plugins.probe.wms.WmsGetMapV1", - "parameters": { - "layers": ["ligplaats"], - "styles": "", - "format": "image/png", - "height": "256", - "srs": "EPSG:28992", - "bbox": ["180635", "455870", "180961", "456050"], - "exceptions": "application/vnd.ogc.se_xml", "width": "256" - } - }, - "PDOK BAG WMS - GetMap All": { - "resource": "PDOK BAG WMS", - "probe_class": "GeoHealthCheck.plugins.probe.wms.WmsGetMapV1All", - "parameters": { - "layers": ["*"], - "styles": "", - "format": "image/png", - "width": "256", - "height": "256", - "srs": "EPSG:28992", - "bbox": ["180635", "455870", "180961", "456050"], - "exceptions": "application/vnd.ogc.se_xml" - } - }, - "PDOK BAG WMS - Drilldown": { - "resource": "PDOK BAG WMS", - "probe_class": "GeoHealthCheck.plugins.probe.wmsdrilldown.WmsDrilldown", - "parameters": { - "drilldown_level": "minor" - } - }, - "WOUDC WFS - GetCaps": { - "resource": "WOUDC WFS", - "probe_class": "GeoHealthCheck.plugins.probe.owsgetcaps.WfsGetCaps", - "parameters": { - "service": "WFS", - "version": "1.1.0" - } - }, - "PDOK BAG WFS - GetFeature": { - "resource": "PDOK BAG WFS", - "probe_class": "GeoHealthCheck.plugins.probe.wfs.WfsGetFeatureBbox", - "parameters": { - "type_name": "bag:verblijfsobject", - "type_ns_prefix": "bag", - "type_ns_uri": "http://bag.geonovum.nl", - "srs": "EPSG:28992", - "bbox": ["180635", "455870", "180961", "456050"] - } - }, - "PDOK BAG WFS - GetFeature All": { - "resource": "PDOK BAG WFS", - "probe_class": "GeoHealthCheck.plugins.probe.wfs.WfsGetFeatureBboxAll", - "parameters": { - "type_name": "all 5 featuretypes", - "type_ns_prefix": "bag", - "type_ns_uri": "http://bag.geonovum.nl", - "srs": "EPSG:28992", - "bbox": ["180635", "455870", "180961", "456050"] - } - }, - "WOUDC CSW - GetCaps": { - "resource": "WOUDC CSW", - "probe_class": "GeoHealthCheck.plugins.probe.owsgetcaps.CswGetCaps", - "parameters": { - "service": "CSW", - "version": "2.0.2" - } - }, - "WOUDC WMTS - GetCaps": { - "resource": "WOUDC WMTS", - "probe_class": "GeoHealthCheck.plugins.probe.owsgetcaps.WmtsGetCaps", - "parameters": { - "service": "WMTS", - "version": "1.0.0" - } - }, - "WOUDC LINK - PING": { - "resource": "WOUDC LINK", - "probe_class": "GeoHealthCheck.plugins.probe.http.HttpGet", - "parameters": {} - }, - "OPENGEOGROEP TMS - PING": { - "resource": "OPENGEOGROEP TMS", - "probe_class": "GeoHealthCheck.plugins.probe.http.HttpGet", - "parameters": {} - }, - "OPENGEOGROEP TMS - Caps": { - "resource": "OPENGEOGROEP TMS", - "probe_class": "GeoHealthCheck.plugins.probe.tms.TmsCaps", - "parameters": {} - }, - "OPENGEOGROEP TMS - TopTile": { - "resource": "OPENGEOGROEP TMS", - "probe_class": "GeoHealthCheck.plugins.probe.tms.TmsGetTile", - "parameters": { - "layer": "osm@rd", - "zoom": "0", - "x": "0", - "y": "0", - "extension" : "png" - } - } - }, - "check_vars": { - "PDOK BAG WMS - GetCaps - No HTTP Error": { - "probe_vars": "PDOK BAG WMS - GetCaps", - "check_class": "GeoHealthCheck.plugins.check.checks.HttpStatusNoError", - "parameters": {} - }, - "PDOK BAG WMS - GetCaps - XML Parse": { - "probe_vars": "PDOK BAG WMS - GetCaps", - "check_class": "GeoHealthCheck.plugins.check.checks.XmlParse", - "parameters": {} - }, - "PDOK BAG WMS - GetMap Single - Has Image": { - "probe_vars": "PDOK BAG WMS - GetMap Single", - "check_class": "GeoHealthCheck.plugins.check.checks.HttpHasImageContentType", - "parameters": {} - }, - "PDOK BAG WMS - GetMap All - Has Image": { - "probe_vars": "PDOK BAG WMS - GetMap All", - "check_class": "GeoHealthCheck.plugins.check.checks.HttpHasImageContentType", - "parameters": {} - }, - "WOUDC WFS - GetCaps - XML Parse": { - "probe_vars": "WOUDC WFS - GetCaps", - "check_class": "GeoHealthCheck.plugins.check.checks.XmlParse", - "parameters": {} - }, - "PDOK BAG WFS - GetFeature - XML Parse": { - "probe_vars": "PDOK BAG WFS - GetFeature", - "check_class": "GeoHealthCheck.plugins.check.checks.XmlParse", - "parameters": {} - }, - "PDOK BAG WFS - GetFeature - No Exception": { - "probe_vars": "PDOK BAG WFS - GetFeature", - "check_class": "GeoHealthCheck.plugins.check.checks.NotContainsOwsException", - "parameters": { - "strings": ["ExceptionReport>", "ServiceException>"] - } - }, - "PDOK BAG WFS - GetFeature - FeatureCollection": { - "probe_vars": "PDOK BAG WFS - GetFeature", - "check_class": "GeoHealthCheck.plugins.check.checks.ContainsStrings", - "parameters": { - "strings": ["FeatureCollection"] - } - }, - "PDOK BAG WFS - GetFeature All - XML Parse": { - "probe_vars": "PDOK BAG WFS - GetFeature All", - "check_class": "GeoHealthCheck.plugins.check.checks.XmlParse", - "parameters": {} - }, - "PDOK BAG WFS - GetFeature All - No Exception": { - "probe_vars": "PDOK BAG WFS - GetFeature All", - "check_class": "GeoHealthCheck.plugins.check.checks.NotContainsOwsException", - "parameters": { - "strings": ["ExceptionReport>", "ServiceException>"] - } - }, - "PDOK BAG WFS - GetFeature All - FeatureCollection": { - "probe_vars": "PDOK BAG WFS - GetFeature All", - "check_class": "GeoHealthCheck.plugins.check.checks.ContainsStrings", - "parameters": { - "strings": ["FeatureCollection"] - } - }, - "WOUDC CSW - GetCaps - XML Parse": { - "probe_vars": "WOUDC CSW - GetCaps", - "check_class": "GeoHealthCheck.plugins.check.checks.XmlParse", - "parameters": {} - }, - "WOUDC WMTS - GetCaps - XML Parse": { - "probe_vars": "WOUDC WMTS - GetCaps", - "check_class": "GeoHealthCheck.plugins.check.checks.XmlParse", - "parameters": {} - }, - "WOUDC LINK - HTTP - NoError": { - "probe_vars": "WOUDC LINK - PING", - "check_class": "GeoHealthCheck.plugins.check.checks.HttpStatusNoError", - "parameters": {} - }, - "WOUDC LINK - HTTP - ContainsStrings": { - "probe_vars": "WOUDC LINK - PING", - "check_class": "GeoHealthCheck.plugins.check.checks.ContainsStrings", - "parameters": { - "strings": ["RDF>"] - } - }, - "OpenGoeGroep TMS - HTTP - NoError": { - "probe_vars": "OPENGEOGROEP TMS - PING", - "check_class": "GeoHealthCheck.plugins.check.checks.HttpStatusNoError", - "parameters": {} - }, - "OPENGEOGROEP TMS - Caps - XML Parse": { - "probe_vars": "OPENGEOGROEP TMS - Caps", - "check_class": "GeoHealthCheck.plugins.check.checks.XmlParse", - "parameters": {} - }, - "OPENGEOGROEP TMS - Caps - TileMap": { - "probe_vars": "OPENGEOGROEP TMS - Caps", - "check_class": "GeoHealthCheck.plugins.check.checks.ContainsStrings", - "parameters": { - "strings": ["