Ignore:
Timestamp:
23/11/07 13:50:10 (12 years ago)
Author:
pjkersha
Message:

SessionMgr? SessionMgrClient? unit tests complete with tests for getSessionStatus included

ndg.security.server/ndg/security/server/conf/sessionMgr.tac:

  • code for getSessionStatus incorporated

ndg.security.server/ndg/security/server/SessionMgr/SessionMgr_services_server.py,
ndg.security.common/ndg/security/common/SessionMgr/SessionMgr_services.py,
ndg.security.common/ndg/security/common/SessionMgr/SessionMgr_services_types.py,
www/html/sessionMgr.wsdl: fixed getSessionStatusResponse - isAlive element needs to be nested within a sequence elem.

ndg.security.test/ndg/security/test/sessionMgrClient/SessionMgrClientTest.py,

ndg.security.test/ndg/security/test/sessionMgrClient/sessionMgrProperties.xml: default to https for tests

ndg.security.test/ndg/security/test/sessionMgrClient/sessionMgrClientTest.cfg: get rid of test1AddUser and added test2GetSessionStatus

ndg.security.test/ndg/security/test/sessionMgr/test.py: SessionMgr? unit tests all working

ndg.security.common/ndg/security/common/SessionMgr/init.py: added getSessionStatus method

ndg.security.common/ndg/security/common/AttAuthority/init.py: fix to getHostInfo - return dict indexed by hostname

ndg.security.common/ndg/security/common/AttAuthority/AttAuthority_services.py: re-ran code generation from WSDL

Makefile: added targets for building ZSI code stubs from AA and SM WSDLs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/sessionMgr/test.py

    r3041 r3044  
    77""" 
    88__author__ = "P J Kershaw" 
    9 __date__ = "23/02/06" 
     9__date__ = "20/11/07" 
    1010__copyright__ = "(C) 2007 STFC & NERC" 
    1111__license__ = \ 
     
    1313License, version 1.0 or later.""" 
    1414__contact__ = "P.J.Kershaw@rl.ac.uk" 
    15 __revision__ = '$Id: SessionMgrTest.py 2909 2007-09-28 14:22:21Z pjkersha $' 
     15__revision__ = '$Id$' 
    1616 
    1717import unittest 
     
    2121from ndg.security.common.X509 import X509CertParse 
    2222from ndg.security.server.SessionMgr import * 
    23      
    2423 
    2524 
     
    5251        """test1Connect: make a new session""" 
    5352         
     53        print "\n\t" + self.test1Connect.__doc__ 
     54         
    5455        if SessionMgrTestCase.test2Passphrase is None: 
    5556            SessionMgrTestCase.test2Passphrase = \ 
     
    7071    def test2GetSessionStatus(self): 
    7172        """test2GetSessionStatus: check a session is alive""" 
     73        print "\n\t" + self.test2GetSessionStatus.__doc__ 
     74         
    7275        self.test1Connect() 
    7376        assert self.sm.getSessionStatus(sessID=self.sessID), "Session is dead" 
     
    8386        sessID should be None""" 
    8487 
     88        print "\n\t" + self.test3ConnectNoCreateServerSess.__doc__ 
     89         
    8590        if SessionMgrTestCase.test3Passphrase is None: 
    8691            SessionMgrTestCase.test3Passphrase = \ 
     
    136141        self.test1Connect() 
    137142         
    138         attCert = self.sm.getAttCert(\ 
     143        attCert, errMsg, extAttCertList = self.sm.getAttCert(\ 
    139144            sessID=self.sessID,  
    140145            aaURI=self.cfg.get('test6GetAttCertUsingSessID', 'aauri')) 
    141          
     146        if errMsg: 
     147            self.fail(errMsg) 
     148             
    142149        print "Attribute Certificate:\n%s" % attCert  
    143150        attCert.filePath = \ 
    144151            self.cfg.get('test6GetAttCertUsingSessID', 'acoutfilepath')  
    145152        attCert.write() 
     153         
     154        return self.sm 
    146155 
    147156 
     
    156165        aaURI = self.cfg.get('test6aGetAttCertRefusedUsingSessID', 'aauri') 
    157166         
    158         attCert, errMsg, e.extAttCertList = self.sm.getAttCert(sessID=self.sessID,  
     167        attCert, errMsg, extAttCertList = self.sm.getAttCert(sessID=self.sessID,  
    159168                                         aaURI=aaURI, 
    160169                                         mapFromTrustedHosts=False) 
     
    173182        self.test1Connect() 
    174183         
     184        # Attribute Certificate cached in test 6 can be used to get a mapped 
     185        # AC for this test ... 
     186        self.sm = self.test6GetAttCertUsingSessID() 
     187 
    175188        aaURI = self.cfg.get('test6bGetMappedAttCertUsingSessID', 'aauri') 
    176189         
    177         attCert=self.sm.getAttCert(sessID=self.sessID,attAuthorityURI=aaURI) 
    178          
     190        attCert, errMsg, extAttCertList=self.sm.getAttCert(sessID=self.sessID, 
     191                                                   aaURI=aaURI, 
     192                                                   mapFromTrustedHosts=True) 
     193        if errMsg: 
     194            self.fail(errMsg) 
     195             
    179196        print "Attribute Certificate:\n%s" % attCert   
    180197 
     
    196213        extAttCert = open(extACFilePath).read() 
    197214         
    198         attCert = self.sm.getAttCert(sessID=self.sessID,  
    199                                        attAuthorityURI=aaURI, 
     215        attCert, errMsg, extAttCertList = self.sm.getAttCert(sessID=self.sessID,  
     216                                       aaURI=aaURI, 
    200217                                       extAttCertList=[extAttCert]) 
     218        if errMsg: 
     219            self.fail(errMsg) 
    201220           
    202221        print "Attribute Certificate:\n%s" % attCert   
     
    209228        self.test1Connect() 
    210229 
    211         self.sm.signatureHandler.reqBinSecTokValType = 'X509PKIPathv1' 
    212         self.sm.signatureHandler.signingPriKey = self.proxyPriKey         
    213         self.sm.signatureHandler.signingCertChain = (self.userCert, 
    214                                                        self.proxyCert) 
    215          
    216230        # Request an attribute certificate from an Attribute Authority  
    217231        # using the proxyCert returned from connect() 
    218232         
    219233        aaURI = self.cfg.get('test7GetAttCertUsingProxyCert', 'aauri') 
    220         attCert = self.sm.getAttCert(attAuthorityURI=aaURI) 
     234        attCert, errMsg, extAttCertList = self.sm.getAttCert(\ 
     235                                     userCert=self.proxyCert, aaURI=aaURI) 
     236        if errMsg: 
     237            self.fail(errMsg) 
    221238           
    222239        print "Attribute Certificate:\n%s" % attCert   
Note: See TracChangeset for help on using the changeset viewer.