Ignore:
Timestamp:
25/01/07 11:23:41 (13 years ago)
Author:
pjkersha
Message:
  • Working Attribute Authority unit tests *

python/ndg.security.server/ndg/security/server/AttAuthority/server-config.tac:

  • removed debug statements
  • getTrustedHostInfo: added code to make HostInfo? types and carry out serialization.

python/www/html/attAuthority.wsdl,
python/ndg.security.server/ndg/security/server/AttAuthority/AttAuthority_services_serv
er.py,
python/ndg.security.common/ndg/security/common/AttAuthority/AttAuthority_services_types.py,
python/ndg.security.common/ndg/security/common/AttAuthority/AttAuthority_services.py:
fix to WSDL: give name attribute to HostInfo? ComplexType?. No need to declare element.

python/ndg.security.server/ndg/security/server/AttAuthority/init.py:

AttAuthorityNoMatchingRoleInTrustedHosts? for handling getTrustedHostInfo errors.

  • changed usr -> user

python/ndg.security.server/ndg/security/server/AttAuthority/Makefile: make substitution
text macros

python/conf/attAuthorityProperties.xml,
python/ndg.security.test/ndg/security/test/AttAuthority/siteAAttAuthorityProperties.xml,
python/ndg.security.test/ndg/security/test/AttAuthority/siteBAttAuthorityProperties.xml,
python/ndg.security.test/ndg/security/test/AttAuthority/siteAUserRoles.py,
python/ndg.security.test/ndg/security/test/AttAuthority/siteBUserRoles.py:
changed usr -> user

python/ndg.security.test/ndg/security/test/AttAuthority/AttAuthorityClientTest.py:

  • fixed bugs in test method names
  • get host info and get trusted host info now correctly print output.

python/ndg.security.test/ndg/security/test/AttAuthority/siteAMapConfig.xml:
added trusted host info to allow testing with getTrustedHostInfo.

python/ndg.security.test/ndg/security/test/AttAuthority/attAuthorityClientTest.cfg:
fix to test3GetTrustedHostInfo method name tag

python/ndg.security.common/ndg/security/common/AttAuthority/init.py: AA client code
Fixed set up of dictionary output from returned ZSI types.

Location:
TI12-security/trunk/python/ndg.security.test/ndg/security/test/AttAuthority
Files:
7 edited

Legend:

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

    r2044 r2051  
    4343     
    4444    def test1GetX509Cert(self): 
    45         '''testGetX509Cert: retrieve Attribute Authority's X.509 cert.''' 
     45        '''test1GetX509Cert: retrieve Attribute Authority's X.509 cert.''' 
    4646        #import pdb;pdb.set_trace() 
    4747        resp = self.clnt.getX509Cert() 
    4848        print "Attribute Authority X.509 cert.:\n" + resp 
     49 
     50    def test2GetHostInfo(self): 
     51        """test2GetHostInfo: retrieve info for AA host""" 
     52        hostInfo = self.clnt.getHostInfo() 
     53        print "Host Info:\n %s" % hostInfo 
    4954         
    5055 
    51     def test2GetTrustedHostInfo(self): 
    52         """testGetTrustedHostInfo: retrieve trusted host info matching a 
     56    def test3GetTrustedHostInfo(self): 
     57        """test3GetTrustedHostInfo: retrieve trusted host info matching a 
    5358        given role""" 
    54         self.clnt.getTrustedHostInfo(\ 
    55                                  self.cfg['testGetTrustedHostInfo']['role']) 
     59        trustedHostInfo = self.clnt.getTrustedHostInfo(\ 
     60                                 self.cfg['test3GetTrustedHostInfo']['role']) 
     61        print "Trusted Host Info:\n %s" % trustedHostInfo 
    5662 
    5763 
    58     def test3GetTrustedHostInfoWithNoRole(self): 
    59         """testGetTrustedHostInfoWithNoRole: retrieve trusted host info  
     64    def test4GetTrustedHostInfoWithNoRole(self): 
     65        """test4GetTrustedHostInfoWithNoRole: retrieve trusted host info  
    6066        irrespective of role""" 
    61         self.clnt.getTrustedHostInfo() 
    62  
    63     def test4GetHostInfo(self): 
    64         """testGetHostInfo: retrieve info for AA host""" 
    65         self.clnt.getHostInfo() 
     67        trustedHostInfo = self.clnt.getTrustedHostInfo() 
     68        print "Trusted Host Info:\n %s" % trustedHostInfo 
    6669 
    6770 
    6871    def test5GetAttCert(self):         
    69         """testGetAttCert: Request attribute certificate from NDG Attribute  
     72        """test5GetAttCert: Request attribute certificate from NDG Attribute  
    7073        Authority Web Service.""" 
    7174     
     
    7376        try: 
    7477            userCertFilePath = \ 
    75                 self.cfg['testGetAttCert'].get('issuingusercertfilepath') 
     78                self.cfg['test5GetAttCert'].get('issuingusercertfilepath') 
    7679            userCertTxt = open(userCertFilePath, 'r').read() 
    7780         
     
    8790        attCert = self.clnt.getAttCert(userCert=userCertTxt) 
    8891        print "Attribute Certificate: \n\n:" + str(attCert) 
    89         attCert.filePath = self.cfg['testGetAttCert']['attcertfilepath'] 
     92        attCert.filePath = self.cfg['test5GetAttCert']['attcertfilepath'] 
    9093        attCert.write() 
    9194 
    9295 
    9396    def test6GetMappedAttCert(self):         
    94         """testGetAttCert: Request mapped attribute certificate from NDG  
    95         Attribute Authority Web Service.""" 
     97        """test6GetMappedAttCert: Request mapped attribute certificate from  
     98        NDG Attribute Authority Web Service.""" 
    9699     
    97100        # Read user Certificate into a string ready for passing via WS 
    98101        try: 
    99102            userCertFilePath = \ 
    100             self.cfg['testGetMappedAttCert'].get('issuingusercertfilepath') 
     103            self.cfg['test6GetMappedAttCert'].get('issuingusercertfilepath') 
    101104            userCertTxt = open(userCertFilePath, 'r').read() 
    102105         
     
    113116        try: 
    114117            userAttCert = AttCertRead(\ 
    115                       self.cfg['testGetMappedAttCert']['userattcertfilepath']) 
     118                      self.cfg['test6GetMappedAttCert']['userattcertfilepath']) 
    116119             
    117120        except IOError, ioErr: 
     
    121124        # Make client to site B Attribute Authority     
    122125        clnt = AttAuthorityClient(\ 
    123    uri=self.cfg['testGetMappedAttCert']['uri'],  
    124    clntCertFilePath=self.cfg['testGetMappedAttCert']['usercertfilepath'], 
    125    clntPriKeyFilePath=self.cfg['testGetMappedAttCert']['userprikeyfilepath'], 
     126   uri=self.cfg['test6GetMappedAttCert']['uri'],  
     127   clntCertFilePath=self.cfg['test6GetMappedAttCert']['usercertfilepath'], 
     128   clntPriKeyFilePath=self.cfg['test6GetMappedAttCert']['userprikeyfilepath'], 
    126129   tracefile=sys.stderr) 
    127130     
     
    137140        map = map(AttAuthorityClientTestCase, 
    138141                  ( 
    139                     "testGetHostInfo", 
    140                     "testGetTrustedHostInfo", 
    141                     "testGetTrustedHostInfoWithNoRole", 
    142                     "testGetAttCert", 
    143                     "testGetMappedAttCert", 
    144                     "testGetX509Cert", 
     142                    "test1GetX509Cert", 
     143                    "test2GetHostInfo", 
     144                    "test3GetTrustedHostInfo", 
     145                    "test4GetTrustedHostInfoWithNoRole", 
     146                    "test5GetAttCert", 
     147                    "test6GetMappedAttCert", 
    145148                  )) 
    146149        unittest.TestSuite.__init__(self, map) 
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/AttAuthority/attAuthorityClientTest.cfg

    r2044 r2051  
    2020userprikeyfilepath = ./proxy-key.pem 
    2121 
    22 [test2GetTrustedHostInfo] 
     22[test3GetTrustedHostInfo] 
    2323role = postgrad 
     24# Test no matching role exception 
     25#role = blah 
    2426  
    2527[test5GetAttCert] 
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/AttAuthority/siteAAttAuthorityProperties.xml

    r2039 r2051  
    1414    <attCertDir>$NDGSEC_AA_UNITTEST_DIR</attCertDir> 
    1515    <dnSeparator>/</dnSeparator> 
    16     <usrRolesModFilePath>$NDGSEC_AA_UNITTEST_DIR</usrRolesModFilePath> 
    17     <usrRolesModName>siteAUserRoles</usrRolesModName> 
    18     <usrRolesClassName>TestUserRoles</usrRolesClassName> 
    19     <usrRolesPropFile></usrRolesPropFile> 
     16    <userRolesModFilePath>$NDGSEC_AA_UNITTEST_DIR</userRolesModFilePath> 
     17    <userRolesModName>siteAUserRoles</userRolesModName> 
     18    <userRolesClassName>TestUserRoles</userRolesClassName> 
     19    <userRolesPropFile></userRolesPropFile> 
    2020</AAprop> 
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/AttAuthority/siteAMapConfig.xml

    r2039 r2051  
    55            <loginURI>thisHostLoginPageURI</loginURI> 
    66        </thisHost> 
     7    <trusted name="Site C"> 
     8            <aaURI>attAuthorityURI</aaURI> 
     9            <loginURI>loginPageURI</loginURI> 
     10                <role remote="StaffMember" local="staff"/> 
     11    </trusted> 
     12    <trusted name="Site D"> 
     13            <aaURI>attAuthorityURI</aaURI> 
     14            <loginURI>loginPageURI</loginURI> 
     15                <role remote="academic" local="postgrad"/> 
     16                <role remote="student" local="SiteDStudent"/> 
     17                <role remote="eoGroup" local="atsr-archive"/> 
     18    </trusted> 
    719</AAmap> 
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/AttAuthority/siteAUserRoles.py

    r2039 r2051  
    2424 
    2525 
    26     def usrIsRegistered(self, dn): 
     26    def userIsRegistered(self, dn): 
    2727        return True 
    2828 
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/AttAuthority/siteBAttAuthorityProperties.xml

    r2039 r2051  
    1414    <attCertDir>$NDGSEC_AA_UNITTEST_DIR</attCertDir> 
    1515    <dnSeparator>/</dnSeparator> 
    16     <usrRolesModFilePath>$NDGSEC_AA_UNITTEST_DIR</usrRolesModFilePath> 
    17     <usrRolesModName>siteBUserRoles</usrRolesModName> 
    18     <usrRolesClassName>TestUserRoles</usrRolesClassName> 
    19     <usrRolesPropFile></usrRolesPropFile> 
     16    <userRolesModFilePath>$NDGSEC_AA_UNITTEST_DIR</userRolesModFilePath> 
     17    <userRolesModName>siteBUserRoles</userRolesModName> 
     18    <userRolesClassName>TestUserRoles</userRolesClassName> 
     19    <userRolesPropFile></userRolesPropFile> 
    2020</AAprop> 
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/AttAuthority/siteBUserRoles.py

    r2044 r2051  
    2424 
    2525 
    26     def usrIsRegistered(self, dn): 
    27         return True 
     26    def userIsRegistered(self, dn): 
     27        return False 
    2828 
    2929 
Note: See TracChangeset for help on using the changeset viewer.