From 8bf3a9d0761edf9fc1b796daf1ee03070bdd38ba Mon Sep 17 00:00:00 2001 From: Frederic Peters Date: Mon, 9 Aug 2004 16:08:29 +0000 Subject: new lack of error checking test case; not even the developer fault this time; the program got bad data; lasso segfault. --- python/tests/errorchecking_tests.py | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'python') diff --git a/python/tests/errorchecking_tests.py b/python/tests/errorchecking_tests.py index 87d689e6..717cf4c6 100644 --- a/python/tests/errorchecking_tests.py +++ b/python/tests/errorchecking_tests.py @@ -37,10 +37,35 @@ import lasso class ErrorCheckingTestCase(unittest.TestCase): def test01(self): - lasso.Login(None).msg_url + # the user should call lasso.Login.new(); but what if it doesn't ? + # An exception should be raised; the program should not segfault. + try: + lasso.Login(None).msg_url + except: + pass def test02(self): - lasso.Logout(None, lasso.providerTypeSp).msg_url + # Same as test01; replace Login by Logout + try: + lasso.Logout(None, lasso.providerTypeSp).msg_url + except: + pass + + def test03(self): + # This time; we got something wrong as query string; we pass it to + # init_from_authn_request_msg; surely it shouldn't segfault + server = lasso.Server.new( + '../../examples/data/idp-metadata.xml', + '../../examples/data/idp-public-key.pem', + '../../examples/data/idp-private-key.pem', + '../../examples/data/idp-crt.pem', + lasso.signatureMethodRsaSha1) + login = lasso.Login.new(server) + try: + login.init_from_authn_request_msg("", lasso.httpMethodRedirect) + except: + pass + suite1 = unittest.makeSuite(ErrorCheckingTestCase, 'test') -- cgit