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

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

00001 #!/usr/bin/env python
00002 ############################################################################
00003 # Joshua R. Boverhof, LBNL
00004 # See LBNLCopyright for copyright notice!
00005 ###########################################################################
00006 import sys, unittest
00007 from ServiceTest import main, ServiceTestCase, ServiceTestSuite
00008 from ZSI.auth import AUTH
00009 """
00010 Unittest for contacting the Map Point Service.  
00011 
00012 WSDL:  
00013 """
00014 # General targets
00015 def dispatch():
00016     """Run all dispatch tests"""
00017     suite = ServiceTestSuite()
00018     suite.addTest(unittest.makeSuite(MapPointTest, 'test_dispatch'))
00019     return suite
00020 
00021 def local():
00022     """Run all local tests"""
00023     suite = ServiceTestSuite()
00024     suite.addTest(unittest.makeSuite(MapPointTest, 'test_local'))
00025     return suite
00026 
00027 def net():
00028     """Run all network tests"""
00029     suite = ServiceTestSuite()
00030     suite.addTest(unittest.makeSuite(MapPointTest, 'test_net'))
00031     return suite
00032     
00033 def all():
00034     """Run all tests"""
00035     suite = ServiceTestSuite()
00036     suite.addTest(unittest.makeSuite(MapPointTest, 'test_'))
00037     return suite
00038 
00039 
00040 
00041 class MapPointTest(ServiceTestCase):
00042     """Test case for OPCService Web service
00043     
00044     """
00045     name = "test_MapPoint"
00046     client_file_name = "CommonService_client.py"
00047     types_file_name = "CommonService_types.py"
00048     server_file_name = "CommonService_server.py"
00049 
00050     def __init__(self, methodName):
00051         ServiceTestCase.__init__(self, methodName)
00052         self.wsdl2py_args.append('-b')
00053 
00054     def test_net_GetVersionInfo(self):
00055         """expect this to fail cause i'm not doing http authentication.
00056         """
00057         loc = self.client_module.CommonServiceLocator()
00058         kw = self.getPortKWArgs()
00059         #port = loc.getCommonServiceSoap(auth=(AUTH.httpdigest, "USERNAME", "PASSWORD"), **kw)
00060         port = loc.getCommonServiceSoap(**kw)
00061         
00062         msg = self.client_module.GetVersionInfoSoapIn()
00063         try:
00064             rsp = port.GetVersionInfo(msg)
00065         except RuntimeError:
00066             # RuntimeError: HTTP Digest Authorization Failed
00067             pass
00068 
00069         port.binding.SetAuth(AUTH.httpdigest, user="USERNAME", password="PASSWORD")
00070         print ">> DIGEST AUTH"
00071         try:
00072             rsp = port.GetVersionInfo(msg)
00073         except RuntimeError:
00074             pass
00075         
00076 
00077 if __name__ == "__main__" :
00078     main()
00079 

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