Ejemplo n.º 1
0
 def testUsingTestData(self):
     """Test issuer_from_string() using test data"""
     issuer = saml.issuer_from_string(saml2_data.TEST_ISSUER)
     assert issuer.text.strip() == "http://www.example.com/test"
     new_issuer = saml.issuer_from_string(issuer.to_string())
     assert issuer.text == new_issuer.text
     assert issuer.extension_elements == new_issuer.extension_elements
Ejemplo n.º 2
0
    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)
Ejemplo n.º 3
0
 def testIssuerToAndFromString(self):
     """Test issuer_from_string()"""
     self.issuer.text = "http://www.example.com/test"
     self.issuer.name_qualifier = "name_qualifier"
     self.issuer.sp_name_qualifier = "sp_name_qualifier"
     new_issuer = saml.issuer_from_string(self.issuer.to_string())
     assert self.issuer.text == new_issuer.text
     assert self.issuer.name_qualifier == new_issuer.name_qualifier
     assert self.issuer.sp_name_qualifier == new_issuer.sp_name_qualifier
     assert self.issuer.extension_elements == new_issuer.extension_elements