-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
10 changed files
with
2,505 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,17 @@ | ||
import pytest | ||
|
||
from pywps import Service | ||
from pywps.tests import assert_response_success | ||
from pywps.tests import client_for, assert_response_success | ||
|
||
from .common import client_for | ||
from .common import get_output | ||
from emu.processes.wps_say_hello import SayHello | ||
|
||
|
||
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=datainputs) | ||
"?service=WPS&request=Execute&version=1.0.0&identifier=hello&datainputs={}".format( | ||
datainputs)) | ||
assert_response_success(resp) | ||
|
||
|
||
@pytest.mark.skip(reason="build_request_response method not available anymore") | ||
def test_wps_hello_again(): | ||
"""Example of how to debug this process, running outside a PyWPS instance. | ||
""" | ||
hello = SayHello() | ||
(request, response) = hello.build_request_response() | ||
literal_in = hello.inputs[0] | ||
literal_in.data = 'Alice' | ||
request.inputs["name"].append(literal_in) | ||
hello._handler(request, response) | ||
|
||
assert response.outputs["output"].data == 'Hello Alice' | ||
print("All good!") | ||
assert get_output(resp.xml) == {'output': "Hello LovelySugarBird"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,37 @@ | ||
import pytest | ||
import os | ||
import requests | ||
from pywps import Service | ||
from pywps.tests import assert_response_success | ||
|
||
from .common import client_for | ||
import emu | ||
from .common import client_for, resource_file, TESTS_HOME, WPS, OWS, get_output | ||
from emu.processes.wps_poly_centroid import PolyCentroid | ||
from eggshell.config import Paths | ||
|
||
paths = Paths(emu) | ||
TESTS_HOME = os.path.abspath(os.path.dirname(__file__)) | ||
cfgfiles = os.path.join(TESTS_HOME, 'test.cfg') | ||
|
||
|
||
def test_wps_poly_centroid(): | ||
def test_wps_poly_centroid_get(): | ||
client = client_for(Service(processes=[PolyCentroid(), ], cfgfiles=cfgfiles)) | ||
fn = os.path.join(TESTS_HOME, 'testdata', 'poly.xml') | ||
datainputs = "polygon=files@xlink:href=file://{0}".format(fn) | ||
datainputs = "polygon=@xlink:href=file://{0}".format(resource_file('poly.xml')) | ||
resp = client.get( | ||
service='WPS', request='Execute', version='1.0.0', | ||
identifier='poly_centroid', | ||
datainputs=datainputs) | ||
assert_response_success(resp) | ||
assert get_output(resp.xml) == {'output': "119.59740,-13.57388"} | ||
|
||
|
||
def test_wps_poly_centroid_post(): | ||
client = client_for(Service(processes=[PolyCentroid(), ], cfgfiles=cfgfiles)) | ||
request_doc = WPS.Execute( | ||
OWS.Identifier('poly_centroid'), | ||
WPS.DataInputs( | ||
WPS.Input( | ||
OWS.Identifier('polygon'), | ||
WPS.Data(WPS.ComplexData(open(resource_file('poly.xml'), 'r').read())) | ||
) | ||
), | ||
version='1.0.0' | ||
) | ||
resp = client.post_xml(doc=request_doc) | ||
assert_response_success(resp) | ||
assert get_output(resp.xml) == {'output': "119.59740,-13.57388"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.