def test_capabilities_111(self): req = WMS111CapabilitiesRequest(url='/service?').copy_with_request_params(self.common_req) resp = self.app.get(req) xml = resp.lxml eq_(xml.xpath('//Request/GetLegendGraphic')[0].tag, 'GetLegendGraphic') legend_sizes = (xml.xpath('//Layer/Style/LegendURL/@width'), xml.xpath('//Layer/Style/LegendURL/@height')) assert legend_sizes == (['256', '256', '256', '256'],['512', '768', '256', '256']) 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_111_capa(xml)
def test_capabilities_111(self): req = WMS111CapabilitiesRequest(url='/service?').copy_with_request_params(self.common_req) resp = self.app.get(req) xml = resp.lxml assert is_111_capa(xml) hints = xml.xpath('//Layer/Layer/ScaleHint') assert_almost_equal(diagonal_res_to_pixel_res(hints[0].attrib['min']), 10, 2) assert_almost_equal(diagonal_res_to_pixel_res(hints[0].attrib['max']), 10000, 2) assert_almost_equal(diagonal_res_to_pixel_res(hints[1].attrib['min']), 2.8, 2) assert_almost_equal(diagonal_res_to_pixel_res(hints[1].attrib['max']), 280, 2) assert_almost_equal(diagonal_res_to_pixel_res(hints[2].attrib['min']), 0.28, 2) assert_almost_equal(diagonal_res_to_pixel_res(hints[2].attrib['max']), 2.8, 2)
def test_capabilities_111(self, app): req = WMS111CapabilitiesRequest(url="/service?").copy_with_request_params( self.common_req ) resp = app.get(req) xml = resp.lxml assert is_111_capa(xml) hints = xml.xpath("//Layer/Layer/ScaleHint") assert diagonal_res_to_pixel_res(hints[0].attrib["min"]) == pytest.approx(10) assert diagonal_res_to_pixel_res(hints[0].attrib["max"]) == pytest.approx(10000) assert diagonal_res_to_pixel_res(hints[1].attrib["min"]) == pytest.approx(2.8) assert diagonal_res_to_pixel_res(hints[1].attrib["max"]) == pytest.approx(280) assert diagonal_res_to_pixel_res(hints[2].attrib["min"]) == pytest.approx(0.28) assert diagonal_res_to_pixel_res(hints[2].attrib["max"]) == pytest.approx(2.8)
def test_capabilities_111(self): req = WMS111CapabilitiesRequest( url='/service?').copy_with_request_params(self.common_req) resp = self.app.get(req) xml = resp.lxml assert is_111_capa(xml) hints = xml.xpath('//Layer/Layer/ScaleHint') assert_almost_equal(diagonal_res_to_pixel_res(hints[0].attrib['min']), 10, 2) assert_almost_equal(diagonal_res_to_pixel_res(hints[0].attrib['max']), 10000, 2) assert_almost_equal(diagonal_res_to_pixel_res(hints[1].attrib['min']), 2.8, 2) assert_almost_equal(diagonal_res_to_pixel_res(hints[1].attrib['max']), 280, 2) assert_almost_equal(diagonal_res_to_pixel_res(hints[2].attrib['min']), 0.28, 2) assert_almost_equal(diagonal_res_to_pixel_res(hints[2].attrib['max']), 2.8, 2)
def test_capabilities_111(self, app): req = WMS111CapabilitiesRequest( url="/service?").copy_with_request_params(self.common_req) resp = app.get(req) xml = resp.lxml assert xml.xpath( "//Request/GetLegendGraphic")[0].tag == "GetLegendGraphic" legend_sizes = ( xml.xpath("//Layer/Style/LegendURL/@width"), xml.xpath("//Layer/Style/LegendURL/@height"), ) assert legend_sizes == ( ["256", "256", "256", "256"], ["512", "768", "256", "256"], ) 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_111_capa(xml)
def test_111_capa(self): resp = self.app.get("/service?request=GetCapabilities&service=WMS&version=1.1.1") xml = resp.lxml assert is_111_capa(xml) self._check_layernames(xml)
def test_111_capa(self): resp = self.app.get( "/service?request=GetCapabilities&service=WMS&version=1.1.1") xml = resp.lxml assert is_111_capa(xml) self._check_layernames(xml)
def test_unknown_version_200(self): resp = self.app.get('http://localhost/service?SERVICE=WMS&REQUEST=GetCapabilities' '&VERSION=2.0.0') assert is_111_capa(resp.lxml)
def test_unsupported_version_130(self): resp = self.app.get('http://localhost/service?SERVICE=WMS&REQUEST=GetCapabilities' '&VERSION=1.3.0') assert is_111_capa(resp.lxml)
def test_unknown_version_200(self, app): resp = app.get( "http://localhost/service?SERVICE=WMS&REQUEST=GetCapabilities" "&VERSION=2.0.0" ) assert is_111_capa(resp.lxml)
def test_default_version_130(self, app): resp = app.get("http://localhost/service?SERVICE=WMS&REQUEST=GetCapabilities") assert is_111_capa(resp.lxml)