def testAccessors(self): """Test for AuthnStatement accessors""" self.authn_statem.authn_instant = "2007-08-31T01:05:02Z" self.authn_statem.session_not_on_or_after = "2007-09-14T01:05:02Z" self.authn_statem.session_index = "sessionindex" self.authn_statem.authn_context = saml.AuthnContext() self.authn_statem.authn_context.authn_context_class_ref = saml.authn_context_class_ref_from_string( saml2_data.TEST_AUTHN_CONTEXT_CLASS_REF ) self.authn_statem.authn_context.authn_context_decl_ref = saml.authn_context_decl_ref_from_string( saml2_data.TEST_AUTHN_CONTEXT_DECL_REF ) self.authn_statem.authn_context.authn_context_decl = saml.authn_context_decl_from_string( saml2_data.TEST_AUTHN_CONTEXT_DECL ) self.authn_statem.authn_context.authenticating_authority.append( saml.authenticating_authority_from_string(saml2_data.TEST_AUTHENTICATING_AUTHORITY) ) new_as = saml.authn_statement_from_string(self.authn_statem.to_string()) assert new_as.authn_instant == "2007-08-31T01:05:02Z" assert new_as.session_index == "sessionindex" assert new_as.session_not_on_or_after == "2007-09-14T01:05:02Z" assert ( new_as.authn_context.authn_context_class_ref.text.strip() == "http://www.example.com/authnContextClassRef" ) assert new_as.authn_context.authn_context_decl_ref.text.strip() == "http://www.example.com/authnContextDeclRef" assert new_as.authn_context.authn_context_decl.text.strip() == "http://www.example.com/authnContextDecl" assert ( new_as.authn_context.authenticating_authority[0].text.strip() == "http://www.example.com/authenticatingAuthority" ) assert self.authn_statem.to_string() == new_as.to_string()
def testAccessors(self): """Test for AuthnContextClassRef accessors""" self.authn_context_class_ref.text = self.text assert self.authn_context_class_ref.text == self.text new_authn_context_class_ref = saml.authn_context_class_ref_from_string(self.authn_context_class_ref.to_string()) assert new_authn_context_class_ref.text == self.text assert self.authn_context_class_ref.to_string() == new_authn_context_class_ref.to_string()
def testAccessors(self): """Test for AuthnContext accessors""" self.authn_context.authn_context_class_ref = saml.authn_context_class_ref_from_string( saml2_data.TEST_AUTHN_CONTEXT_CLASS_REF ) self.authn_context.authn_context_decl_ref = saml.authn_context_decl_ref_from_string( saml2_data.TEST_AUTHN_CONTEXT_DECL_REF ) self.authn_context.authn_context_decl = saml.authn_context_decl_from_string(saml2_data.TEST_AUTHN_CONTEXT_DECL) self.authn_context.authenticating_authority.append( saml.authenticating_authority_from_string(saml2_data.TEST_AUTHENTICATING_AUTHORITY) ) assert self.authn_context.authn_context_class_ref.text.strip() == "http://www.example.com/authnContextClassRef" assert self.authn_context.authn_context_decl_ref.text.strip() == "http://www.example.com/authnContextDeclRef" assert self.authn_context.authn_context_decl.text.strip() == "http://www.example.com/authnContextDecl" assert ( self.authn_context.authenticating_authority[0].text.strip() == "http://www.example.com/authenticatingAuthority" ) new_authn_context = saml.authn_context_from_string(self.authn_context.to_string()) assert self.authn_context.to_string() == new_authn_context.to_string()
def testUsingTestData(self): """Test authn_context_class_ref_from_string() using test data""" authn_context_class_ref = saml.authn_context_class_ref_from_string(saml2_data.TEST_AUTHN_CONTEXT_CLASS_REF) assert authn_context_class_ref.text.strip() == self.text