Commit f250fc3f authored by Julien Muchembled's avatar Julien Muchembled

Unit tests: recognize 'erp5_sql_deferred_connection_string' environment variable

If not specified, erp5_sql_deferred_connection is configured like
erp5_sql_connection.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36451 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a8172cde
......@@ -233,23 +233,19 @@ def _getConnectionStringDict():
"""Returns the connection strings used for this test.
"""
connection_string_dict = {}
erp5_sql_connection_string = os.environ.get(
'erp5_sql_connection_string')
if erp5_sql_connection_string:
connection_string_dict['erp5_sql_connection_string'] = \
erp5_sql_connection_string
cmf_activity_sql_connection_string = os.environ.get(
'cmf_activity_sql_connection_string',
os.environ.get('erp5_sql_connection_string'))
if cmf_activity_sql_connection_string:
connection_string_dict['cmf_activity_sql_connection_string'] = \
cmf_activity_sql_connection_string
erp5_sql_transactionless_connection_string = os.environ.get(
'erp5_sql_transactionless_connection_string',
'-%s' % cmf_activity_sql_connection_string)
if erp5_sql_transactionless_connection_string:
connection_string_dict['erp5_sql_transactionless_connection_string'] = \
erp5_sql_transactionless_connection_string
default = os.environ.get('erp5_sql_connection_string')
for connection in ('erp5_sql_connection_string',
'erp5_sql_deferred_connection_string',
# default value for transactionless is derived from value
# for cmf_activity, so process it last
'cmf_activity_sql_connection_string'):
connection_string = os.environ.get(connection, default)
if connection_string:
connection_string_dict[connection] = connection_string
connection = 'erp5_sql_transactionless_connection_string'
if os.environ.get(connection, connection_string):
connection_string_dict[connection] = \
os.environ.get(connection, '-' + connection_string)
return connection_string_dict
def _getConversionServerDict():
......@@ -898,10 +894,10 @@ class ERP5TypeTestCase(ProcessingNodeTestCase, PortalTestCase):
ZopeTestCase._print('Adding %s ERP5 Site ... ' % portal_name)
extra_constructor_kw = _getConnectionStringDict()
# manage_addERP5Site does not accept
# erp5_sql_transactionless_connection_string argument
extra_constructor_kw.pop(
'erp5_sql_transactionless_connection_string', None)
# manage_addERP5Site does not accept the following 2 arguments
for k in ('erp5_sql_deferred_connection_string',
'erp5_sql_transactionless_connection_string'):
extra_constructor_kw.pop(k, None)
email_from_address = os.environ.get('email_from_address')
if email_from_address is not None:
extra_constructor_kw['email_from_address'] = email_from_address
......
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