def test_wps_extremoscope(): raise SkipTest wps = WpsTestClient() datainputs = "[resource={0}]".format(TESTDATA['cmip5_tasmax_nc']) resp = wps.get(service='wps', request='execute', version='1.0.0', identifier='extremoscope', datainputs=datainputs) assert_response_success(resp)
def test_wps_extractpoints(): raise SkipTest wps = WpsTestClient() datainputs = "[netcdf_file={0};coords=2.356138,48.846450;type_nc=True;type_csv=True]".format(TESTDATA['cmip5_tasmax_nc']) resp = wps.get(service='wps', request='execute', version='1.0.0', identifier='extractpoints', datainputs=datainputs) assert_response_success(resp)
def test_wps_analogs(): raise SkipTest wps = WpsTestClient() datainputs = "[experiment=NCEP;dateSt=1958-07-15;dateEn=1958-12-31]" resp = wps.get(service='wps', request='execute', version='1.0.0', identifier='analogs', datainputs=datainputs) assert_response_success(resp)
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'}
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)
def test_wps_eobs_to_cordex(): raise SkipTest wps = WpsTestClient() datainputs = "[var_eobs=tg;start=1950;end=1950]".format(TESTDATA['eurocordex_nc_1']) resp = wps.get(service='wps', request='execute', version='1.0.0', identifier='eobs_to_cordex', datainputs=datainputs) assert_response_success(resp)
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)
def test_wps_vbd(): raise SkipTest wps = WpsTestClient() datainputs = "[dataset={0}]".format(TESTDATA['eurocordex_nc_1']) resp = wps.get(service='wps', request='execute', version='1.0.0', identifier='gam', datainputs=datainputs) assert_response_success(resp)
def test_wps_fetch(): wps = WpsTestClient() datainputs = "[resource={0};resource={1}]".format( TESTDATA['cmip5_tasmax_r1_nc'], TESTDATA['cmip5_tasmax_r2_nc']) resp = wps.get(service='wps', request='execute', version='1.0.0', identifier='fetch', datainputs=datainputs) assert_response_success(resp)
def test_wps_indices_single(): raise SkipTest wps = WpsTestClient() datainputs = "[resource={0};indices=SU]".format(TESTDATA['cordex_tasmax_nc']) resp = wps.get(service='wps', request='execute', version='1.0.0', identifier='indices_single', datainputs=datainputs) assert_response_success(resp)
def test_get_with_no_inputs(self): client = client_for(Service(processes=[create_ultimate_question()])) resp = client.get( '?service=wps&version=1.0.0&Request=Execute&identifier=ultimate_question' ) assert_response_success(resp) assert get_output(resp.xml) == {'outvalue': '42'}
def test_wps_ensemble_robustness(): wps = WpsTestClient() datainputs = "[resource={0};resource={1};start=2006;end=2006;timeslice=1;variable=tasmax]".format( TESTDATA['cmip5_tasmax_r1_nc'], TESTDATA['cmip5_tasmax_r2_nc']) resp = wps.get(service='wps', request='execute', version='1.0.0', identifier='ensembleRobustness', datainputs=datainputs) assert_response_success(resp)
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'}
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!"}
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!"}
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)
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)
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)
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)
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)
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) from lxml import etree assert_response_success(resp)
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)
def test_wps_subset_countries(): wps = WpsTestClient() datainputs = "[resource={0};region=FRA]".format(TESTDATA['cmip5_tasmax_nc']) resp = wps.get(service='wps', request='execute', version='1.0.0', identifier='subset_countries', datainputs=datainputs) assert_response_success(resp)
def test_get_with_no_inputs(self): client = client_for(Service(processes=[create_ultimate_question()])) resp = client.get('?service=wps&version=1.0.0&Request=Execute&identifier=ultimate_question') assert_response_success(resp) assert get_output(resp.xml) == {'outvalue': '42'}