Changeset 3178


Ignore:
Timestamp:
04/01/08 15:46:56 (12 years ago)
Author:
pjkersha
Message:

AttCert? unit tests - use NDGSEC_ATTCERT_UNITTEST_DIR env var so that test can be run from any dir.

Location:
TI12-security/trunk/python/ndg.security.test/ndg/security/test/attCert
Files:
1 added
2 edited

Legend:

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

    r3175 r3178  
    2222from ndg.security.common.AttCert import AttCert 
    2323 
     24xpdVars = os.path.expandvars 
     25jnPath = os.path.join 
     26mkPath = lambda file: jnPath(os.environ['NDGSEC_ATTCERT_UNITTEST_DIR'], file) 
     27 
    2428class AttCertTestCase(unittest.TestCase): 
    2529     
    2630    def setUp(self): 
    2731         
     32        if 'NDGSEC_INT_DEBUG' in os.environ: 
     33            import pdb 
     34            pdb.set_trace() 
     35         
     36        if 'NDGSEC_ATTCERT_UNITTEST_DIR' not in os.environ: 
     37            os.environ['NDGSEC_ATTCERT_UNITTEST_DIR'] = \ 
     38                os.path.abspath(os.path.dirname(__file__)) 
     39 
    2840        configParser = SafeConfigParser() 
    29         configParser.read("./attCertTest.cfg") 
     41        configFilePath = jnPath(os.environ['NDGSEC_ATTCERT_UNITTEST_DIR'], 
     42                                'attCertTest.cfg') 
     43        configParser.read(configFilePath) 
    3044         
    3145        self.cfg = {} 
     
    172186        self.test6aSet()     
    173187         
    174         self.attCert.filePath = self.cfg['test9Sign']['filepath'] 
    175         self.attCert.certFilePathList=self.cfg['test9Sign']['certfile'] 
    176         self.attCert.signingKeyFilePath=self.cfg['test9Sign']['keyfile'] 
     188        self.attCert.filePath = xpdVars(self.cfg['test9Sign']['filepath']) 
     189        self.attCert.certFilePathList = \ 
     190            xpdVars(self.cfg['test9Sign']['certfile']) 
     191        self.attCert.signingKeyFilePath = \ 
     192            xpdVars(self.cfg['test9Sign']['keyfile']) 
    177193         
    178194        signingKeyPwd = self.cfg['test9Sign'].get('keypwd') 
     
    195211             
    196212        self.test9Sign() 
    197         self.attCert.filePath = self.cfg['test10Write']['filepath'] 
     213        self.attCert.filePath = xpdVars(self.cfg['test10Write']['filepath']) 
    198214        self.attCert.write() 
    199215       
     
    202218        '''test11Read: read document''' 
    203219             
    204         self.attCert.filePath = self.cfg['test11Read']['filepath'] 
     220        self.attCert.filePath = xpdVars(self.cfg['test11Read']['filepath']) 
    205221        self.attCert.read() 
    206222        print 'test11Read: \n\n%s' % self.attCert 
     
    225241            self.cfg['test13IsValidStressTest']['certfilepathlist'].split() 
    226242        self.attCert.signingKeyFilePath = \ 
    227                             self.cfg['test13IsValidStressTest']['keyfile'] 
     243                        xpdVars(self.cfg['test13IsValidStressTest']['keyfile']) 
    228244         
    229245        signingKeyPwd = self.cfg['test13IsValidStressTest'].get('keypwd') 
     
    262278    def test14IsValidSignature(self): 
    263279        '''test14IsValidSignature: check signature of XML document'''             
    264         self.attCert.filePath = self.cfg['test14IsValidSignature']['filepath'] 
     280        self.attCert.filePath = \ 
     281            xpdVars(self.cfg['test14IsValidSignature']['filepath']) 
    265282        self.attCert.read() 
    266283         
    267         self.attCert.certFilePathList = \ 
    268                 self.cfg['test14IsValidSignature']['certfilepathlist'].split() 
     284        certFilePathList = [xpdVars(file) for file in \ 
     285                self.cfg['test14IsValidSignature']['certfilepathlist'].split()] 
     286         
     287        self.attCert.certFilePathList = certFilePathList 
    269288        self.attCert.verifyEnvelopedSignature() 
    270289         
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/attCert/ac.xml

    r3175 r3178  
    99        <userId>/O=NDG/OU=BADC/CN=pjkershaw</userId> 
    1010        <validity> 
    11             <notBefore>2008 01 04 11 06 39</notBefore>  
    12             <notAfter>2008 01 04 19 06 39</notAfter>  
     11            <notBefore>2008 01 04 15 45 58</notBefore>  
     12            <notAfter>2008 01 04 23 45 58</notAfter>  
    1313        </validity> 
    1414        <attributes> 
     
    2727        <provenance>original</provenance>  
    2828    </acInfo> 
    29 <ds:Signature><ds:SignedInfo><ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces PrefixList="ds"></ec:InclusiveNamespaces></ds:CanonicalizationMethod><ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></ds:SignatureMethod><ds:Reference URI=""><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></ds:Transform><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces PrefixList="xmlns"></ec:InclusiveNamespaces></ds:Transform></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></ds:DigestMethod><ds:DigestValue>I0DxF9GopywzzDqr4CNuHZT9WC4=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>W2PvJqjLC7VK18qv/htapOsJVC9f+uTlhGVv7QL7GW842G6U0bTPn+0QGhHNbWPo0TZpS9Uy8uRs 
    30 381DFIKGZk044SUstqCGXEUjH0P4n4efBhqhDSdbh4X7uo0q968qHhAuLlI7uSrNJdTPgbdl25qO 
    31 36qEGHxO3OtHahqvQiRG38gcgHnVQ1gfsd+QMLqMCCDHIzMG0RpWpoy6awZ3Y07pVThULiWBXMKH 
    32 gdjLT39HeDxIV4r2Ro/0i1/5WEO7j5lJM+kYA1WZ5JGYY9uws7Mmq/oaNjL012z9ErizeUny/XB0 
    33 T6NrLQ1+tyUIK0k8aWSmbb1sEG14CoV+QOYI5w==</ds:SignatureValue><ds:KeyInfo><ds:X509Data><ds:X509Certificate>MIICazCCAdSgAwIBAgICAPcwDQYJKoZIhvcNAQEEBQAwLzEMMAoGA1UEChMDTkRH 
     29<ds:Signature><ds:SignedInfo><ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces PrefixList="ds"></ec:InclusiveNamespaces></ds:CanonicalizationMethod><ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></ds:SignatureMethod><ds:Reference URI=""><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></ds:Transform><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces PrefixList="xmlns"></ec:InclusiveNamespaces></ds:Transform></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></ds:DigestMethod><ds:DigestValue>b9+0xXj/zAUBcFXtai4zryJ2ZZ4=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>lxaiZbOMjsGwmIPkY2kO6YArGkhWUInJDy/QXRSMTXTioUfSNWqcfmsIME3ZatR5gYAOfjo4rEt+ 
     30sV5YwE9T6Q2T+j7WkTRMez+gLu8kDQwPSZMWHcNAzyf50H2xBTbnOXrf1mS6No25JNMtPrvX7+2+ 
     31hYe+c3o62HyDUwu2rNWGudwTfCaYydBrdv/64jhQYQDInM5cOnJl6Azb8XkH0YwOVn1QQSt+xDVN 
     321u2Pws0Bo1piK91hDmqizpmy/fFnSFCT71zrvpB7D6EV6a9SMSogVhcXq/rRMQl2j/lyMZcnoWHC 
     332aFcQ0u+0Rg5X9j6nFkmzIom+Gd5S1HAbM0f4g==</ds:SignatureValue><ds:KeyInfo><ds:X509Data><ds:X509Certificate>MIICazCCAdSgAwIBAgICAPcwDQYJKoZIhvcNAQEEBQAwLzEMMAoGA1UEChMDTkRH 
    3434MQ0wCwYDVQQLEwRCQURDMRAwDgYDVQQDEwdUZXN0IENBMB4XDTA4MDEwNDEwMTk0 
    3535N1oXDTA5MDEwMzEwMTk0N1owLDEMMAoGA1UEChMDTkRHMQ0wCwYDVQQLEwRCQURD 
Note: See TracChangeset for help on using the changeset viewer.