本文整理汇总了Python中tests.common.client_for函数的典型用法代码示例。如果您正苦于以下问题:Python client_for函数的具体用法?Python client_for怎么用?Python client_for使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了client_for函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
def pr1(): pass
def pr2(): pass
db.create_all()
self.client = client_for(Service(processes=[Process(pr1, 'pr1', 'Process 1'), Process(pr2, 'pr2', 'Process 2')]))
示例2: 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/Output')
self.assertEqual('outbbox', xpath_ns(output,
'./ows:Identifier')[0].text)
self.assertEqual('15 50', xpath_ns(output,
'./ows:BoundingBox/ows:LowerCorner')[0].text)
示例3: setUp
def setUp(self):
db.create_all()
def hello(request): pass
def ping(request): pass
processes = [Process(hello, 'hello', 'Process Hello'), Process(ping, 'ping', 'Process Ping')]
self.client = client_for(Service(processes=processes))
示例4: 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'), 120)))
resp = client.post_xml(doc=request_doc)
assert_response_accepted(resp)
示例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'}
示例6: setUp
def setUp(self):
def hello(request):
pass
def ping(request):
pass
processes = [Process(hello, "hello", "Process Hello"), Process(ping, "ping", "Process Ping")]
self.client = client_for(Service(processes=processes))
示例7: 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'
示例8: 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!"}
示例9: test_wcs
def test_wcs(self):
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/img'))),
WPS.ProcessOutputs(
WPS.Output(
OWS.Identifier('output'))))
resp = client.post_xml(doc=request_doc)
assert_response_success(resp)
示例10: 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'))
)
)
)
resp = client.post_xml(doc=request_doc)
assert_response_success(resp)
assert get_output(resp.xml) == {'message': "Hello foo!"}
示例11: 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/img"))),
WPS.ProcessOutputs(WPS.Output(OWS.Identifier("output"))),
version="1.0.0",
)
resp = client.post_xml(doc=request_doc)
assert_response_success(resp)
示例12: 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='text/xml'))),
WPS.ProcessOutputs(
WPS.Output(
OWS.Identifier('output'))),
version='1.0.0'
)
resp = client.post_xml(doc=request_doc)
assert_response_success(resp)
示例13: test_wps_subset_countries
def test_wps_subset_countries():
client = client_for(
Service(processes=[SubsetcountryProcess()], cfgfiles=CFG_FILE))
datainputs = datainputs_fmt.format(
TESTDATA['cmip5_tasmax_2006_nc'],
'CAN',
"True")
resp = client.get(
service='wps', request='execute', version='1.0.0',
identifier='subset_countries',
datainputs=datainputs)
assert_response_success(resp)
# Check output file size is smaller than input.
out = get_output(resp.xml)
assert 'output' in out.keys()
示例14: 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/Output")
self.assertEqual("outbbox", xpath_ns(output, "./ows:Identifier")[0].text)
self.assertEqual("15 50", xpath_ns(output, "./ows:BoundingBox/ows:LowerCorner")[0].text)
示例15: 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)