summaryrefslogtreecommitdiffstats
path: root/python/tests
diff options
context:
space:
mode:
authorEmmanuel Raviart <eraviart@entrouvert.com>2004-07-22 10:52:11 +0000
committerEmmanuel Raviart <eraviart@entrouvert.com>2004-07-22 10:52:11 +0000
commit5c6f115243a2ec13a2e077388957fabd5d59cdfe (patch)
tree870612007ae97e63883431caee7ff446ae822aa4 /python/tests
parentdeee550561978259663cc0f1e123d6acb5835149 (diff)
downloadlasso-5c6f115243a2ec13a2e077388957fabd5d59cdfe.tar.gz
lasso-5c6f115243a2ec13a2e077388957fabd5d59cdfe.tar.xz
lasso-5c6f115243a2ec13a2e077388957fabd5d59cdfe.zip
A little more java binding and non-regression tests.
Diffstat (limited to 'python/tests')
-rw-r--r--python/tests/login_tests.py40
1 files changed, 36 insertions, 4 deletions
diff --git a/python/tests/login_tests.py b/python/tests/login_tests.py
index 258e3269..f66d0828 100644
--- a/python/tests/login_tests.py
+++ b/python/tests/login_tests.py
@@ -89,10 +89,11 @@ class LoginTestCase(unittest.TestCase):
spLoginContext.request.set_isPassive(False)
spLoginContext.request.set_nameIDPolicy(lasso.libNameIDPolicyTypeFederated)
spLoginContext.request.set_consent(lasso.libConsentObtained)
- spLoginContext.request.set_relayState("fake")
+ relayState = "fake"
+ spLoginContext.request.set_relayState(relayState)
self.failUnlessEqual(spLoginContext.build_authn_request_msg(), 0)
authnRequestUrl = spLoginContext.msg_url
- authnRequestMsg = authnRequestUrl.split("?", 1)[1]
+ authnRequestQuery = authnRequestUrl.split("?", 1)[1]
method = lasso.httpMethodRedirect
# Identity provider singleSignOn, for a user having no federation.
@@ -100,10 +101,41 @@ class LoginTestCase(unittest.TestCase):
self.failUnless(idpContextDump)
idpContext = lasso.Server.new_from_dump(idpContextDump)
idpLoginContext = lasso.Login.new(idpContext)
- self.failUnlessEqual(idpLoginContext.init_from_authn_request_msg(authnRequestMsg, method),
- 0)
+ self.failUnlessEqual(
+ idpLoginContext.init_from_authn_request_msg(authnRequestQuery, method), 0)
self.failUnless(idpLoginContext.must_authenticate())
+ userAuthenticated = True
+ authenticationMethod = lasso.samlAuthenticationMethodPassword
+ self.failUnlessEqual(idpLoginContext.protocolProfile, lasso.loginProtocolProfileBrwsArt)
+ self.failUnlessEqual(idpLoginContext.build_artifact_msg(
+ userAuthenticated, authenticationMethod, "FIXME: reauthenticateOnOrAfter",
+ lasso.httpMethodRedirect), 0)
+ responseUrl = idpLoginContext.msg_url
+ responseQuery = responseUrl.split("?", 1)[1]
+ responseMsg = idpLoginContext.response_dump
+ artifact = idpLoginContext.assertionArtifact
+ nameIdentifier = idpLoginContext.nameIdentifier
+ method = lasso.httpMethodRedirect
+
+ # Service provider assertion consumer.
+ spContextDump = self.generateServiceProviderContextDump()
+ self.failUnless(spContextDump)
+ spContext = lasso.Server.new_from_dump(spContextDump)
+ spLoginContext = lasso.Login.new(spContext)
+ self.failUnlessEqual(spLoginContext.init_request(responseQuery, method), 0)
+ self.failUnlessEqual(spLoginContext.build_request_msg(), 0)
+ soapEndpoint = spLoginContext.msg_url
+ soapRequestMsg = spLoginContext.msg_body
+
+## soapResponseMsg = self.callSoap(loginContext.msg_url, loginContext.msg_body)
+## logs.debug("soapResponseMsg = %s" % soapResponseMsg)
+## errorCode = loginContext.process_response_msg(soapResponseMsg)
+## if errorCode:
+## raise Exception("Lasso login error %s" % errorCode)
+## nameIdentifier = loginContext.nameIdentifier
+
+
suite1 = unittest.makeSuite(LoginTestCase, 'test')
allTests = unittest.TestSuite((suite1,))