• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

contrib/opal/ZSI/test/test_t7.py

00001 #!/usr/bin/env python
00002 import unittest, sys
00003 from ZSI import *
00004 
00005 
00006 class t7TestCase(unittest.TestCase):
00007     "Test case wrapper for old ZSI t7 test case"
00008 
00009     def checkt7(self):
00010         ps = ParsedSoap(text)
00011 
00012         tcdict = TC.Apache.Map('c-gensym1')
00013         tclist = TC.Apache.Map('c-gensym1', aslist=1)
00014 
00015         d = tcdict.parse(ps.body_root, ps)
00016         self.assertEqual(d, { u'a':123, '\x00\x01':456 })
00017         print 'as dictionary\n', d
00018 
00019         l = tclist.parse(ps.body_root, ps)
00020         self.assertEqual(l, [('\x00\x01', 456), (u'a', 123)])
00021         print '\n', '=' * 30
00022         print 'as list\n', l
00023 
00024         print '\n', '=' * 30
00025         sw = SoapWriter()
00026         sw.serialize(d, tcdict)
00027         print >>sys.stdout, sw
00028 
00029         print '\n', '=' * 30
00030         sw = SoapWriter()
00031         sw.serialize(l, tclist)
00032         print >>sys.stdout, sw
00033 
00034 def makeTestSuite():
00035     suite = unittest.TestSuite()
00036     suite.addTest(unittest.makeSuite(t7TestCase, "check"))
00037     return suite
00038 
00039 def main():
00040     unittest.main(defaultTest="makeTestSuite")
00041 
00042 text = '''
00043 <SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
00044     xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
00045     xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
00046     xmlns:xsd="http://www.w3.org/1999/XMLSchema"
00047     xmlns:xmlsoap="http://xml.apache.org/xml-soap">
00048 <SOAP-ENV:Body>
00049 <c-gensym1 xsi:type="xmlsoap:Map">
00050   <item>
00051     <key xsi:type="SOAP-ENC:base64">AAE=</key>
00052     <value xsi:type="xsd:int">456</value>
00053   </item>
00054   <item>
00055     <key xsi:type="xsd:string">a</key>
00056     <value xsi:type="xsd:int">123</value>
00057   </item>
00058 </c-gensym1>
00059 </SOAP-ENV:Body>
00060 </SOAP-ENV:Envelope>
00061 '''
00062 
00063 
00064 if __name__ == "__main__" : main()
00065 
00066 

Generated on Wed Oct 20 2010 11:12:16 for APBS by  doxygen 1.7.2