[Erp5-report] r41631 seb - /erp5/trunk/products/ERP5Catalog/tests/testArchive.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Dec 21 23:28:52 CET 2010
Author: seb
Date: Tue Dec 21 23:28:52 2010
New Revision: 41631
URL: http://svn.erp5.org?rev=41631&view=rev
Log:
use a zsql method instead of calling manage_test directly,
this allows to go further than the default limit to 1000,
and this fix unit test failure
Modified:
erp5/trunk/products/ERP5Catalog/tests/testArchive.py
Modified: erp5/trunk/products/ERP5Catalog/tests/testArchive.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Catalog/tests/testArchive.py?rev=41631&r1=41630&r2=41631&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Catalog/tests/testArchive.py [utf8] (original)
+++ erp5/trunk/products/ERP5Catalog/tests/testArchive.py [utf8] Tue Dec 21 23:28:52 2010
@@ -88,16 +88,28 @@ class TestArchive(InventoryAPITestCase):
user = uf.getUserById('seb').__of__(uf)
newSecurityManager(None, user)
- def getSQLPathList(self,connection_id=None):
+ def getSQLPathList(self,connection_id='erp5_sql_connection'):
"""
Give the full list of path in the catalog
"""
- if connection_id is None:
- sql_connection = self.getSQLConnection()
- else:
- sql_connection = getattr(self.getPortal(),connection_id)
- sql = 'select path from catalog'
- result = sql_connection.manage_test(sql)
+ portal = self.getPortal()
+ zsql_method_id = "Base_zGetTestPath"
+ portal_skins_custom = self.getPortal().portal_skins.custom
+ zsql_method = getattr(portal_skins_custom, zsql_method_id, None)
+ if zsql_method is None:
+ portal_skins_custom.manage_addProduct['ZSQLMethods']\
+ .manage_addZSQLMethod(
+ id = zsql_method_id,
+ title = '',
+ connection_id = connection_id,
+ arguments = "",
+ template = "select path from catalog")
+ zsql_method = portal_skins_custom[zsql_method_id]
+ zsql_method.max_rows_ = 0
+ # it is mandatory to provide connection_id, or the
+ # zsql method will look at preference and use the one
+ # defined by the archive
+ result = zsql_method(connection_id=connection_id)
path_list = map(lambda x: x['path'],result)
return path_list
More information about the Erp5-report
mailing list