1.1 --- a/tests/soap_test.py Sat Oct 06 19:33:47 2007 +0000
1.2 +++ b/tests/soap_test.py Sat Oct 06 20:46:13 2007 +0000
1.3 @@ -2,6 +2,7 @@
1.4 # -*- coding: iso-8859-15 -*-
1.5
1.6 import libxml2dom.soap
1.7 +from libxml2dom.rpc import ParameterName, ParameterValue
1.8
1.9 request = """<?xml version='1.0' encoding='iso-8859-1'?>
1.10 <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" >
1.11 @@ -31,19 +32,19 @@
1.12
1.13 req = libxml2dom.soap.parseString(request)
1.14 assert req.method.methodName == "chargeReservation"
1.15 -assert req.method.rawParameterValues == [
1.16 - (("http://travelcompany.example.org/reservation", "reservation"), [
1.17 - (("http://travelcompany.example.org/reservation", "code"), "FT35ZBQ")
1.18 +assert req.method.parameterValues == [
1.19 + ParameterValue(ParameterName("http://travelcompany.example.org/reservation", "reservation"), [
1.20 + ParameterValue(ParameterName("http://travelcompany.example.org/reservation", "code"), "FT35ZBQ")
1.21 ]),
1.22 - (("http://mycompany.example.com/financial", "creditCard"), [
1.23 - (("http://mycompany.example.com/employees", "name"), u"Åke Jógvan Øyvind"),
1.24 - (("http://mycompany.example.com/financial", "number"), "123456789099999"),
1.25 - (("http://mycompany.example.com/financial", "expiration"), "2005-02")
1.26 + ParameterValue(ParameterName("http://mycompany.example.com/financial", "creditCard"), [
1.27 + ParameterValue(ParameterName("http://mycompany.example.com/employees", "name"), u"Åke Jógvan Øyvind"),
1.28 + ParameterValue(ParameterName("http://mycompany.example.com/financial", "number"), "123456789099999"),
1.29 + ParameterValue(ParameterName("http://mycompany.example.com/financial", "expiration"), "2005-02")
1.30 ])
1.31 ]
1.32 assert req.fault is None
1.33 print "Method name:", req.method.methodName
1.34 -print "Parameter values:", req.method.rawParameterValues
1.35 +print "Parameter values:", req.method.parameterValues
1.36 print "Fault:", req.fault
1.37
1.38 response = """<?xml version='1.0' encoding='iso-8859-1'?>
1.39 @@ -68,13 +69,14 @@
1.40
1.41 resp = libxml2dom.soap.parseString(response)
1.42 assert resp.method.methodName == "chargeReservationResponse"
1.43 -assert resp.method.rawParameterValues == [
1.44 - (("http://travelcompany.example.org/", "code"), "FT35ZBQ"),
1.45 - (("http://travelcompany.example.org/", "viewAt"), "http://travelcompany.example.org/reservations?code=FT35ZBQ")
1.46 +assert resp.method.parameterValues == [
1.47 + ParameterValue(ParameterName("http://travelcompany.example.org/", "code"), "FT35ZBQ"),
1.48 + ParameterValue(ParameterName("http://travelcompany.example.org/", "viewAt"),
1.49 + "http://travelcompany.example.org/reservations?code=FT35ZBQ")
1.50 ]
1.51 assert resp.fault is None
1.52 print "Method name:", resp.method.methodName
1.53 -print "Parameter values:", resp.method.rawParameterValues
1.54 +print "Parameter values:", resp.method.parameterValues
1.55 print "Fault:", resp.fault
1.56
1.57 response2 = """<?xml version='1.0' encoding='iso-8859-1'?>
1.58 @@ -102,15 +104,16 @@
1.59
1.60 resp2 = libxml2dom.soap.parseString(response2)
1.61 assert resp2.method.methodName == "chargeReservationResponse"
1.62 -assert resp2.method.rawParameterValues == [
1.63 - (("http://www.w3.org/2003/05/soap-rpc", "result"), "m:status"),
1.64 - (("http://travelcompany.example.org/", "status"), "confirmed"),
1.65 - (("http://travelcompany.example.org/", "code"), "FT35ZBQ"),
1.66 - (("http://travelcompany.example.org/", "viewAt"), "http://travelcompany.example.org/reservations?code=FT35ZBQ")
1.67 +assert resp2.method.parameterValues == [
1.68 + ParameterValue(ParameterName("http://www.w3.org/2003/05/soap-rpc", "result"), "m:status"),
1.69 + ParameterValue(ParameterName("http://travelcompany.example.org/", "status"), "confirmed"),
1.70 + ParameterValue(ParameterName("http://travelcompany.example.org/", "code"), "FT35ZBQ"),
1.71 + ParameterValue(ParameterName("http://travelcompany.example.org/", "viewAt"),
1.72 + "http://travelcompany.example.org/reservations?code=FT35ZBQ")
1.73 ]
1.74 assert resp2.fault is None
1.75 print "Method name:", resp2.method.methodName
1.76 -print "Parameter values:", resp2.method.rawParameterValues
1.77 +print "Parameter values:", resp2.method.parameterValues
1.78 print "Fault:", resp2.fault
1.79
1.80 failed = """<?xml version='1.0' encoding='iso-8859-1'?>