当前位置: 首页>>代码示例>>Python>>正文


Python helper.validate_with_xsd函数代码示例

本文整理汇总了Python中mapproxy.test.helper.validate_with_xsd函数的典型用法代码示例。如果您正苦于以下问题:Python validate_with_xsd函数的具体用法?Python validate_with_xsd怎么用?Python validate_with_xsd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了validate_with_xsd函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_capabilities

 def test_capabilities(self):
     req = str(self.common_cap_req)
     resp = self.app.get(req)
     xml = resp.lxml
     assert validate_with_xsd(xml, xsd_name='wmts/1.0/wmtsGetCapabilities_response.xsd')
     eq_(len(xml.xpath('//wmts:Layer', namespaces=ns_wmts)), 4)
     eq_(len(xml.xpath('//wmts:Contents/wmts:TileMatrixSet', namespaces=ns_wmts)), 4)
开发者ID:GeoDodo,项目名称:mapproxy,代码行数:7,代码来源:test_wmts.py

示例2: test_endpoints

 def test_endpoints(self):
     for endpoint in ('service', 'ows'):
         req = WMTS100CapabilitiesRequest(url='/%s?' % endpoint).copy_with_request_params(self.common_cap_req)
         resp = self.app.get(req)
         eq_(resp.content_type, 'application/xml')
         xml = resp.lxml
         assert validate_with_xsd(xml, xsd_name='wmts/1.0/wmtsGetCapabilities_response.xsd')
开发者ID:Geodan,项目名称:mapproxy,代码行数:7,代码来源:test_wmts.py

示例3: test_capabilities

    def test_capabilities(self):
        resp = self.app.get('/wmts/myrest/1.0.0/WMTSCapabilities.xml')
        xml = resp.lxml
        assert validate_with_xsd(xml, xsd_name='wmts/1.0/wmtsGetCapabilities_response.xsd')

        eq_(len(xml.xpath('//wmts:Layer', namespaces=ns_wmts)), 2)
        eq_(len(xml.xpath('//wmts:Contents/wmts:TileMatrixSet', namespaces=ns_wmts)), 1)

        eq_(set(xml.xpath('//wmts:Contents/wmts:Layer/wmts:ResourceURL/@template', namespaces=ns_wmts)),
            set(['http://localhost/wmts/myrest/dimension_layer/{TileMatrixSet}/{Time}/{Elevation}/{TileMatrix}/{TileCol}/{TileRow}.png',
             'http://localhost/wmts/myrest/no_dimension_layer/{TileMatrixSet}/{Time}/{Elevation}/{TileMatrix}/{TileCol}/{TileRow}.png']))

        # check dimension values for dimension_layer
        dimension_elems = xml.xpath(
            '//wmts:Layer/ows:Identifier[text()="dimension_layer"]/following-sibling::wmts:Dimension',
            namespaces=ns_wmts,
        )
        dimensions = {}
        for elem in dimension_elems:
            dim = elem.find('{http://www.opengis.net/ows/1.1}Identifier').text
            default = elem.find('{http://www.opengis.net/wmts/1.0}Default').text
            values = [e.text for e in elem.findall('{http://www.opengis.net/wmts/1.0}Value')]
            dimensions[dim] = (values, default)

        eq_(dimensions['Time'][0],
            ["2012-11-12T00:00:00", "2012-11-13T00:00:00",
             "2012-11-14T00:00:00", "2012-11-15T00:00:00"]
        )
        eq_(dimensions['Time'][1], '2012-11-15T00:00:00')
        eq_(dimensions['Elevation'][1], '0')
        eq_(dimensions['Elevation'][0],
            ["0", "1000", "3000"]
        )
开发者ID:GeoDodo,项目名称:mapproxy,代码行数:33,代码来源:test_wmts_dimensions.py

示例4: test_get_tile_out_of_range

 def test_get_tile_out_of_range(self):
     self.common_tile_req.params.coord = -1, 1, 1
     resp = self.app.get(str(self.common_tile_req), status=400)
     xml = resp.lxml
     eq_(resp.content_type, "text/xml")
     assert validate_with_xsd(xml, xsd_name="ows/1.1.0/owsExceptionReport.xsd")
     eq_xpath_wmts(xml, "/ows:ExceptionReport/ows:Exception/@exceptionCode", "TileOutOfRange")
开发者ID:quiqua,项目名称:mapproxy,代码行数:7,代码来源:test_wmts.py

示例5: test_get_tile_out_of_range

 def test_get_tile_out_of_range(self):
     resp = self.app.get('/wmts/myrest/wms_cache/GLOBAL_MERCATOR/01/-1/0.jpeg', status=400)
     xml = resp.lxml
     eq_(resp.content_type, 'text/xml')
     assert validate_with_xsd(xml, xsd_name='ows/1.1.0/owsExceptionReport.xsd')
     eq_xpath_wmts(xml, '/ows:ExceptionReport/ows:Exception/@exceptionCode',
         'TileOutOfRange')
开发者ID:GeoDodo,项目名称:mapproxy,代码行数:7,代码来源:test_wmts_restful.py

示例6: test_get_kml_nw

    def test_get_kml_nw(self):
        resp = self.app.get('/kml/wms_cache_nw/1/0/0.kml')
        xml = resp.lxml

        assert validate_with_xsd(xml, 'kml/2.2.0/ogckml22.xsd')

        assert bbox_equals(
            self._bbox(xml.xpath('/kml:kml/kml:Document', namespaces=ns)[0]),
            (-180, -90, 0, 0)
        )
        assert bbox_equals(
            self._bbox(xml.xpath('/kml:kml/kml:Document/kml:GroundOverlay', namespaces=ns)[0]),
            (-180, -66.51326, -90, 0)
        )

        eq_(xml.xpath('/kml:kml/kml:Document/kml:GroundOverlay/kml:Icon/kml:href/text()',
                      namespaces=ns),
            ['http://localhost/kml/wms_cache_nw/EPSG900913/2/0/1.jpeg',
             'http://localhost/kml/wms_cache_nw/EPSG900913/2/1/1.jpeg',
             'http://localhost/kml/wms_cache_nw/EPSG900913/2/0/0.jpeg',
             'http://localhost/kml/wms_cache_nw/EPSG900913/2/1/0.jpeg']
        )
        eq_(xml.xpath('/kml:kml/kml:Document/kml:NetworkLink/kml:Link/kml:href/text()',
                      namespaces=ns),
              ['http://localhost/kml/wms_cache_nw/EPSG900913/2/0/1.kml',
               'http://localhost/kml/wms_cache_nw/EPSG900913/2/1/1.kml',
               'http://localhost/kml/wms_cache_nw/EPSG900913/2/0/0.kml',
               'http://localhost/kml/wms_cache_nw/EPSG900913/2/1/0.kml']
        )
开发者ID:Anderson0026,项目名称:mapproxy,代码行数:29,代码来源:test_kml.py

示例7: test_get_tile_source_error

 def test_get_tile_source_error(self):
     self.common_tile_req.params["layer"] = "tms_cache"
     self.common_tile_req.params["format"] = "image/png"
     resp = self.app.get(str(self.common_tile_req), status=500)
     xml = resp.lxml
     assert validate_with_xsd(xml, xsd_name="ows/1.1.0/owsExceptionReport.xsd")
     eq_xpath_wmts(xml, "/ows:ExceptionReport/ows:Exception/@exceptionCode", "NoApplicableCode")
开发者ID:quiqua,项目名称:mapproxy,代码行数:7,代码来源:test_wmts.py

示例8: test_get_kml

 def test_get_kml(self):
     resp = self.app.get('/kml/wms_cache/0/0/0.kml')
     xml = resp.lxml
     assert validate_with_xsd(xml, 'kml/2.2.0/ogckml22.xsd')
     eq_(xml.xpath('/kml:kml/kml:Document/kml:GroundOverlay/kml:Icon/kml:href/text()',
                   namespaces=ns),
         ['http://localhost/kml/wms_cache/EPSG900913/1/0/1.jpeg',
          'http://localhost/kml/wms_cache/EPSG900913/1/1/1.jpeg',
          'http://localhost/kml/wms_cache/EPSG900913/1/0/0.jpeg',
          'http://localhost/kml/wms_cache/EPSG900913/1/1/0.jpeg']
     )
     eq_(xml.xpath('/kml:kml/kml:Document/kml:NetworkLink/kml:Link/kml:href/text()',
                   namespaces=ns),
           ['http://localhost/kml/wms_cache/EPSG900913/1/0/1.kml',
            'http://localhost/kml/wms_cache/EPSG900913/1/1/1.kml',
            'http://localhost/kml/wms_cache/EPSG900913/1/0/0.kml',
            'http://localhost/kml/wms_cache/EPSG900913/1/1/0.kml']
     )
     
     etag = hashlib.md5(resp.body).hexdigest()
     max_age = base_config().tiles.expires_hours * 60 * 60
     self._check_cache_control_headers(resp, etag, max_age, None)
     
     resp = self.app.get('/kml/wms_cache/0/0/0.kml',
                         headers={'If-None-Match': etag})
     eq_(resp.status, '304 Not Modified')
开发者ID:ChrisRenton,项目名称:mapproxy,代码行数:26,代码来源:test_kml.py

示例9: check_invalid_parameter

 def check_invalid_parameter(self):
     resp = self.app.get(str(self.common_tile_req), status=400)
     xml = resp.lxml
     eq_(resp.content_type, 'text/xml')
     assert validate_with_xsd(xml, xsd_name='ows/1.1.0/owsExceptionReport.xsd')
     eq_xpath_wmts(xml, '/ows:ExceptionReport/ows:Exception/@exceptionCode',
         'InvalidParameterValue')
开发者ID:GeoDodo,项目名称:mapproxy,代码行数:7,代码来源:test_wmts.py

示例10: test_get_legendgraphic_invalid_sld_version_130

 def test_get_legendgraphic_invalid_sld_version_130(self):
     req = str(self.common_lg_req_130).replace('sld_version=1.1.0', 'sld_version=1.0.0')
     resp = self.app.get(req)
     eq_(resp.content_type, 'text/xml')
     xml = resp.lxml
     eq_xpath_wms130(xml, '/ogc:ServiceExceptionReport/@version', '1.3.0')
     eq_xpath_wms130(xml, '//ogc:ServiceException/text()', 'invalid sld_version 1.0.0')
     assert validate_with_xsd(xml, xsd_name='wms/1.3.0/exceptions_1_3_0.xsd')
开发者ID:Anderson0026,项目名称:mapproxy,代码行数:8,代码来源:test_legendgraphic.py

示例11: test_get_legendgraphic_no_legend_130

 def test_get_legendgraphic_no_legend_130(self):
     self.common_lg_req_130.params['layer'] = 'wms_no_legend'
     resp = self.app.get(self.common_lg_req_130)
     eq_(resp.content_type, 'text/xml')
     xml = resp.lxml
     eq_xpath_wms130(xml, '/ogc:ServiceExceptionReport/@version', '1.3.0')
     eq_xpath_wms130(xml, '//ogc:ServiceException/text()', 'layer wms_no_legend has no legend graphic')
     assert validate_with_xsd(xml, xsd_name='wms/1.3.0/exceptions_1_3_0.xsd')
开发者ID:Anderson0026,项目名称:mapproxy,代码行数:8,代码来源:test_legendgraphic.py

示例12: test_get_tile_source_error

 def test_get_tile_source_error(self):
     self.common_tile_req.params['layer'] = 'tms_cache'
     self.common_tile_req.params['format'] = 'image/png'
     resp = self.app.get(str(self.common_tile_req), status=500)
     xml = resp.lxml
     assert validate_with_xsd(xml, xsd_name='ows/1.1.0/owsExceptionReport.xsd')
     eq_xpath_wmts(xml, '/ows:ExceptionReport/ows:Exception/@exceptionCode',
         'NoApplicableCode')
开发者ID:GeoDodo,项目名称:mapproxy,代码行数:8,代码来源:test_wmts.py

示例13: test_get_legendgraphic_missing_params_130

 def test_get_legendgraphic_missing_params_130(self):
     req = str(self.common_lg_req_130).replace('format', 'invalid')
     resp = self.app.get(req)
     eq_(resp.content_type, 'text/xml')
     xml = resp.lxml
     eq_xpath_wms130(xml, '/ogc:ServiceExceptionReport/@version', '1.3.0')
     eq_xpath_wms130(xml, '//ogc:ServiceException/text()', "missing parameters ['format']")
     assert validate_with_xsd(xml, xsd_name='wms/1.3.0/exceptions_1_3_0.xsd')
开发者ID:Anderson0026,项目名称:mapproxy,代码行数:8,代码来源:test_legendgraphic.py

示例14: test_wmts_capabilities

    def test_wmts_capabilities(self):
        req = str(self.common_cap_req)
        resp = self.app.get(req)
        eq_(resp.content_type, 'application/xml')
        xml = resp.lxml

        assert validate_with_xsd(
            xml, xsd_name='wmts/1.0/wmtsGetCapabilities_response.xsd')
        eq_(set(xml.xpath('//wmts:Layer/ows:Identifier/text()',
                          namespaces=ns_wmts)), set(['cache', 'multi_cache']))
        eq_(set(xml.xpath('//wmts:Contents/wmts:TileMatrixSet/ows:Identifier/text()',
                          namespaces=ns_wmts)), set(['gk3', 'GLOBAL_WEBMERCATOR', 'utm32', 'InspireCrs84Quad']))
开发者ID:tjay,项目名称:mapproxy,代码行数:12,代码来源:test_multi_cache_layers.py

示例15: test_get_kml_multi_layer

 def test_get_kml_multi_layer(self):
     resp = self.app.get('/kml/wms_cache_multi/1/0/0.kml')
     xml = resp.lxml
     assert validate_with_xsd(xml, 'kml/2.2.0/ogckml22.xsd')
     eq_(xml.xpath('/kml:kml/kml:Document/kml:GroundOverlay/kml:Icon/kml:href/text()',
                   namespaces=ns),
         ['http://localhost/kml/wms_cache_multi/EPSG4326/2/0/1.jpeg',
          'http://localhost/kml/wms_cache_multi/EPSG4326/2/1/1.jpeg',
          'http://localhost/kml/wms_cache_multi/EPSG4326/2/0/0.jpeg',
          'http://localhost/kml/wms_cache_multi/EPSG4326/2/1/0.jpeg']
     )
     eq_(xml.xpath('/kml:kml/kml:Document/kml:NetworkLink/kml:Link/kml:href/text()',
                   namespaces=ns),
       ['http://localhost/kml/wms_cache_multi/EPSG4326/2/0/1.kml',
        'http://localhost/kml/wms_cache_multi/EPSG4326/2/1/1.kml',
        'http://localhost/kml/wms_cache_multi/EPSG4326/2/0/0.kml',
        'http://localhost/kml/wms_cache_multi/EPSG4326/2/1/0.kml']
     )
开发者ID:ChrisRenton,项目名称:mapproxy,代码行数:18,代码来源:test_kml.py


注:本文中的mapproxy.test.helper.validate_with_xsd函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。