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

contrib/opal/ZSI/test/wsdl2py/test_SubstitutionGroup.py

00001 #!/usr/bin/env python
00002 ############################################################################
00003 # Joshua R. Boverhof, LBNL
00004 # See LBNLCopyright for copyright notice!
00005 ###########################################################################
00006 import os, sys, unittest, time
00007 from ServiceTest import main, ServiceTestCase, ServiceTestSuite
00008 from ZSI import FaultException
00009 from ZSI.TC import _get_global_element_declaration as GED
00010 from ZSI.writer import SoapWriter
00011 from ZSI.parse import ParsedSoap
00012 
00013 """
00014 Unittest for substitutionGroup
00015 [ ] 
00016 
00017 XSD: 
00018 """
00019 
00020 # General targets
00021 def dispatch():
00022     """Run all dispatch tests"""
00023     suite = ServiceTestSuite()
00024     suite.addTest(unittest.makeSuite(SubstitutionGroupTestCase, 'test_dispatch'))
00025     return suite
00026 
00027 def local():
00028     """Run all local tests"""
00029     suite = ServiceTestSuite()
00030     suite.addTest(unittest.makeSuite(SubstitutionGroupTestCase, 'test_local'))
00031     return suite
00032 
00033 def net():
00034     """Run all network tests"""
00035     suite = ServiceTestSuite()
00036     suite.addTest(unittest.makeSuite(SubstitutionGroupTestCase, 'test_net'))
00037     return suite
00038     
00039 def all():
00040     """Run all tests"""
00041     suite = ServiceTestSuite()
00042     suite.addTest(unittest.makeSuite(SubstitutionGroupTestCase, 'test_'))
00043     return suite
00044 
00045 
00046 class SubstitutionGroupTestCase(ServiceTestCase):
00047     name = "test_SubstitutionGroup"
00048     types_file_name = "test_SubstitutionGroup_xsd_types.py"
00049 
00050     def __init__(self, methodName):
00051         ServiceTestCase.__init__(self, methodName)
00052         self.wsdl2py_args.append('-b')
00053         self.wsdl2py_args.append('-x')
00054 
00055     def test_local_attribute1(self):
00056         """
00057         """
00058         self.types_module
00059 
00060         xml = """<?xml version="1.0" encoding="UTF-8"?>
00061         <holder xmlns='urn:subGroup:types'>
00062         <baseElt><base>from base</base></baseElt>
00063         <childElt><base>from base</base><child>from child</child></childElt></holder>"""
00064 
00065         ps = ParsedSoap(xml, envelope=False)
00066         p1 = ps.Parse(GED("urn:subGroup:types", "holder"))
00067 
00068         b1 = p1.BaseElt[0]
00069         c1 = p1.BaseElt[1]
00070 
00071         sw = SoapWriter(envelope=False)
00072         sw.serialize(p1)
00073 
00074         ps = ParsedSoap(str(sw), envelope=False)
00075         p2 = ps.Parse(GED("urn:subGroup:types", "holder"))
00076         b2 = p2.BaseElt[0]
00077         c2 = p2.BaseElt[1]
00078  
00079         self.failUnlessEqual(b1.Base, b2.Base)
00080         self.failUnlessEqual(c1.Base, c2.Base)
00081         self.failUnlessEqual(c1.Child, c2.Child)
00082 
00083 
00084 
00085 if __name__ == "__main__" :
00086     main()
00087 

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