diff --git a/integration_tests/test_wcs_server.py b/integration_tests/test_wcs_server.py index c09b10c92..f6278f05d 100644 --- a/integration_tests/test_wcs_server.py +++ b/integration_tests/test_wcs_server.py @@ -4,7 +4,6 @@ from owslib.util import ServiceException from urllib import request from lxml import etree -from imghdr import what import requests def get_xsd(name): diff --git a/integration_tests/test_wms_server.py b/integration_tests/test_wms_server.py index c7c9b7167..6466c46c5 100644 --- a/integration_tests/test_wms_server.py +++ b/integration_tests/test_wms_server.py @@ -2,7 +2,6 @@ from owslib.wms import WebMapService from urllib import request from lxml import etree -from imghdr import what import requests def get_xsd(name): @@ -117,7 +116,7 @@ def test_wms_getmap(ows_server): time=test_layer.timepositions[len(test_layer.timepositions) // 2].strip(), ) assert img - assert what("", h=img.read()) == "png" + assert img.info()['Content-Type'] == 'image/png' img = wms.getmap(layers=[test_layer_name], styles=[], @@ -129,7 +128,7 @@ def test_wms_getmap(ows_server): time=test_layer.timepositions[len(test_layer.timepositions) // 2].strip(), ) assert img - assert what("", h=img.read()) == "png" + assert img.info()['Content-Type'] == 'image/png' def test_wms_getfeatureinfo(ows_server): diff --git a/integration_tests/test_wmts_server.py b/integration_tests/test_wmts_server.py index 1b504f005..54d764769 100644 --- a/integration_tests/test_wmts_server.py +++ b/integration_tests/test_wmts_server.py @@ -3,7 +3,6 @@ from owslib.util import ServiceException from urllib import request from lxml import etree -from imghdr import what def get_xsd(name): # since this function is only being called by getcapabilities set to wmts/1.0.0 @@ -45,7 +44,7 @@ def test_getcap_badsvc(ows_server): @pytest.mark.xfail(reason="OWS Getcaps don't pass XSD") -def test_getcap(ows_server): +def test_wmts_getcap(ows_server): resp = request.urlopen(ows_server.url + "/wmts?request=GetCapabilities&service=WMTS&version=1.0.0", timeout=10) # Confirm success @@ -57,6 +56,17 @@ def test_getcap(ows_server): assert gc_xds.validate(resp_xml) +def test_wmts_getcap_section(ows_server): + section_options = ['all', 'serviceidentification', 'serviceprovider', 'operationsmetadata', 'contents', 'themes'] + for section in section_options: + resp = request.urlopen(ows_server.url + "/wmts?request=GetCapabilities&service=WMTS&version=1.0.0§ion={}".format( + section + ), timeout=10) + + # Confirm success + assert resp.code == 200 + + def test_wmts_server(ows_server): # Use owslib to confirm that we have a somewhat compliant WCS service wmts = WebMapTileService(url=ows_server.url+"/wmts") @@ -84,8 +94,7 @@ def test_wmts_gettile(ows_server): ) assert tile - assert what("", h=tile.read()) == "png" - + assert tile.info()['Content-Type'] == 'image/png' def test_wmts_gettile_exception(ows_server): wmts = WebMapTileService(url=ows_server.url+"/wmts")