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

contrib/opal/ZSI/test/wsdl2py/test_Echo.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 """
00010 Unittest 
00011 
00012 WSDL:  ../../samples/Echo/Echo.wsdl
00013 """
00014 
00015 # General targets
00016 def dispatch():
00017     """Run all dispatch tests"""
00018     suite = ServiceTestSuite()
00019     suite.addTest(unittest.makeSuite(EchoTestCase, 'test_dispatch'))
00020     return suite
00021 
00022 def local():
00023     """Run all local tests"""
00024     suite = ServiceTestSuite()
00025     suite.addTest(unittest.makeSuite(EchoTestCase, 'test_local'))
00026     return suite
00027 
00028 def net():
00029     """Run all network tests"""
00030     suite = ServiceTestSuite()
00031     suite.addTest(unittest.makeSuite(EchoTestCase, 'test_net'))
00032     return suite
00033     
00034 def all():
00035     """Run all tests"""
00036     suite = ServiceTestSuite()
00037     suite.addTest(unittest.makeSuite(EchoTestCase, 'test_'))
00038     return suite
00039 
00040 
00041 class EchoTestCase(ServiceTestCase):
00042     name = "test_Echo"
00043     client_file_name = "EchoServer_client.py"
00044     types_file_name  = "EchoServer_types.py"
00045     server_file_name = "EchoServer_server.py"
00046 
00047     def __init__(self, methodName):
00048         ServiceTestCase.__init__(self, methodName)
00049         self.wsdl2py_args.append('-b')
00050 
00051     def test_local_Echo(self):
00052         msg = self.client_module.EchoRequest()
00053         rsp = self.client_module.EchoResponse()
00054 
00055     def test_dispatch_Echo(self):
00056         loc = self.client_module.EchoServerLocator()
00057         port = loc.getEchoServer(**self.getPortKWArgs())
00058         
00059         msg = self.client_module.EchoRequest()
00060         msg.EchoIn = 'bla bla bla'
00061         rsp = port.Echo(msg)
00062         self.failUnless(rsp.EchoResult == msg.EchoIn, "Bad Echo")
00063 
00064 
00065 if __name__ == "__main__" :
00066     main()
00067 

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