diff options
author | Emmanuel Raviart <eraviart@entrouvert.com> | 2004-08-27 14:41:09 +0000 |
---|---|---|
committer | Emmanuel Raviart <eraviart@entrouvert.com> | 2004-08-27 14:41:09 +0000 |
commit | 497181fc6a44388a91af7f08dbe411977e75c083 (patch) | |
tree | ad6b587bf01cce9f2718270061c75ee0f020eafe /python | |
parent | eaa4b813fcd0f7aa1152d98998afe5b59556142f (diff) | |
download | lasso-497181fc6a44388a91af7f08dbe411977e75c083.tar.gz lasso-497181fc6a44388a91af7f08dbe411977e75c083.tar.xz lasso-497181fc6a44388a91af7f08dbe411977e75c083.zip |
Corrected SWIG binding.
Corrected Python tests.
Diffstat (limited to 'python')
-rw-r--r-- | python/lasso.py | 11 | ||||
-rw-r--r-- | python/tests/login_tests.py | 21 |
2 files changed, 26 insertions, 6 deletions
diff --git a/python/lasso.py b/python/lasso.py index cd03230a..6d1a4e73 100644 --- a/python/lasso.py +++ b/python/lasso.py @@ -187,13 +187,16 @@ class _ObjectMixin(object): def _setRegisteredClass(instance): - cls = _registeredClasses.get(instance.__class__, None) - if cls is None and instance.__class__.__name__.endswith('Ptr'): - cls = _registeredClasses.get(instance.__class__.__bases__[0], None) + try: + instanceClass = instance.__class__ + except AttributeError: + return + cls = _registeredClasses.get(instanceClass, None) + if cls is None and instanceClass.__name__.endswith('Ptr'): + cls = _registeredClasses.get(instanceClass.__bases__[0], None) if cls is not None: object.__setattr__(instance, '__class__', cls) - def registerClass(cls): assert cls.lassomodClass _registeredClasses[cls.lassomodClass] = cls diff --git a/python/tests/login_tests.py b/python/tests/login_tests.py index 4ecb7b25..614ea4cc 100644 --- a/python/tests/login_tests.py +++ b/python/tests/login_tests.py @@ -43,7 +43,24 @@ except NameError: class LoginTestCase(unittest.TestCase): - pass + def test01(self): + """SP login; testing access to authentication request.""" + + lassoServer = lasso.Server( + os.path.join(dataDir, 'sp1-la/metadata.xml'), + None, # os.path.join(dataDir, 'sp1-la/public-key.pem') is no more used + os.path.join(dataDir, 'sp1-la/private-key-raw.pem'), + os.path.join(dataDir, 'sp1-la/certificate.pem'), + lasso.signatureMethodRsaSha1) + lassoServer.add_provider( + os.path.join(dataDir, 'idp1-la/metadata.xml'), + os.path.join(dataDir, 'idp1-la/public-key.pem'), + os.path.join(dataDir, 'idp1-la/certificate.pem')) + login = lasso.Login(lassoServer) + login.init_authn_request(lasso.httpMethodRedirect) + self.failUnlessEqual(login.request_type, lasso.messageTypeAuthnRequest) + login.authn_request + login.authn_request.set_protocolProfile(lasso.libProtocolProfileBrwsArt) class LogoutTestCase(unittest.TestCase): @@ -107,7 +124,7 @@ class DefederationTestCase(unittest.TestCase): except lasso.Error, error: pass else: - fail('Defederation process_notification_msg should have failed.') + self.fail('Defederation process_notification_msg should have failed.') suite1 = unittest.makeSuite(LoginTestCase, 'test') |