def test02(self): """Get & set simple attributes of nodes.""" authnRequest = lasso.LibAuthnRequest() # Test a string attribute. self.failUnlessEqual(authnRequest.consent, None) authnRequest.consent = lasso.LIB_CONSENT_OBTAINED self.failUnlessEqual(authnRequest.consent, lasso.LIB_CONSENT_OBTAINED) authnRequest.consent = None self.failUnlessEqual(authnRequest.consent, None) # Test a renamed string attribute. self.failUnlessEqual(authnRequest.relayState, None) authnRequest.relayState = 'Hello World!' self.failUnlessEqual(authnRequest.relayState, 'Hello World!') authnRequest.relayState = None self.failUnlessEqual(authnRequest.relayState, None) # Test an integer attribute. self.failUnlessEqual(authnRequest.majorVersion, 0) authnRequest.majorVersion = 314 self.failUnlessEqual(authnRequest.majorVersion, 314) del authnRequest
def test05(self): """Get & set attributes of nodes of type XML list.""" authnRequest = lasso.LibAuthnRequest() self.failUnlessEqual(authnRequest.extension, ()) actionString1 = """\ <lib:Extension xmlns:lib="urn:liberty:iff:2003-08"> <action>do 1</action> </lib:Extension>""" actionString2 = """\ <lib:Extension xmlns:lib="urn:liberty:iff:2003-08"> <action>do 2</action> </lib:Extension>""" actionString3 = """\ <lib:Extension xmlns:lib="urn:liberty:iff:2003-08"> <action>do 3</action> </lib:Extension>""" extension = [] self.failUnlessEqual(len(extension), 0) extension.append(actionString1) self.failUnlessEqual(len(extension), 1) self.failUnlessEqual(extension[0], actionString1) self.failUnlessEqual(extension[0], actionString1) extension.append(actionString2) self.failUnlessEqual(len(extension), 2) self.failUnlessEqual(extension[0], actionString1) self.failUnlessEqual(extension[1], actionString2) extension.append(actionString3) self.failUnlessEqual(len(extension), 3) self.failUnlessEqual(extension[0], actionString1) self.failUnlessEqual(extension[1], actionString2) self.failUnlessEqual(extension[2], actionString3) authnRequest.extension = tuple(extension) self.failUnlessEqual(authnRequest.extension[0], actionString1) self.failUnlessEqual(authnRequest.extension[1], actionString2) self.failUnlessEqual(authnRequest.extension[2], actionString3) self.failUnlessEqual(extension[0], actionString1) self.failUnlessEqual(extension[1], actionString2) self.failUnlessEqual(extension[2], actionString3) del extension self.failUnlessEqual(authnRequest.extension[0], actionString1) self.failUnlessEqual(authnRequest.extension[1], actionString2) self.failUnlessEqual(authnRequest.extension[2], actionString3) extension = authnRequest.extension self.failUnlessEqual(extension[0], actionString1) self.failUnlessEqual(extension[1], actionString2) self.failUnlessEqual(extension[2], actionString3) del extension self.failUnlessEqual(authnRequest.extension[0], actionString1) self.failUnlessEqual(authnRequest.extension[1], actionString2) self.failUnlessEqual(authnRequest.extension[2], actionString3) authnRequest.extension = None self.failUnlessEqual(authnRequest.extension, ()) del authnRequest
def test06(self): """Get & set attributes of nodes of type node.""" login = lasso.Login( lasso.Server(os.path.join(dataDir, 'sp1-la/metadata.xml'), os.path.join(dataDir, 'sp1-la/private-key-raw.pem'), None, os.path.join(dataDir, 'sp1-la/certificate.pem'))) self.failUnlessEqual(login.request, None) login.request = lasso.LibAuthnRequest() login.request.consent = lasso.LIB_CONSENT_OBTAINED self.failUnlessEqual(login.request.consent, lasso.LIB_CONSENT_OBTAINED) login.request = None self.failUnlessEqual(login.request, None) del login
def test03(self): """Get & set attributes of nodes of type string list.""" authnRequest = lasso.LibAuthnRequest() self.failUnlessEqual(authnRequest.respondWith, ()) respondWith = [] self.failUnlessEqual(len(respondWith), 0) respondWith.append('first string') self.failUnlessEqual(len(respondWith), 1) self.failUnlessEqual(respondWith[0], 'first string') respondWith.append('second string') self.failUnlessEqual(len(respondWith), 2) self.failUnlessEqual(respondWith[0], 'first string') self.failUnlessEqual(respondWith[1], 'second string') respondWith.append('third string') self.failUnlessEqual(len(respondWith), 3) self.failUnlessEqual(respondWith[0], 'first string') self.failUnlessEqual(respondWith[1], 'second string') self.failUnlessEqual(respondWith[2], 'third string') authnRequest.respondWith = tuple(respondWith) self.failUnlessEqual(authnRequest.respondWith[0], 'first string') self.failUnlessEqual(authnRequest.respondWith[1], 'second string') self.failUnlessEqual(authnRequest.respondWith[2], 'third string') self.failUnlessEqual(respondWith[0], 'first string') self.failUnlessEqual(respondWith[1], 'second string') self.failUnlessEqual(respondWith[2], 'third string') del respondWith self.failUnlessEqual(authnRequest.respondWith[0], 'first string') self.failUnlessEqual(authnRequest.respondWith[1], 'second string') self.failUnlessEqual(authnRequest.respondWith[2], 'third string') respondWith = authnRequest.respondWith self.failUnlessEqual(respondWith[0], 'first string') self.failUnlessEqual(respondWith[1], 'second string') self.failUnlessEqual(respondWith[2], 'third string') del respondWith self.failUnlessEqual(authnRequest.respondWith[0], 'first string') self.failUnlessEqual(authnRequest.respondWith[1], 'second string') self.failUnlessEqual(authnRequest.respondWith[2], 'third string') authnRequest.respondWith = None self.failUnlessEqual(authnRequest.respondWith, ()) del authnRequest
def test01(self): """Create and delete nodes.""" authnRequest = lasso.LibAuthnRequest() del authnRequest
def test08(self): '''Test an integer attribute''' authnRequest = lasso.LibAuthnRequest() authnRequest.majorVersion = 314 self.failUnlessEqual(authnRequest.majorVersion, 314)