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

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

00001 #!/usr/bin/env python
00002 ############################################################################
00003 # Joshua R. Boverhof, LBNL
00004 # See LBNLCopyright for copyright notice!
00005 ###########################################################################
00006 import os, sys, unittest
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 
00012 """
00013 Unittest for Bug Report 
00014 [ 1441574 ] ZSI assumes minOccurs(1) for all parts
00015 
00016 WSDL:  
00017 """
00018 
00019 # General targets
00020 def dispatch():
00021     """Run all dispatch tests"""
00022     suite = ServiceTestSuite()
00023     suite.addTest(unittest.makeSuite(ChoiceTestCase, 'test_dispatch'))
00024     return suite
00025 
00026 def local():
00027     """Run all local tests"""
00028     suite = ServiceTestSuite()
00029     suite.addTest(unittest.makeSuite(ChoiceTestCase, 'test_local'))
00030     return suite
00031 
00032 def net():
00033     """Run all network tests"""
00034     suite = ServiceTestSuite()
00035     suite.addTest(unittest.makeSuite(ChoiceTestCase, 'test_net'))
00036     return suite
00037     
00038 def all():
00039     """Run all tests"""
00040     suite = ServiceTestSuite()
00041     suite.addTest(unittest.makeSuite(ChoiceTestCase, 'test_'))
00042     return suite
00043 
00044 
00045 class ChoiceTestCase(ServiceTestCase):
00046     name = "test_Choice"
00047     types_file_name = "test_Choice_xsd_types.py"
00048  
00049     def __init__(self, methodName):
00050         ServiceTestCase.__init__(self, methodName)
00051         self.wsdl2py_args.append('-b')
00052         self.wsdl2py_args.append('-x')
00053  
00054     def test_local_choice_default_facets_legal1(self):
00055         """<choice minOccurs=1 maxOccurs=1>
00056         """
00057         pyobj = GED("urn:example", "Easy").pyclass()
00058         pyobj.Rank = 1
00059         sw = SoapWriter()
00060         sw.serialize(pyobj)
00061         print str(sw)
00062 
00063     def test_local_choice_maxOccurs_unbounded(self):
00064         """<choice minOccurs=1 maxOccurs=unbounded>
00065         """
00066         pyobj = GED("urn:example", "Hard").pyclass()
00067         pyobj.Name = ["steve", "mark"]
00068         pyobj.Any = ["whatever"]
00069         pyobj.Rank = [2,3,4]
00070         sw = SoapWriter()
00071         sw.serialize(pyobj)
00072         print str(sw)
00073 
00074 
00075 if __name__ == "__main__" :
00076     main()
00077 

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