summaryrefslogtreecommitdiffstats
path: root/python/tests
diff options
context:
space:
mode:
authorEmmanuel Raviart <eraviart@entrouvert.com>2004-07-22 08:37:09 +0000
committerEmmanuel Raviart <eraviart@entrouvert.com>2004-07-22 08:37:09 +0000
commitc2dc90e2e99a83a1d80042c0405ecba94ad01845 (patch)
tree329fb42f4f50fedf6c52d98d4fc1a5cd840c507c /python/tests
parent255f09ed98f1e554093dce03c384bf5c4dbea091 (diff)
downloadlasso-c2dc90e2e99a83a1d80042c0405ecba94ad01845.tar.gz
lasso-c2dc90e2e99a83a1d80042c0405ecba94ad01845.tar.xz
lasso-c2dc90e2e99a83a1d80042c0405ecba94ad01845.zip
Java & Python tests do not regress. They even progress.
Diffstat (limited to 'python/tests')
-rw-r--r--python/tests/.cvsignore1
-rw-r--r--python/tests/login_tests.py25
2 files changed, 20 insertions, 6 deletions
diff --git a/python/tests/.cvsignore b/python/tests/.cvsignore
new file mode 100644
index 00000000..0d20b648
--- /dev/null
+++ b/python/tests/.cvsignore
@@ -0,0 +1 @@
+*.pyc
diff --git a/python/tests/login_tests.py b/python/tests/login_tests.py
index 6d88588c..258e3269 100644
--- a/python/tests/login_tests.py
+++ b/python/tests/login_tests.py
@@ -77,19 +77,32 @@ class LoginTestCase(unittest.TestCase):
self.failUnless(serviceProviderContextDump)
def test02_serviceProviderLogin(self):
+ """Service provider initiated login"""
+
+ # Service provider login using HTTP redirect.
spContextDump = self.generateServiceProviderContextDump()
self.failUnless(spContextDump)
spContext = lasso.Server.new_from_dump(spContextDump)
spLoginContext = lasso.Login.new(spContext)
- self.failIf(spLoginContext.init_authn_request(
- "https://identity-provider:1998/liberty-alliance/metadata"))
+ self.failUnlessEqual(spLoginContext.init_authn_request(
+ "https://identity-provider:1998/liberty-alliance/metadata"), 0)
spLoginContext.request.set_isPassive(False)
spLoginContext.request.set_nameIDPolicy(lasso.libNameIDPolicyTypeFederated)
- # FIXME spLoginContext.request.set_consent(lasso.libConsentObtained)
+ spLoginContext.request.set_consent(lasso.libConsentObtained)
spLoginContext.request.set_relayState("fake")
- self.failIf(spLoginContext.build_authn_request_msg())
- # spLoginContext.msg_url
-
+ self.failUnlessEqual(spLoginContext.build_authn_request_msg(), 0)
+ authnRequestUrl = spLoginContext.msg_url
+ authnRequestMsg = authnRequestUrl.split("?", 1)[1]
+ method = lasso.httpMethodRedirect
+
+ # Identity provider singleSignOn, for a user having no federation.
+ idpContextDump = self.generateIdentityProviderContextDump()
+ 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.failUnless(idpLoginContext.must_authenticate())
suite1 = unittest.makeSuite(LoginTestCase, 'test')