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

contrib/opal/ZSI/test/test_t4.py

00001 #!/usr/bin/env python
00002 import unittest, sys
00003 from ZSI import *
00004 from ZSI import resolvers
00005 
00006 OUT = sys.stdout
00007 IN='''<SOAP-ENV:Envelope
00008  xmlns="http://www.example.com/schemas/TEST"
00009  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
00010  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
00011  xmlns:ZSI="http://www.zolera.com/schemas/ZSI/">
00012  <SOAP-ENV:Body>
00013  <hreftest>
00014     <xmltest href="http://www-itg.lbl.gov/~kjackson/zsi.xsd"/>
00015     <stringtest href="http://www.microsoft.com"/>
00016  </hreftest>
00017  </SOAP-ENV:Body>
00018  </SOAP-ENV:Envelope>
00019  '''
00020 
00021 class t4TestCase(unittest.TestCase):
00022     "Test case wrapper for old ZSI t4 test case"
00023 
00024     def checkt4(self):
00025         try:
00026             r = resolvers.NetworkResolver(['http:'])
00027             ps = ParsedSoap(IN, resolver=r.Resolve)
00028         except ParseException, e:
00029             print >>OUT, FaultFromZSIException(e).AsSOAP()
00030             self.fail() 
00031         except Exception, e: 
00032             # Faulted while processing; assume it's in the header.  
00033             print >>OUT, FaultFromException(e, 1, sys.exc_info()[2]).AsSOAP() 
00034             self.fail() 
00035         print 'resolving' 
00036         typecode = TC.Struct(None, [ TC.XML('xmltest'), 
00037                            TC.String('stringtest', resolver=r.Opaque), ]) 
00038         try: 
00039             dict = ps.Parse(typecode) 
00040         except EvaluateException, e: 
00041             print >>OUT, FaultFromZSIException(e).AsSOAP() 
00042             self.fail() 
00043         except Exception, e: 
00044             # Faulted while processing; now it's the body 
00045             print >>OUT, FaultFromException(e, 0, sys.exc_info()[2]).AsSOAP() 
00046             self.fail() 
00047         ##PrettyPrint(dict['xmltest']) 
00048         print '**', dict['stringtest'], '**'
00049 
00050 def makeTestSuite():
00051     suite = unittest.TestSuite()
00052     suite.addTest(unittest.makeSuite(t4TestCase, "check"))
00053     return suite
00054 
00055 def main():
00056     unittest.main(defaultTest="makeTestSuite")
00057 
00058 
00059 if __name__ == "__main__" : main()
00060 
00061 

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