diff options
| author | Emmanuel Raviart <eraviart@entrouvert.com> | 2004-08-06 20:48:24 +0000 |
|---|---|---|
| committer | Emmanuel Raviart <eraviart@entrouvert.com> | 2004-08-06 20:48:24 +0000 |
| commit | f71f68877fb706158493fba8c8102b8d03b51430 (patch) | |
| tree | 1cf4f96648acf33cecf012b0edf3ce66d498c222 /python/tests/login_tests.py | |
| parent | e1c8d45f13552ebfbbc33763a8fcca96078eab45 (diff) | |
| download | lasso-f71f68877fb706158493fba8c8102b8d03b51430.tar.gz lasso-f71f68877fb706158493fba8c8102b8d03b51430.tar.xz lasso-f71f68877fb706158493fba8c8102b8d03b51430.zip | |
Added Python simulation for isPassive and corrected some simulation bugs.
Added isPassive tests.
Diffstat (limited to 'python/tests/login_tests.py')
| -rw-r--r-- | python/tests/login_tests.py | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/python/tests/login_tests.py b/python/tests/login_tests.py index e5f4e405..ff25037d 100644 --- a/python/tests/login_tests.py +++ b/python/tests/login_tests.py @@ -109,9 +109,11 @@ class LoginTestCase(unittest.TestCase): self.failUnlessEqual(httpResponse.statusCode, 200) httpResponse = spSite.doHttpRequest(HttpRequest(principal, 'GET', '/logoutUsingSoap')) self.failUnlessEqual(httpResponse.statusCode, 200) + self.failIf(spSite.webSessions) + self.failIf(idpSite.webSessions) def test02(self): - """Service provider initiated login using HTTP redirect and service provider initiated logout using SOAP. Done twice.""" + """Service provider initiated login using HTTP redirect and service provider initiated logout using SOAP. Done three times.""" internet = Internet() idpSite = self.generateIdpSite(internet) @@ -126,12 +128,27 @@ class LoginTestCase(unittest.TestCase): httpResponse = spSite.doHttpRequest(HttpRequest(principal, 'GET', '/logoutUsingSoap')) self.failUnlessEqual(httpResponse.statusCode, 200) - # Once again, but now the principal already has a federation between spSite and idpSite. + # Once again. Now the principal already has a federation between spSite and idpSite. httpResponse = spSite.doHttpRequest(HttpRequest(principal, 'GET', '/loginUsingRedirect')) self.failUnlessEqual(httpResponse.statusCode, 200) httpResponse = spSite.doHttpRequest(HttpRequest(principal, 'GET', '/logoutUsingSoap')) self.failUnlessEqual(httpResponse.statusCode, 200) + # Once again. Do a new passive login between normal login and logout. + httpResponse = spSite.doHttpRequest(HttpRequest(principal, 'GET', '/loginUsingRedirect')) + self.failUnlessEqual(httpResponse.statusCode, 200) + del principal.keyring[idpSite.url] # Ensure identity provider will be really passive. + httpResponse = spSite.doHttpRequest(HttpRequest( + principal, 'GET', '/loginUsingRedirect?isPassive=1')) + self.failUnlessEqual(httpResponse.statusCode, 200) + httpResponse = spSite.doHttpRequest(HttpRequest(principal, 'GET', '/logoutUsingSoap')) + self.failUnlessEqual(httpResponse.statusCode, 200) + + # Once again, with isPassive and the user having no web session. + httpResponse = spSite.doHttpRequest(HttpRequest( + principal, 'GET', '/loginUsingRedirect?isPassive=1')) + self.failUnlessEqual(httpResponse.statusCode, 401) + def test03(self): """Service provider initiated login using HTTP redirect, but user fail to authenticate himself on identity provider. Then logout, with same problem.""" @@ -165,6 +182,21 @@ class LoginTestCase(unittest.TestCase): httpResponse = spSite.doHttpRequest(HttpRequest(principal, 'GET', '/logoutUsingSoap')) self.failUnlessEqual(httpResponse.statusCode, 401) + def test05(self): + """Service provider initiated login using HTTP redirect with isPassive for a user without federation yet.""" + + internet = Internet() + idpSite = self.generateIdpSite(internet) + spSite = self.generateSpSite(internet) + spSite.idpSite = idpSite + principal = Principal(internet, 'Romain Chantereau') + principal.keyring[idpSite.url] = 'Chantereau' + principal.keyring[spSite.url] = 'Romain' + + httpResponse = spSite.doHttpRequest(HttpRequest( + principal, 'GET', '/loginUsingRedirect?isPassive=1')) + self.failUnlessEqual(httpResponse.statusCode, 401) + ## def test06(self): ## """Service provider LECP login.""" |
