00001
00002
00003
00004
00005
00006
00007
00008
00009 import sys, unittest
00010 from ServiceTest import main, ServiceTestCase, ServiceTestSuite, TestException
00011
00012 """
00013 Unittest for contacting the SquareService rpc/literal tests.
00014
00015 From the paper "Interoperable WSDL/SOAP web services introduction:
00016 Python ZSI, Excel XP, gSOAP C/C++ & Applix SS", Holger Joukl
00017
00018 WSDL: SquareService.wsdl
00019
00020 """
00021
00022 def dispatch():
00023 """Run all dispatch tests"""
00024 suite = ServiceTestSuite()
00025 suite.addTest(unittest.makeSuite(Test, 'test_dispatch'))
00026 return suite
00027
00028 def local():
00029 """Run all local tests"""
00030 suite = ServiceTestSuite()
00031 suite.addTest(unittest.makeSuite(Test, 'test_local'))
00032 return suite
00033
00034 def net():
00035 """Run all network tests"""
00036 suite = ServiceTestSuite()
00037 suite.addTest(unittest.makeSuite(Test, 'test_net'))
00038 return suite
00039
00040 def all():
00041 """Run all tests"""
00042 suite = ServiceTestSuite()
00043 suite.addTest(unittest.makeSuite(Test, 'test_'))
00044 return suite
00045
00046
00047 class Test(ServiceTestCase):
00048 """Test case for Holger's SquareService
00049 """
00050 name = "test_FinancialService"
00051 client_file_name = "FinancialService_client.py"
00052 types_file_name = "FinancialService_types.py"
00053 server_file_name = "FinancialService_server.py"
00054
00055 def __init__(self, methodName):
00056 ServiceTestCase.__init__(self, methodName)
00057 self.wsdl2py_args.append('-b')
00058
00059 def test_dispatch_getPV(self):
00060 loc = self.client_module.FinancialServiceLocator()
00061 port = loc.getFinancialService_Port(**self.getPortKWArgs())
00062
00063 msg = self.client_module.getPVRequest()
00064 msg.Irate = 4
00065 msg.CFSequence = cfs = msg.new_CFSequence()
00066 cfs.CF = [100.0,5.0,5.0,105.0]
00067
00068 rsp = port.getPV(msg)
00069 self.failUnless(rsp == 202.775091, "Received %d" %rsp)
00070
00071
00072 if __name__ == "__main__" :
00073 main()