def testAccessors(self): """Test for Assertion accessors""" self.assertion.id = "assertion id" self.assertion.version = saml2.VERSION self.assertion.issue_instant = "2007-08-31T01:05:02Z" self.assertion.issuer = saml.issuer_from_string(saml2_data.TEST_ISSUER) self.assertion.signature = ds.signature_from_string(ds_data.TEST_SIGNATURE) self.assertion.subject = saml.subject_from_string(saml2_data.TEST_SUBJECT) self.assertion.conditions = saml.conditions_from_string(saml2_data.TEST_CONDITIONS) self.assertion.advice = saml.Advice() self.assertion.statement.append(saml.Statement()) self.assertion.authn_statement.append(saml.authn_statement_from_string(saml2_data.TEST_AUTHN_STATEMENT)) self.assertion.authz_decision_statement.append(saml.AuthzDecisionStatement()) self.assertion.attribute_statement.append( saml.attribute_statement_from_string(saml2_data.TEST_ATTRIBUTE_STATEMENT) ) new_assertion = saml.assertion_from_string(self.assertion.to_string()) assert new_assertion.id == "assertion id" assert new_assertion.version == saml2.VERSION assert new_assertion.issue_instant == "2007-08-31T01:05:02Z" assert isinstance(new_assertion.issuer, saml.Issuer) assert isinstance(new_assertion.signature, ds.Signature) assert isinstance(new_assertion.subject, saml.Subject) assert isinstance(new_assertion.conditions, saml.Conditions) assert isinstance(new_assertion.advice, saml.Advice) assert isinstance(new_assertion.statement[0], saml.Statement) assert isinstance(new_assertion.authn_statement[0], saml.AuthnStatement) assert isinstance(new_assertion.authz_decision_statement[0], saml.AuthzDecisionStatement) assert isinstance(new_assertion.attribute_statement[0], saml.AttributeStatement)
def testUsingTestData(self): """Test for subject_from_string() using test data.""" subject = saml.subject_from_string(saml2_data.TEST_SUBJECT) assert subject.name_id.sp_provided_id == "sp provided id" assert subject.name_id.text.strip() == "*****@*****.**" assert subject.name_id.format == saml.NAMEID_FORMAT_EMAILADDRESS assert isinstance(subject.subject_confirmation[0], saml.SubjectConfirmation)
def testAccessors(self): """Test for Subject accessors""" self.subject.name_id = saml.name_id_from_string(saml2_data.TEST_NAME_ID) self.subject.subject_confirmation.append( saml.subject_confirmation_from_string(saml2_data.TEST_SUBJECT_CONFIRMATION) ) new_subject = saml.subject_from_string(self.subject.to_string()) assert new_subject.name_id.sp_provided_id == "sp provided id" assert new_subject.name_id.text.strip() == "*****@*****.**" assert new_subject.name_id.format == saml.NAMEID_FORMAT_EMAILADDRESS assert isinstance(new_subject.subject_confirmation[0], saml.SubjectConfirmation)