Ignore:
Timestamp:
15/02/10 11:33:01 (11 years ago)
Author:
pjkersha
Message:

Working refactored Attribute Authority Client unit tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/NDGSecurity/python/ndg_security_test/ndg/security/test/unit/attributeauthorityclient/test_samlattributeauthorityclient.py

    r6571 r6572  
    2626                                        AttributeQuerySOAPBinding,  
    2727                                        AttributeQuerySslSOAPBinding) 
    28 from ndg.security.common.saml_utils.esg import EsgSamlNamespaces 
     28from ndg.security.common.saml_utils.esg import (EsgSamlNamespaces, 
     29                                                EsgDefaultQueryAttributes) 
    2930from ndg.security.test.unit.attributeauthorityclient import \ 
    3031                                        AttributeAuthorityClientBaseTestCase 
     
    4041        super(AttributeAuthoritySAMLInterfaceTestCase, self).__init__(*arg,  
    4142                                                                      **kw) 
     43         
     44        # Run same config but on two different ports - one HTTP and one HTTPS 
     45        self.startSiteAAttributeAuthority() 
    4246        self.startSiteAAttributeAuthority(withSSL=True, port=5443) 
    4347        
     
    5458        attributeQuery.issuer.value = "/CN=Authorisation Service/O=Site A"     
    5559                         
    56         attributeQuery.subject = Subject()   
     60        attributeQuery.subject = Subject() 
    5761        attributeQuery.subject.nameID = NameID() 
    5862        attributeQuery.subject.nameID.format = EsgSamlNamespaces.NAMEID_FORMAT 
     
    120124        attributeQuery.issuer = Issuer() 
    121125        attributeQuery.issuer.format = Issuer.X509_SUBJECT 
    122         attributeQuery.issuer.value = "Invalid Site"     
     126        attributeQuery.issuer.value = "/O=Invalid Site/CN=PDP"     
    123127                         
    124128        attributeQuery.subject = Subject()   
     
    136140 
    137141        binding = SOAPBinding() 
     142        binding.serialise = AttributeQueryElementTree.toXML 
     143        binding.deserialise = ResponseElementTree.fromXML 
    138144        response = binding.send(attributeQuery, _cfg['uri']) 
    139145 
     
    174180 
    175181        binding = SOAPBinding() 
     182        binding.serialise = AttributeQueryElementTree.toXML 
     183        binding.deserialise = ResponseElementTree.fromXML 
    176184        response = binding.send(attributeQuery, _cfg['uri']) 
    177185         
     
    186194              
    187195    def test04SAMLAttributeQueryInvalidAttrName(self): 
    188         _cfg = self.cfg['test04SAMLAttributeQueryInvalidAttrName'] 
     196        thisSection = 'test04SAMLAttributeQueryInvalidAttrName' 
     197        _cfg = self.cfg[thisSection] 
    189198         
    190199        attributeQuery = AttributeQuery() 
     
    210219        attributeQuery.attributes.append(invalidAttribute)  
    211220 
    212         binding = SOAPBinding() 
     221        binding = SOAPBinding.fromConfig( 
     222                     AttributeAuthoritySAMLInterfaceTestCase.CONFIG_FILENAME,  
     223                     prefix='saml.',  
     224                     section=thisSection) 
    213225        response = binding.send(attributeQuery, _cfg['uri']) 
    214226         
     
    229241         
    230242        binding.subjectID = AttributeAuthoritySAMLInterfaceTestCase.OPENID_URI 
    231         binding.issuerDN = \ 
    232             AttributeAuthoritySAMLInterfaceTestCase.VALID_REQUESTOR_IDS[0]         
     243        binding.subjectIdFormat = EsgSamlNamespaces.NAMEID_FORMAT 
     244        binding.issuerName = \ 
     245            str(AttributeAuthoritySAMLInterfaceTestCase.VALID_REQUESTOR_IDS[0]) 
     246        binding.issuerFormat = Issuer.X509_SUBJECT 
    233247         
    234248        binding.queryAttributes = EsgDefaultQueryAttributes.ATTRIBUTES 
Note: See TracChangeset for help on using the changeset viewer.