diff options
| author | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-01-04 09:13:36 +0000 |
|---|---|---|
| committer | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-01-04 09:13:36 +0000 |
| commit | 5224c7cf675d6c8b2df9b3f4b43f8cd8d4eb8184 (patch) | |
| tree | fc571c8d011bd0b73d932601e0b026f338e5d675 /bindings/python/tests | |
| parent | 42062ff986a344f3f33a4465e106fede10aeaa6a (diff) | |
| download | lasso-5224c7cf675d6c8b2df9b3f4b43f8cd8d4eb8184.tar.gz lasso-5224c7cf675d6c8b2df9b3f4b43f8cd8d4eb8184.tar.xz lasso-5224c7cf675d6c8b2df9b3f4b43f8cd8d4eb8184.zip | |
Bindings: make the binding infrastructure understand GObject-introspections annotations
* bindings/bindings.py
* bindings/utils.py:
add convenience function to treat arguments tuple:
(type,name,{annotations}).
introduce new argument options, fix that arguments are 3-tuple of the
form (type,name,annotations), where annotations is a dictionary.
Key of this dictionnary can be:
- optional, wheter the argument is necessary, it means it has a
default value.
- out, means that the pointer is a pointer of pointer, for bindings
that can return exceptions, it will be returned instead of the
integer error code, the only way to access error codes will be
exceptions.
- element-type, contained type of a list or an array,
- key-type, value-type, type of respectively the key and value of a
GHashTable.
- transfer, wheter a the callee(for arguments)/caller(for return
values) owns the values passed, it can be none,container(if the
callee/caller only owns the container not the contained value) or
full.
doc.parameters is now a 3-tuple of (attribute-name,
attribute-description, attribute-annotations) where
attribute-annotations is a string of the form '(option1)(option2
option-arguments) etc.'.
- add predicates for xml, list and time_t values. improve predicates
for cstring and const modifier.
* bindings/overrides.xml:
'out' arguments are not well supported for java, so skip functions
using them.
* bindings/java/lang.py bindings/php5/php_code.py
bindings/php5/wrapper_source.py bindings/python/lang.py:
- update language specifig binding generators for handling new
annotations.
- improve python method declaration, handle optional arguments with
default values, factorize this chode in two methods,
get_python_arg_decl and defval_to_python_value.
* bindings/python/tests/Makefile.am
bindings/python/tests/idwsf1_tests.py
bindings/python/tests/idwsf2_tests.py:
make test work with out of source build dir.
Diffstat (limited to 'bindings/python/tests')
| -rw-r--r-- | bindings/python/tests/Makefile.am | 2 | ||||
| -rwxr-xr-x | bindings/python/tests/idwsf1_tests.py | 41 | ||||
| -rwxr-xr-x | bindings/python/tests/idwsf2_tests.py | 2 |
3 files changed, 30 insertions, 15 deletions
diff --git a/bindings/python/tests/Makefile.am b/bindings/python/tests/Makefile.am index 64dfc090..c2130fb3 100644 --- a/bindings/python/tests/Makefile.am +++ b/bindings/python/tests/Makefile.am @@ -1,6 +1,8 @@ MAINTAINERCLEANFILES = Makefile.in TESTS = # +TESTS_ENVIRONMENT=TOP_SRCDIR=$(top_srcdir) + if PYTHON_ENABLED TESTS += profiles_tests.py binding_tests.py endif diff --git a/bindings/python/tests/idwsf1_tests.py b/bindings/python/tests/idwsf1_tests.py index a2f26b83..a37cd838 100755 --- a/bindings/python/tests/idwsf1_tests.py +++ b/bindings/python/tests/idwsf1_tests.py @@ -36,7 +36,7 @@ import lasso try: dataDir except NameError: - dataDir = '../../../tests/data' + dataDir = os.path.join(os.environ['TOP_SRCDIR'], 'tests', 'data') wsp_metadata = os.path.join(dataDir, 'sp1-la/metadata.xml') wsp_private_key = os.path.join(dataDir, 'sp1-la/private-key-raw.pem') @@ -51,6 +51,12 @@ idp_public_key = os.path.join(dataDir, 'idp1-la/public-key.pem') abstract_description = "Personal Profile Resource" resource_id = "http://idp/user/resources/1" +def __LINE__(): + try: + raise Exception + except: + return sys.exc_info()[2].tb_frame.f_back.f_lineno + class IdWsf1TestCase(unittest.TestCase): def get_wsp_server(self): server = lasso.Server(wsp_metadata, wsp_private_key, None, None) @@ -144,7 +150,7 @@ class IdWsf1TestCase(unittest.TestCase): # Process query idp_disco = lasso.Discovery(self.idp) - idp_disco.processQueryMsg(wsc_disco.msgBody) + idp_disco.processRequestMsg(wsc_disco.msgBody) idp_disco.setIdentityFromDump(idp_identity_dump) idp_disco.getIdentity().addResourceOffering(self.get_resource_offering()) idp_disco.buildResponseMsg() @@ -158,10 +164,12 @@ class DiscoveryQueryTestCase(IdWsf1TestCase): '''Test a discovery query''' service = self.get_pp_service() # Check service attributes - self.failUnless(service.resourceId is not None) - self.failUnless(service.resourceId.content == resource_id) - self.failUnless(service.providerId == self.wsc.providerIds[0]) - self.failUnless(service.abstractDescription == abstract_description) + resource_offering = service.getResourceOffering() + self.failUnless(resource_offering is not None) + self.failUnless(resource_offering.resourceId is not None) + self.failUnless(resource_offering.resourceId.content == resource_id) + self.failUnless(resource_offering.serviceInstance.providerId == self.wsc.providerIds[0]) + self.failUnless(resource_offering.abstract == abstract_description) class DiscoveryModifyTestCase(IdWsf1TestCase): def test01(self): @@ -177,16 +185,18 @@ class DiscoveryModifyTestCase(IdWsf1TestCase): wsp_disco = lasso.Discovery(self.wsp) wsp_disco.setIdentityFromDump(sp_identity_dump) wsp_disco.setSessionFromDump(sp_session_dump) - wsp_disco.initInsert(self.get_resource_offering()) + resource_offering = self.get_resource_offering() + wsp_disco.initModify() + wsp_disco.addInsertEntry(resource_offering.serviceInstance, resource_offering.resourceId) wsp_disco.buildRequestMsg() # Process Modify request_type = lasso.getRequestTypeFromSoapMsg(wsp_disco.msgBody) self.failUnless(request_type == lasso.REQUEST_TYPE_DISCO_MODIFY) idp_disco = lasso.Discovery(self.idp) - idp_disco.processModifyMsg(wsp_disco.msgBody) + idp_disco.processRequestMsg(wsp_disco.msgBody) idp_disco.setIdentityFromDump(idp_identity_dump) - idp_disco.buildModifyResponseMsg() + idp_disco.buildResponseMsg() offerings = idp_disco.identity.getOfferings() self.failUnless('<disco:Status code="OK"/>' in idp_disco.msgBody) self.failUnless('<disco:ModifyResponse newEntryIDs="%s"' % offerings[0].entryId in idp_disco.msgBody) @@ -211,20 +221,21 @@ class DiscoveryRemoveTestCase(IdWsf1TestCase): wsp_disco = lasso.Discovery(self.wsp) wsp_disco.setIdentityFromDump(sp_identity_dump) wsp_disco.setSessionFromDump(sp_session_dump) - wsp_disco.initRemove('0') + wsp_disco.initModify() + wsp_disco.addRemoveEntry('0') wsp_disco.buildRequestMsg() # Process Modify request_type = lasso.getRequestTypeFromSoapMsg(wsp_disco.msgBody) self.failUnless(request_type == lasso.REQUEST_TYPE_DISCO_MODIFY) idp_disco = lasso.Discovery(self.idp) - idp_disco.processModifyMsg(wsp_disco.msgBody) + idp_disco.processRequestMsg(wsp_disco.msgBody) idp_disco.setIdentityFromDump(idp_identity_dump) offering = self.get_resource_offering() idp_disco.getIdentity().addResourceOffering(offering) self.failUnless('<disco:ServiceType>urn:liberty:id-sis-pp:2003-08</disco:ServiceType>' in idp_disco.identity.dump()) - idp_disco.buildModifyResponseMsg() + idp_disco.buildResponseMsg() self.failUnless('<disco:Status code="OK"/>' in idp_disco.msgBody) self.failIf('<disco:ServiceType>urn:liberty:id-sis-pp:2003-08</disco:ServiceType>' in idp_disco.identity.dump()) @@ -237,17 +248,19 @@ class DataServiceQueryTestCase(IdWsf1TestCase): '''Test a data service query''' wsc_service = self.get_pp_service() wsc_service.initQuery('/pp:PP/pp:InformalName', 'name') - wsc_service.buildRequestMsg() + wsc_service.buildSoapRequestMsg() self.failUnless(lasso.getRequestTypeFromSoapMsg(wsc_service.msgBody) == lasso.REQUEST_TYPE_DST_QUERY) self.wsp = self.get_wsp_server() wsp_service = lasso.DataService(self.wsp) - wsp_service.processQueryMsg(wsc_service.msgBody) + wsp_service.processRequestMsg(wsc_service.msgBody) + self.failUnless(isinstance(wsp_service.request, lasso.DstQuery)) wsp_service.resourceData = ''' <PP xmlns="urn:liberty:id-sis-pp:2003-08"> <InformalName>Damien</InformalName> </PP>''' + wsp_service.validateRequest() wsp_service.buildResponseMsg() wsc_service.processQueryResponseMsg(wsp_service.msgBody) diff --git a/bindings/python/tests/idwsf2_tests.py b/bindings/python/tests/idwsf2_tests.py index bbc66c5d..aff03816 100755 --- a/bindings/python/tests/idwsf2_tests.py +++ b/bindings/python/tests/idwsf2_tests.py @@ -40,7 +40,7 @@ import lasso try: dataDir except NameError: - dataDir = '../../../tests/data' + dataDir = os.path.join(os.environ['TOP_SRCDIR'], 'tests', 'data') class IdWsf2TestCase(unittest.TestCase): |
