From 34013a6092c2cd22138eb882355a69126b662096 Mon Sep 17 00:00:00 2001 From: Emmanuel Raviart Date: Sun, 5 Sep 2004 09:13:58 +0000 Subject: Changed Python exceptions generated by SWIG. --- python/tests/errorchecking_tests.py | 2 +- python/tests/profiles_tests.py | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'python/tests') diff --git a/python/tests/errorchecking_tests.py b/python/tests/errorchecking_tests.py index 6dac359f..a27ee9ec 100644 --- a/python/tests/errorchecking_tests.py +++ b/python/tests/errorchecking_tests.py @@ -68,7 +68,7 @@ class ErrorCheckingTestCase(unittest.TestCase): login = lasso.Login(server) try: login.initFromAuthnRequestMsg("", lasso.httpMethodRedirect) - except: + except lasso.Error: pass diff --git a/python/tests/profiles_tests.py b/python/tests/profiles_tests.py index 211920b0..bfbbd79e 100755 --- a/python/tests/profiles_tests.py +++ b/python/tests/profiles_tests.py @@ -109,9 +109,8 @@ class LogoutTestCase(unittest.TestCase): logout = lasso.Logout(lassoServer, lasso.providerTypeSp) try: logout.initRequest() - except RuntimeError, error: - errorCode = int(error.args[0].split(' ', 1)[0]) - if errorCode != -1: + except lasso.Error, error: + if error[0] != -1: raise else: self.fail('logout.initRequest without having set identity before should fail') @@ -149,7 +148,7 @@ class LogoutTestCase(unittest.TestCase): # The processRequestMsg should fail but not abort. try: logout.processRequestMsg('passport=0&lasso=1', lasso.httpMethodRedirect) - except SyntaxError: + except lasso.SyntaxError: pass else: self.fail('Logout processRequestMsg should have failed.') @@ -171,7 +170,7 @@ class LogoutTestCase(unittest.TestCase): # The processResponseMsg should fail but not abort. try: logout.processResponseMsg('liberty=&alliance', lasso.httpMethodRedirect) - except SyntaxError: + except lasso.SyntaxError: pass else: self.fail('Logout processResponseMsg should have failed.') @@ -209,7 +208,7 @@ class DefederationTestCase(unittest.TestCase): # The processNotificationMsg should fail but not abort. try: defederation.processNotificationMsg('nonLibertyQuery=1', lasso.httpMethodRedirect) - except SyntaxError: + except lasso.SyntaxError: pass else: self.fail('Defederation processNotificationMsg should have failed.') -- cgit