def test_wms_capabilities(self, app): req = WMS130CapabilitiesRequest(url="/service?") resp = app.get(req) assert resp.content_type == "text/xml" print(resp.body) xml = resp.lxml assert is_inpire_vs_capa(xml) ext_cap = xpath_130( xml, "/wms:WMS_Capabilities/wms:Capability/iv:ExtendedCapabilities") assert len(ext_cap) == 1, ext_cap ext_cap = ext_cap[0] assert_xpath_wms130( ext_cap, "./ic:ResourceLocator/ic:URL/text()", u"http://example.org/metadata", ) assert_xpath_wms130( ext_cap, "./ic:ResourceLocator/ic:MediaType/text()", u"application/vnd.iso.19139+xml", ) assert_xpath_wms130( ext_cap, "./ic:Keyword/ic:OriginatingControlledVocabulary/ic:Title/text()", u"GEMET - INSPIRE themes", ) assert_xpath_wms130( ext_cap, "./ic:SupportedLanguages/ic:DefaultLanguage/ic:Language/text()", u"eng", ) assert_xpath_wms130(ext_cap, "./ic:ResponseLanguage/ic:Language/text()", u"eng") # check dates from string and datetime assert_xpath_wms130(ext_cap, "./ic:TemporalReference/ic:DateOfCreation/text()", u"2015-05-01") assert_xpath_wms130(ext_cap, "./ic:MetadataDate/text()", u"2015-07-23") # test for extended layer metadata assert_xpath_wms130( xml, "/wms:WMS_Capabilities/wms:Capability/wms:Layer/wms:Attribution/wms:Title/text()", u"My attribution title", ) layer_names = set( xml.xpath("//wms:Layer/wms:Name/text()", namespaces=ns130)) expected_names = set(["inspire_example"]) assert layer_names == expected_names
def test_capabilities_130(self): req = WMS130CapabilitiesRequest(url='/service?').copy_with_request_params(self.common_req) resp = self.app.get(req) xml = resp.lxml eq_(xml.xpath('//wms:Request/sld:GetLegendGraphic', namespaces=ns130)[0].tag, '{%s}GetLegendGraphic'%(ns130['sld'])) layer_urls = xml.xpath('//Layer/Style/LegendURL/OnlineResource/@xlink:href', namespaces=ns130) for layer_url in layer_urls: assert layer_url.startswith('http://') assert 'GetLegendGraphic' in layer_url assert is_130_capa(xml)
def test_wms_capabilities(self): req = WMS130CapabilitiesRequest(url='/service?') resp = self.app.get(req) eq_(resp.content_type, 'text/xml') print(resp.body) xml = resp.lxml assert is_inpire_vs_capa(xml) ext_cap = xpath_130( xml, '/wms:WMS_Capabilities/wms:Capability/iv:ExtendedCapabilities') assert len(ext_cap) == 1, ext_cap ext_cap = ext_cap[0] eq_xpath_wms130(ext_cap, './ic:ResourceLocator/ic:URL/text()', u'http://example.org/metadata') eq_xpath_wms130(ext_cap, './ic:ResourceLocator/ic:MediaType/text()', u'application/vnd.iso.19139+xml') eq_xpath_wms130( ext_cap, './ic:Keyword/ic:OriginatingControlledVocabulary/ic:Title/text()', u'GEMET - INSPIRE themes') eq_xpath_wms130( ext_cap, './ic:SupportedLanguages/ic:DefaultLanguage/ic:Language/text()', u'eng') eq_xpath_wms130(ext_cap, './ic:ResponseLanguage/ic:Language/text()', u'eng') # check dates from string and datetime eq_xpath_wms130(ext_cap, './ic:TemporalReference/ic:DateOfCreation/text()', u'2015-05-01') eq_xpath_wms130(ext_cap, './ic:MetadataDate/text()', u'2015-07-23') # test for extended layer metadata eq_xpath_wms130( xml, '/wms:WMS_Capabilities/wms:Capability/wms:Layer/wms:Attribution/wms:Title/text()', u'My attribution title') layer_names = set( xml.xpath('//wms:Layer/wms:Name/text()', namespaces=ns130)) expected_names = set(['inspire_example']) eq_(layer_names, expected_names)
def test_capabilities_130(self, app): req = WMS130CapabilitiesRequest( url="/service?").copy_with_request_params(self.common_req) resp = app.get(req) xml = resp.lxml assert xml.xpath( "//wms:Request/sld:GetLegendGraphic", namespaces=ns130)[0].tag == "{%s}GetLegendGraphic" % (ns130["sld"]) layer_urls = xml.xpath( "//Layer/Style/LegendURL/OnlineResource/@xlink:href", namespaces=ns130) for layer_url in layer_urls: assert layer_url.startswith("http://") assert "GetLegendGraphic" in layer_url assert is_130_capa(xml)
def test_wms_capabilities(self, app): req = WMS130CapabilitiesRequest(url="/service?") resp = app.get(req) assert resp.content_type == "text/xml" print(resp.body) xml = resp.lxml assert is_inpire_vs_capa(xml) ext_cap = xpath_130( xml, "/wms:WMS_Capabilities/wms:Capability/iv:ExtendedCapabilities") assert len(ext_cap) == 1, ext_cap ext_cap = ext_cap[0] assert_xpath_wms130(ext_cap, "./ic:MetadataUrl/ic:URL/text()", u"http://example.org/metadata") assert_xpath_wms130( ext_cap, "./ic:MetadataUrl/ic:MediaType/text()", u"application/vnd.iso.19139+xml", ) assert_xpath_wms130( ext_cap, "./ic:SupportedLanguages/ic:DefaultLanguage/ic:Language/text()", u"eng", ) assert_xpath_wms130(ext_cap, "./ic:ResponseLanguage/ic:Language/text()", u"eng") # test for extended layer metadata assert_xpath_wms130( xml, "/wms:WMS_Capabilities/wms:Capability/wms:Layer/wms:Attribution/wms:Title/text()", u"My attribution title", ) layer_names = set( xml.xpath("//wms:Layer/wms:Name/text()", namespaces=ns130)) expected_names = set(["inspire_example"]) assert layer_names == expected_names
def test_capabilities_130(self): req = WMS130CapabilitiesRequest( url='/service?').copy_with_request_params(self.common_req) resp = self.app.get(req) xml = resp.lxml assert is_130_capa(xml) min_scales = xml.xpath( '//wms:Layer/wms:Layer/wms:MinScaleDenominator/text()', namespaces=ns130) max_scales = xml.xpath( '//wms:Layer/wms:Layer/wms:MaxScaleDenominator/text()', namespaces=ns130) assert_almost_equal(float(min_scales[0]), 35714.28, 1) assert_almost_equal(float(max_scales[0]), 35714285.7, 1) assert_almost_equal(float(min_scales[1]), 10000, 2) assert_almost_equal(float(max_scales[1]), 1000000, 2) assert_almost_equal(float(min_scales[2]), 1000, 2) assert_almost_equal(float(max_scales[2]), 10000, 2)
def test_capabilities_130(self, app): req = WMS130CapabilitiesRequest(url="/service?").copy_with_request_params( self.common_req ) resp = app.get(req) xml = resp.lxml assert is_130_capa(xml) min_scales = xml.xpath( "//wms:Layer/wms:Layer/wms:MinScaleDenominator/text()", namespaces=ns130 ) max_scales = xml.xpath( "//wms:Layer/wms:Layer/wms:MaxScaleDenominator/text()", namespaces=ns130 ) assert float(min_scales[0]) == pytest.approx(35714.28) assert float(max_scales[0]) == pytest.approx(35714285.7) assert float(min_scales[1]) == pytest.approx(10000) assert float(max_scales[1]) == pytest.approx(1000000) assert float(min_scales[2]) == pytest.approx(1000) assert float(max_scales[2]) == pytest.approx(10000)
def test_wms_capabilities(self): req = WMS130CapabilitiesRequest(url='/service?') resp = self.app.get(req) eq_(resp.content_type, 'text/xml') print(resp.body) xml = resp.lxml assert is_inpire_vs_capa(xml) ext_cap = xpath_130( xml, '/wms:WMS_Capabilities/wms:Capability/iv:ExtendedCapabilities') assert len(ext_cap) == 1, ext_cap ext_cap = ext_cap[0] eq_xpath_wms130(ext_cap, './ic:MetadataUrl/ic:URL/text()', u'http://example.org/metadata') eq_xpath_wms130(ext_cap, './ic:MetadataUrl/ic:MediaType/text()', u'application/vnd.iso.19139+xml') eq_xpath_wms130( ext_cap, './ic:SupportedLanguages/ic:DefaultLanguage/ic:Language/text()', u'eng') eq_xpath_wms130(ext_cap, './ic:ResponseLanguage/ic:Language/text()', u'eng') # test for extended layer metadata eq_xpath_wms130( xml, '/wms:WMS_Capabilities/wms:Capability/wms:Layer/wms:Attribution/wms:Title/text()', u'My attribution title') layer_names = set( xml.xpath('//wms:Layer/wms:Name/text()', namespaces=ns130)) expected_names = set(['inspire_example']) eq_(layer_names, expected_names)