Commit a3c40d0b authored by Arnaud Fontaine's avatar Arnaud Fontaine

runUnitTest: 6f1c45c6 wrongly assumed that '--erp5_sql_connection_string' is always passed.

This is the case with runUnitTest wrapper created by SlapOS but is not actually required
as manage_addERP5Site has 'test test' as default value.

This fixes:
  File "custom_zodb.py", line 70, in <module>
    sql_db = Products.ZMySQLDA.db.DB(os.environ['erp5_sql_connection_string'])
  File "UserDict.py", line 40, in __getitem__
    raise KeyError(key)
KeyError: 'erp5_sql_connection_string'
parent c0b8e03e
......@@ -58,6 +58,8 @@ def manage_addERP5SiteForm(*args, **kw):
kw['getCatalogStorageList'] = getCatalogStorageList
return manage_addERP5SiteFormDtml(*args, **kw)
default_sql_connection_string = 'test test'
# ERP5Site Constructor
def manage_addERP5Site(self,
id,
......@@ -69,8 +71,8 @@ def manage_addERP5Site(self,
email_from_name='Portal Administrator',
validate_email=0,
erp5_catalog_storage='erp5_mysql_innodb_catalog',
erp5_sql_connection_string='test test',
cmf_activity_sql_connection_string='test test',
erp5_sql_connection_string=default_sql_connection_string,
cmf_activity_sql_connection_string=default_sql_connection_string,
bt5_repository_url='',
bt5='',
id_store_interval='',
......
......@@ -66,7 +66,9 @@ else:
# must be cleared of data from previous execution if any
_print("Catalog will be recreated to clear data (if any) from previous execution")
import Products.ZMySQLDA.db
sql_db = Products.ZMySQLDA.db.DB(os.environ['erp5_sql_connection_string'])
from Products.ERP5.ERP5Site import default_sql_connection_string
sql_db = Products.ZMySQLDA.db.DB(os.environ.get('erp5_sql_connection_string',
default_sql_connection_string))
table_list = sql_db.tables()
if table_list:
sql_db.query('DROP TABLE ' +
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment