• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python helper.validate_with_xsd函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: test_capabilities

    def test_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_(len(xml.xpath('//wmts:Layer', namespaces=ns_wmts)), 5)
        eq_(len(xml.xpath('//wmts:Contents/wmts:TileMatrixSet', namespaces=ns_wmts)), 5)

        goog_matrixset = xml.xpath('//wmts:Contents/wmts:TileMatrixSet[./ows:Identifier/text()="GoogleMapsCompatible"]', namespaces=ns_wmts)[0]
        eq_(goog_matrixset.findtext('ows:Identifier', namespaces=ns_wmts), 'GoogleMapsCompatible')
        # top left corner: min X first then max Y
        assert re.match('-20037508\.\d+ 20037508\.\d+', goog_matrixset.findtext('./wmts:TileMatrix[1]/wmts:TopLeftCorner', namespaces=ns_wmts))

        gk_matrixset = xml.xpath('//wmts:Contents/wmts:TileMatrixSet[./ows:Identifier/text()="gk3"]', namespaces=ns_wmts)[0]
        eq_(gk_matrixset.findtext('ows:Identifier', namespaces=ns_wmts), 'gk3')
        # Gauß-Krüger uses "reverse" axis order -> top left corner: max Y first then min X
        assert re.match('6000000.0+ 3000000.0+', gk_matrixset.findtext('./wmts:TileMatrix[1]/wmts:TopLeftCorner', namespaces=ns_wmts))
开发者ID:TNRIS,项目名称:mapproxy,代码行数:18,代码来源:test_wmts.py


示例17: test_render_w_code

    def test_render_w_code(self):
        req = self.mock(WMSMapRequest)
        req_ex = RequestError("the exception message", code="InvalidFormat", request=req)
        ex_handler = WMS130ExceptionHandler()
        self.expect(req.exception_handler).result(ex_handler)

        self.replay()
        response = req_ex.render()
        assert response.content_type == "text/xml; charset=utf-8"
        expected_resp = """
<?xml version='1.0' encoding="UTF-8"?>
<ServiceExceptionReport version="1.3.0"
  xmlns="http://www.opengis.net/ogc"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.opengis.net/ogc
http://schemas.opengis.net/wms/1.3.0/exceptions_1_3_0.xsd">
    <ServiceException code="InvalidFormat">the exception message</ServiceException>
</ServiceExceptionReport>
"""
        assert expected_resp.strip() == response.data
        assert validate_with_xsd(response.data, "wms/1.3.0/exceptions_1_3_0.xsd")
开发者ID:quiqua,项目名称:mapproxy,代码行数:21,代码来源:test_exceptions.py


示例18: test_get_kml2

 def test_get_kml2(self):
     resp = self.app.get('/kml/wms_cache/1/0/1.kml')
     xml = resp.lxml
     assert validate_with_xsd(xml, 'kml/2.2.0/ogckml22.xsd')
开发者ID:ChrisRenton,项目名称:mapproxy,代码行数:4,代码来源:test_kml.py


示例19: test_get_tile_source_error

 def test_get_tile_source_error(self):
     resp = self.app.get("/wmts/myrest/tms_cache/GLOBAL_MERCATOR/01/0/0.png", 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:TNRIS,项目名称:mapproxy,代码行数:5,代码来源:test_wmts_restful.py


示例20: 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)), 5)
     eq_(len(xml.xpath("//wmts:Contents/wmts:TileMatrixSet", namespaces=ns_wmts)), 5)
开发者ID:TNRIS,项目名称:mapproxy,代码行数:6,代码来源:test_wmts_restful.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python http.mock_httpd函数代码示例发布时间:2022-05-27
下一篇:
Python template.bunch函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap