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

Python tests.client_for函数代码示例

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

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



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

示例1: test_bbox

    def test_bbox(self):
        if not PY2:
            self.skipTest('OWSlib not python 3 compatible')
        client = client_for(Service(processes=[create_bbox_process()]))
        request_doc = WPS.Execute(
            OWS.Identifier('my_bbox_process'),
            WPS.DataInputs(
                WPS.Input(
                    OWS.Identifier('mybbox'),
                    WPS.Data(WPS.BoundingBoxData(
                        OWS.LowerCorner('15 50'),
                        OWS.UpperCorner('16 51'),
                    ))
                )
            ),
            version='1.0.0'
        )
        resp = client.post_xml(doc=request_doc)
        assert_response_success(resp)

        [output] = xpath_ns(resp.xml, '/wps:ExecuteResponse'
                                      '/wps:ProcessOutputs/wps:Output')
        self.assertEqual('outbbox', xpath_ns(
            output,
            './ows:Identifier')[0].text)
        self.assertEqual('15 50', xpath_ns(
            output,
            './wps:Data/ows:BoundingBox/ows:LowerCorner')[0].text)
开发者ID:xhqiao89,项目名称:pywps,代码行数:28,代码来源:test_execute.py


示例2: compare_io

    def compare_io(self, name, fn, fmt):
        """Start the dummy process, post the request and check the response matches the input data."""

        # Note that `WPSRequest` calls `get_inputs_from_xml` which converts base64 input to bytes
        # See `_get_rawvalue_value`
        client = client_for(Service(processes=[create_fmt_process(name, fn, fmt)]))
        data = get_data(fn, fmt.encoding)

        wps = WPSExecution()
        doc = wps.buildRequest('test-fmt',
                               inputs=[('complex', ComplexDataInput(data, mimeType=fmt.mime_type,
                                                                    encoding=fmt.encoding))],
                               mode='sync')
        resp = client.post_xml(doc=doc)
        assert_response_success(resp)
        wps.parseResponse(resp.xml)
        out = wps.processOutputs[0].data[0]

        if 'gml' in fmt.mime_type:
            xml_orig = etree.tostring(etree.fromstring(data.encode('utf-8'))).decode('utf-8')
            xml_out = etree.tostring(etree.fromstring(out.decode('utf-8'))).decode('utf-8')
            # Not equal because the output includes additional namespaces compared to the origin.
            # self.assertEqual(xml_out, xml_orig)

        else:
            self.assertEqual(out.strip(), data.strip())
开发者ID:bird-house,项目名称:pywps,代码行数:26,代码来源:test_complexdata_io.py


示例3: test_wps_hello

def test_wps_hello():
    client = client_for(Service(processes=[SayHello()]))
    datainputs = "name=LovelySugarBird"
    resp = client.get(
        "?service=WPS&request=Execute&version=1.0.0&identifier=hello&datainputs={}".format(
            datainputs))
    assert_response_success(resp)
    assert get_output(resp.xml) == {'output': "Hello LovelySugarBird"}
开发者ID:bird-house,项目名称:emu,代码行数:8,代码来源:test_wps_hello.py


示例4: test_bad_service_type_with_get

    def test_bad_service_type_with_get(self):
        client = client_for(Service())
        resp = client.get('?service=foo')

        exception = resp.xpath('/ows:ExceptionReport'
                                '/ows:Exception')

        assert resp.status_code == 400
        assert exception[0].attrib['exceptionCode'] == 'InvalidParameterValue'
开发者ID:ldesousa,项目名称:PyWPS,代码行数:9,代码来源:test_capabilities.py


示例5: test_post_with_no_inputs

 def test_post_with_no_inputs(self):
     client = client_for(Service(processes=[create_ultimate_question()]))
     request_doc = WPS.Execute(
         OWS.Identifier('ultimate_question'),
         version='1.0.0'
     )
     resp = client.post_xml(doc=request_doc)
     assert_response_success(resp)
     assert get_output(resp.xml) == {'outvalue': '42'}
开发者ID:xhqiao89,项目名称:pywps,代码行数:9,代码来源:test_execute.py


示例6: test_epsg_based_location

    def test_epsg_based_location(self):
        """Test whether the EPSG of a mapset corresponds the specified one."""
        my_process = grass_epsg_based_location()
        client = client_for(Service(processes=[my_process]))

        request_doc = WPS.Execute(
            OWS.Identifier('my_epsg_based_location'),
            version='1.0.0'
        )

        resp = client.post_xml(doc=request_doc)
        assert_response_success(resp)
开发者ID:bird-house,项目名称:pywps,代码行数:12,代码来源:test_grass_location.py


示例7: setUp

    def setUp(self):
        def hello(request):
            pass

        def ping(request):
            pass
        processes = [
            Process(hello, 'hello', 'Process Hello', metadata=[
                Metadata('hello metadata', 'http://example.org/hello',
                         role='http://www.opengis.net/spec/wps/2.0/def/process/description/documentation')]),
            Process(ping, 'ping', 'Process Ping', metadata=[Metadata('ping metadata', 'http://example.org/ping')]),
        ]
        self.client = client_for(Service(processes=processes))
开发者ID:ldesousa,项目名称:PyWPS,代码行数:13,代码来源:test_describe.py


示例8: test_wcs

 def test_wcs(self):
     try:
         sys.path.append("/usr/lib/grass64/etc/python/")
         import grass.script as grass
     except:
         self.skipTest("GRASS lib not found")
     client = client_for(Service(processes=[create_sum_one()]))
     request_doc = WPS.Execute(
         OWS.Identifier("sum_one"),
         WPS.DataInputs(WPS.Input(OWS.Identifier("input"), WPS.Reference(href=wcsResource, mimeType="image/tiff"))),
         WPS.ProcessOutputs(WPS.Output(OWS.Identifier("output"))),
         version="1.0.0",
     )
     resp = client.post_xml(doc=request_doc)
     assert_response_success(resp)
开发者ID:geopython,项目名称:pywps,代码行数:15,代码来源:test_ows.py


示例9: test_post_with_string_input

 def test_post_with_string_input(self):
     client = client_for(Service(processes=[create_greeter()]))
     request_doc = WPS.Execute(
         OWS.Identifier('greeter'),
         WPS.DataInputs(
             WPS.Input(
                 OWS.Identifier('name'),
                 WPS.Data(WPS.LiteralData('foo'))
             )
         ),
         version='1.0.0'
     )
     resp = client.post_xml(doc=request_doc)
     assert_response_success(resp)
     assert get_output(resp.xml) == {'message': "Hello foo!"}
开发者ID:xhqiao89,项目名称:pywps,代码行数:15,代码来源:test_execute.py


示例10: test_output_response_dataType

 def test_output_response_dataType(self):
     client = client_for(Service(processes=[create_greeter()]))
     request_doc = WPS.Execute(
         OWS.Identifier('greeter'),
         WPS.DataInputs(
             WPS.Input(
                 OWS.Identifier('name'),
                 WPS.Data(WPS.LiteralData('foo'))
             )
         ),
         version='1.0.0'
     )
     resp = client.post_xml(doc=request_doc)
     el = next(resp.xml.iter('{http://www.opengis.net/wps/1.0.0}LiteralData'))
     assert el.attrib['dataType'] == 'string'
开发者ID:bird-house,项目名称:pywps,代码行数:15,代码来源:test_execute.py


示例11: test_assync

 def test_assync(self):
     client = client_for(Service(processes=[create_sleep()]))
     request_doc = WPS.Execute(
         OWS.Identifier('sleep'),
         WPS.DataInputs(
             WPS.Input(
                 OWS.Identifier('seconds'),
                 WPS.Data(
                     WPS.LiteralData(
                         "120"
                     )
                 )
             )
         ),
         version="1.0.0"
     )
     resp = client.post_xml(doc=request_doc)
     assert_response_accepted(resp)
开发者ID:hoseinmadadi,项目名称:pywps,代码行数:18,代码来源:test_assync.py


示例12: test_file_based_location

    def test_file_based_location(self):
        """Test whether the datum of a mapset corresponds the file one."""
        my_process = grass_file_based_location()
        client = client_for(Service(processes=[my_process]))

        href = 'http://demo.mapserver.org/cgi-bin/wfs?service=WFS&' \
               'version=1.1.0&request=GetFeature&typename=continents&' \
               'maxfeatures=1'

        request_doc = WPS.Execute(
            OWS.Identifier('my_file_based_location'),
            WPS.DataInputs(
                WPS.Input(
                    OWS.Identifier('input1'),
                    WPS.Reference(
                        {'{http://www.w3.org/1999/xlink}href': href}))),
            version='1.0.0')

        resp = client.post_xml(doc=request_doc)
        assert_response_success(resp)
开发者ID:bird-house,项目名称:pywps,代码行数:20,代码来源:test_grass_location.py


示例13: test_wfs

    def test_wfs(self):
        client = client_for(Service(processes=[create_feature()]))
        request_doc = WPS.Execute(
            OWS.Identifier('feature'),
            WPS.DataInputs(
                WPS.Input(
                    OWS.Identifier('input'),
                    WPS.Reference(
                        {'{http://www.w3.org/1999/xlink}href': wfsResource},
                        mimeType=FORMATS.GML.mime_type,
                        encoding='',
                        schema=''))),
            WPS.ProcessOutputs(
                WPS.Output(
                    OWS.Identifier('output'))),
            version='1.0.0'
        )
        resp = client.post_xml(doc=request_doc)

        assert_response_success(resp)
开发者ID:ldesousa,项目名称:PyWPS,代码行数:20,代码来源:test_ows.py


示例14: test_wps_subset_bbox

def test_wps_subset_bbox():
    client = client_for(Service(processes=[SubsetBboxProcess()], cfgfiles=CFG_FILE))

    datainputs = "[email protected]:href={fn};" \
                 "lat0={lat0};" \
                 "lon0={lon0};" \
                 "lat1={lat1};" \
                 "lon1={lon1};" \
                 .format(fn=TESTDATA['cmip5_tasmax_2006_nc'], lat0=2., lon0=3., lat1=4., lon1=5.)

    resp = client.get(
        "?service=WPS&request=Execute&version=1.0.0&identifier=subset_bbox&datainputs={}".format(
            datainputs))

    print(resp.get_data())
    assert_response_success(resp)

    out = get_output(resp.xml)
    ds = nc.Dataset(out['output'][7:])
    check_bnds(ds['lat_bnds'], 2, 4)
    check_bnds(ds['lon_bnds'], 3, 5)

    assert 'metalink' in out
开发者ID:bird-house,项目名称:flyingpigeon,代码行数:23,代码来源:test_wps_subset_bbox.py


示例15: test_bad_request_type_with_post

 def test_bad_request_type_with_post(self):
     client = client_for(Service())
     request_doc = WPS.Foo()
     resp = client.post_xml('', doc=request_doc)
     assert resp.status_code == 400
开发者ID:ldesousa,项目名称:PyWPS,代码行数:5,代码来源:test_capabilities.py


示例16: test_metalink

 def test_metalink(self):
     client = client_for(Service(processes=[create_metalink_process()]))
     resp = client.get('?Request=Execute&identifier=multiple-outputs')
     assert resp.status_code == 400
开发者ID:bird-house,项目名称:pywps,代码行数:4,代码来源:test_execute.py


示例17: test_bad_request_type_with_get

 def test_bad_request_type_with_get(self):
     client = client_for(Service())
     resp = client.get('?Request=foo')
     assert resp.status_code == 400
开发者ID:ldesousa,项目名称:PyWPS,代码行数:4,代码来源:test_capabilities.py


示例18: test_bad_http_verb

 def test_bad_http_verb(self):
     client = client_for(Service())
     resp = client.put('')
     assert resp.status_code == 405  # method not allowed
开发者ID:ldesousa,项目名称:PyWPS,代码行数:4,代码来源:test_capabilities.py


示例19: setUp

 def setUp(self):
     def pr1(): pass
     def pr2(): pass
     self.client = client_for(Service(processes=[Process(pr1, 'pr1', 'Process 1', metadata=[Metadata('pr1 metadata')]), Process(pr2, 'pr2', 'Process 2', metadata=[Metadata('pr2 metadata')])]))
开发者ID:hoseinmadadi,项目名称:pywps,代码行数:4,代码来源:test_capabilities.py


示例20: describe_process

 def describe_process(self, process):
     client = client_for(Service(processes=[process]))
     resp = client.get('?service=wps&version=1.0.0&Request=DescribeProcess&identifier=%s'
                       % process.identifier)
     [result] = get_describe_result(resp)
     return result
开发者ID:ldesousa,项目名称:PyWPS,代码行数:6,代码来源:test_describe.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python pywt.dwt函数代码示例发布时间:2022-05-26
下一篇:
Python configuration.get_config_value函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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