1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#!/usr/bin/env python
import unittest, sys
from ZSI import *
class t7TestCase(unittest.TestCase):
"Test case wrapper for old ZSI t7 test case"
def checkt7(self):
ps = ParsedSoap(text)
tcdict = TC.Apache.Map('c-gensym1')
tclist = TC.Apache.Map('c-gensym1', aslist=1)
d = tcdict.parse(ps.body_root, ps)
self.assertEqual(d, { u'a':123, '\x00\x01':456 })
print 'as dictionary\n', d
l = tclist.parse(ps.body_root, ps)
self.assertEqual(l, [('\x00\x01', 456), (u'a', 123)])
print '\n', '=' * 30
print 'as list\n', l
print '\n', '=' * 30
sw = SoapWriter()
sw.serialize(d, tcdict)
print >>sys.stdout, sw
print '\n', '=' * 30
sw = SoapWriter()
sw.serialize(l, tclist)
print >>sys.stdout, sw
def makeTestSuite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(t7TestCase, "check"))
return suite
def main():
unittest.main(defaultTest="makeTestSuite")
text = '''
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
xmlns:xmlsoap="http://xml.apache.org/xml-soap">
<SOAP-ENV:Body>
<c-gensym1 xsi:type="xmlsoap:Map">
<item>
<key xsi:type="SOAP-ENC:base64">AAE=</key>
<value xsi:type="xsd:int">456</value>
</item>
<item>
<key xsi:type="xsd:string">a</key>
<value xsi:type="xsd:int">123</value>
</item>
</c-gensym1>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
'''
if __name__ == "__main__" : main()
|