示例#1
0
 def test_one_string(self):
     request_doc = WPS.Execute(
         OWS.Identifier('foo'),
         WPS.DataInputs(
             WPS.Input(OWS.Identifier('name'),
                       WPS.Data(WPS.LiteralData('foo')))))
     assert get_input_from_xml(request_doc).to_dict() == {'name': 'foo'}
示例#2
0
 def test_two_strings(self):
     request_doc = WPS.Execute(
         OWS.Identifier('foo'),
         WPS.DataInputs(
             WPS.Input(OWS.Identifier('name'),
                       WPS.Data(WPS.LiteralData('foo'))),
             WPS.Input(OWS.Identifier('name'),
                       WPS.Data(WPS.LiteralData('bar')))))
     rv = get_input_from_xml(request_doc)
     assert rv.getlist('name') == ['foo', 'bar']
示例#3
0
 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!"}
示例#4
0
 def test_complex_input(self):
     the_data = E.TheData("hello world")
     request_doc = WPS.Execute(
         OWS.Identifier('foo'),
         WPS.DataInputs(
             WPS.Input(
                 OWS.Identifier('name'),
                 WPS.Data(WPS.ComplexData(the_data,
                                          mimeType='text/foobar')))))
     rv = get_input_from_xml(request_doc)
     assert rv['name'].mime_type == 'text/foobar'
     rv_doc = lxml.etree.parse(rv['name']).getroot()
     assert rv_doc.tag == 'TheData'
     assert rv_doc.text == "hello world"
示例#5
0
 def test_post_two_args(self):
     request_doc = WPS.DescribeProcess(OWS.Identifier('hello'),
                                       OWS.Identifier('ping'))
     resp = self.client.post_xml(doc=request_doc)
     result = get_describe_result(resp)
     assert [pr.identifier for pr in result] == ['hello', 'ping']
示例#6
0
 def test_post_one_arg(self):
     request_doc = WPS.DescribeProcess(OWS.Identifier('hello'))
     resp = self.client.post_xml(doc=request_doc)
     assert [pr.identifier for pr in get_describe_result(resp)] == ['hello']
示例#7
0
 def test_empty(self):
     request_doc = WPS.Execute(OWS.Identifier('foo'))
     assert get_input_from_xml(request_doc) == {}
示例#8
0
 def test_post_with_no_inputs(self):
     client = client_for(Service(processes=[create_ultimate_question()]))
     request_doc = WPS.Execute(OWS.Identifier('ultimate_question'))
     resp = client.post_xml(doc=request_doc)
     assert_response_success(resp)
     assert get_output(resp.xml) == {'outvalue': '42'}