Ignore:
Timestamp:
11/02/10 17:09:43 (11 years ago)
Author:
pjkersha
Message:

Working serialised Response with AuthzDecisionStatement? in unit tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/ndg_security_saml/saml/test/test_saml.py

    r6553 r6558  
    2424                             AuthzDecisionStatement, Assertion, AttributeQuery,  
    2525                             Response, Issuer, Subject, NameID, StatusCode,  
    26                              StatusMessage, Status, Conditions,  
     26                             StatusMessage, Status, Conditions, DecisionType, 
    2727                             XSStringAttributeValue, Action, 
    2828                             AuthzDecisionQuery) 
     
    487487 
    488488 
    489     def test05CreateAuthzDecisionQueryResponse(self): 
     489    def test09CreateAuthzDecisionQueryResponse(self): 
    490490        response = Response() 
    491         response.issueInstant = datetime.utcnow() 
     491        now = datetime.utcnow() 
     492        response.issueInstant = now 
    492493         
    493494        # Make up a request ID that this response is responding to 
     
    498499        response.issuer = Issuer() 
    499500        response.issuer.format = Issuer.X509_SUBJECT 
    500         response.issuer.value = \ 
    501                         SAMLTestCase.ISSUER_DN 
     501        response.issuer.value = SAMLTestCase.ISSUER_DN 
    502502         
    503503        response.status = Status() 
     
    508508            
    509509        assertion = Assertion() 
     510        assertion.version = SAMLVersion(SAMLVersion.VERSION_20) 
     511        assertion.id = str(uuid4()) 
     512        assertion.issueInstant = now 
     513         
    510514        authzDecisionStatement = AuthzDecisionStatement() 
     515        authzDecisionStatement.decision = DecisionType.PERMIT 
    511516        authzDecisionStatement.resource = SAMLTestCase.RESOURCE_URI 
    512517        authzDecisionStatement.actions.append(Action()) 
     
    515520        assertion.authzDecisionStatements.append(authzDecisionStatement) 
    516521         
    517 #        assertion.subject = Subject()   
    518 #        assertion.subject.nameID = NameID() 
    519 #        assertion.subject.nameID.format = SAMLTestCase.NAMEID_FORMAT 
    520 #        assertion.subject.nameID.value = SAMLTestCase.NAMEID_VALUE     
    521 #             
    522 #        assertion.issuer = Issuer() 
    523 #        assertion.issuer.format = Issuer.X509_SUBJECT 
    524 #        assertion.issuer.value = SAMLTestCase.ISSUER_DN 
     522        # Add a conditions statement for a validity of 8 hours 
     523        assertion.conditions = Conditions() 
     524        assertion.conditions.notBefore = now 
     525        assertion.conditions.notOnOrAfter = now + timedelta(seconds=60*60*8) 
     526                
     527        assertion.subject = Subject()   
     528        assertion.subject.nameID = NameID() 
     529        assertion.subject.nameID.format = SAMLTestCase.NAMEID_FORMAT 
     530        assertion.subject.nameID.value = SAMLTestCase.NAMEID_VALUE     
     531             
     532        assertion.issuer = Issuer() 
     533        assertion.issuer.format = Issuer.X509_SUBJECT 
     534        assertion.issuer.value = SAMLTestCase.ISSUER_DN 
    525535 
    526536        response.assertions.append(assertion) 
Note: See TracChangeset for help on using the changeset viewer.