Commit a2812818 authored by Nicolas Dumazet's avatar Nicolas Dumazet

- add a 'SQL Connection String' field to the UnitTestRun Dialog.

- pass the value of this field to the test runner (--erp5_sql_connection_string)
- add a system preference to set a default value for that field


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29667 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e32d6db7
......@@ -96,6 +96,12 @@ class DocumentPreference:
'write_permission': 'Manage properties',
'preference' : 1,
'mode' : '' },
{ 'id' : 'preferred_unit_test_sql_connection_string',
'description' : 'Preferred Unit Test SQL Connection String',
'type' : 'string',
'write_permission': 'Manage properties',
'preference' : 1,
'mode' : '' },
)
# vim: shiftwidth=2
......
......@@ -439,6 +439,7 @@ class TemplateTool (BaseTool):
security.declareProtected(Permissions.ManagePortal, 'runUnitTestList')
def runUnitTestList(self, test_list=[],
sql_connection_string='',
REQUEST=None, RESPONSE=None, **kwd):
"""Runs Unit Tests related to this Business Template
"""
......@@ -454,6 +455,8 @@ class TemplateTool (BaseTool):
if RESPONSE is not None:
RESPONSE.setHeader('Content-type', 'text/plain')
test_cmd_args = [sys.executable, getUnitTestFile()]
test_cmd_args.append('--erp5_sql_connection_string="%s"'
% sql_connection_string)
test_cmd_args += test_list
process = subprocess.Popen(test_cmd_args,
stdout=subprocess.PIPE,
......
......@@ -65,6 +65,7 @@
<value>
<list>
<string>my_test_list</string>
<string>my_sql_connection_string</string>
</list>
</value>
</item>
......
......@@ -76,6 +76,7 @@
<list>
<string>my_title</string>
<string>my_description</string>
<string>my_preferred_unit_test_sql_connection_string</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>description</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_preferred_unit_test_sql_connection_string</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Connection String to be used to run Unit Tests</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Unit Test SQL Connection String</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.getPreferredUnitTestSqlConnectionString() or preferences.getPreferredUnitTestSqlConnectionString()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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