diff options
author | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-01-28 15:31:49 +0000 |
---|---|---|
committer | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-01-28 15:31:49 +0000 |
commit | 1dab7b59e5f36ef0a5cfed124a3a2f5d549d82ce (patch) | |
tree | 014771b1f67344ee8ad19807f541f73eb357f7ea /bindings/python/tests/idwsf2_tests.py | |
parent | a1ae48d2ef48492faafd26464e64e2dccd0d8565 (diff) | |
download | lasso-1dab7b59e5f36ef0a5cfed124a3a2f5d549d82ce.tar.gz lasso-1dab7b59e5f36ef0a5cfed124a3a2f5d549d82ce.tar.xz lasso-1dab7b59e5f36ef0a5cfed124a3a2f5d549d82ce.zip |
Bindings: java, php5, python simplify logic in binding generator
* use utils.h macros to manipulate fields.
* use utils.py function to filter variables, argument and return types.
* finish support of hashtables of strings for php5 and python.
Diffstat (limited to 'bindings/python/tests/idwsf2_tests.py')
-rwxr-xr-x | bindings/python/tests/idwsf2_tests.py | 80 |
1 files changed, 16 insertions, 64 deletions
diff --git a/bindings/python/tests/idwsf2_tests.py b/bindings/python/tests/idwsf2_tests.py index fd98ef5e..39ce9fde 100755 --- a/bindings/python/tests/idwsf2_tests.py +++ b/bindings/python/tests/idwsf2_tests.py @@ -42,6 +42,7 @@ try: except NameError: dataDir = os.path.join(os.environ['TOP_SRCDIR'], 'tests', 'data') +disco_soap_url = 'http://idp1/soapEndpoint' class IdWsf2TestCase(unittest.TestCase): def getWspServer(self): @@ -82,29 +83,28 @@ class IdWsf2TestCase(unittest.TestCase): return server - def idpRegisterSelf(self, idp_server): - disco = lasso.IdWsf2Discovery(idp_server) - service_type = lasso.IDWSF2_DISCO_HREF - abstract = 'Disco service' - soapEndpoint = 'http://idp1/soapEndpoint' - disco.metadataRegisterSelf(service_type, abstract, soapEndpoint) - - return idp_server def metadataRegister(self, wsp, idp): wsp_disco = lasso.IdWsf2Discovery(wsp) abstract = 'Personal Profile service' soapEndpoint = 'http://idp1/soapEndpoint' - wsp_disco.initMetadataRegister( - 'urn:liberty:id-sis-pp:2005-05', abstract, wsp.providerIds[0], soapEndpoint) + wsp_disco.initMetadataRegister() + wsp_disco.addSimpleServiceMetadata( + service_types = ['urn:liberty:id-sis-pp:2005-05'], + abstract = abstract, provider_id = wsp.providerIds[0], + address = soapEndpoint) wsp_disco.buildRequestMsg() idp_disco = lasso.IdWsf2Discovery(idp) - idp_disco.processMetadataRegisterMsg(wsp_disco.msgBody) + idp_disco.processRequestMsg(wsp_disco.msgBody) + idp_disco.validateRequestMsg() + assert(len(idp_disco.metadatas) = 1) + assert(idp_disco.metadatas[0].svcMDID == idp_disco.response.SvcMDID[0]) idp_disco.buildResponseMsg() - wsp_disco.processMetadataRegisterResponseMsg(idp_disco.msgBody) - return idp, wsp_disco.svcMDIDs[0] + assert(len(wsp_disco.metadatas) = 1) + assert(wsp_disco.metadatas[0].svcMDID == wsp_disco.response.SvcMDID[0]) + return idp, wsp_disco.metadatas[0].svcMDID def login(self, sp, idp, sp_identity_dump=None, sp_session_dump=None, idp_identity_dump=None, idp_session_dump=None): @@ -124,6 +124,7 @@ class IdWsf2TestCase(unittest.TestCase): idp_login.processAuthnRequestMsg(query) idp_login.validateRequestMsg(True, True) idp_login.buildAssertion(lasso.SAML_AUTHENTICATION_METHOD_PASSWORD, None, None, None, None) + idp_login.idwsf2AddDiscoveryBootstrapEpr(url = disco_soap_url, abstract = 'Discovery Service', security_mech_id = lasso.SECURITY_MECH_NULL) idp_login.buildArtifactMsg(lasso.HTTP_METHOD_ARTIFACT_GET) artifact_message = idp_login.artifactMessage @@ -150,55 +151,7 @@ class IdWsf2TestCase(unittest.TestCase): if sp_login.isSessionDirty: sp_session_dump = sp_login.session.dump() - return sp_identity_dump, sp_session_dump, idp_identity_dump, idp_session_dump - - -class IdpSelfRegistrationTestCase(IdWsf2TestCase): - def test01(self): - """Register IdP as Dicovery Service and get a random svcMDID""" - - disco = lasso.IdWsf2Discovery(self.getIdpServer()) - - service_type = lasso.IDWSF2_DISCO_HREF - abstract = 'Disco service' - soapEndpoint = 'http://idp1/soapEndpoint' - - svcMDID = disco.metadataRegisterSelf(service_type, abstract, soapEndpoint) - # In real use, store the server dump here - - self.failUnless(svcMDID, 'missing svcMDID') - - def test02(self): - """Register IdP as Dicovery Service with a given svcMDID""" - - disco = lasso.IdWsf2Discovery(self.getIdpServer()) - - service_type = lasso.IDWSF2_DISCO_HREF - abstract = 'Disco service' - soapEndpoint = 'http://idp1/soapEndpoint' - mySvcMDID = 'RaNdOm StRiNg' - - svcMDID = disco.metadataRegisterSelf(service_type, abstract, soapEndpoint, mySvcMDID) - # In real use, store the server dump here - - self.failUnless(svcMDID, 'missing svcMDID') - self.failUnlessEqual(svcMDID, mySvcMDID, 'wrong svcMDID') - - def test03(self): - """Register IdP as Dicovery Service with wrong parameters""" - - disco = lasso.IdWsf2Discovery(self.getIdpServer()) - - service_type = '' - abstract = '' - soapEndpoint = '' - - try: - svcMDID = disco.metadataRegisterSelf(service_type, abstract, soapEndpoint) - except lasso.ParamBadTypeOrNullObjError: - pass - else: - self.fail('metadataRegisterSelf should fail with a ParamBadTypeOrNullObjError') + return sp_identity_dump, sp_session_dump, idp_identity_dump, idp_session_dump, sp_login.idwsf2GetDiscoveryBootstrapEpr() class MetadataRegisterTestCase(IdWsf2TestCase): @@ -1786,13 +1739,12 @@ class DataServiceQueryTestCase(IdWsf2TestCase): self.failUnless(email_strings[1] == email2) -idpSelfRegistrationSuite = unittest.makeSuite(IdpSelfRegistrationTestCase, 'test') metadataRegisterSuite = unittest.makeSuite(MetadataRegisterTestCase, 'test') metadataAssociationAddSuite = unittest.makeSuite(MetadataAssociationAddTestCase, 'test') discoveryQuerySuite = unittest.makeSuite(DiscoveryQueryTestCase, 'test') dataServiceQuerySuite = unittest.makeSuite(DataServiceQueryTestCase, 'test') -allTests = unittest.TestSuite((idpSelfRegistrationSuite, metadataRegisterSuite, +allTests = unittest.TestSuite((metadataRegisterSuite, metadataAssociationAddSuite, discoveryQuerySuite, dataServiceQuerySuite)) if __name__ == '__main__': |