Commit 30066147 authored by Jérome Perrin's avatar Jérome Perrin

test_result: Rewrite TestResultLine_viewResultHistory

so that test result line does not need to be indexable
parent 2a5f469b
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>"""Count all previous test result line for the same test, same\n
test suite, but for older revisions.\n
"""\n
\n
test_result = context.getParentValue()\n
query_params = {\'portal_type\': \'Test Result\',\n
\'title\': dict(query=test_result.getTitle(), key=\'ExactMatch\'),\n
\'simulation_state\': (\'stopped\', \'public_stopped\', \'failed\'),\n
}\n
return context.portal_catalog.countResults(**query_params)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TestResultLine_countResultHistoryList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -58,19 +58,41 @@ Note that creation_date is used, but it could be nicer to use\n
the start date. However for now it is more convenient from a\n
catalog point of view\n
"""\n
\n
test_result = context.getParentValue()\n
\n
query_params = {\'creation_date\' : dict(query=context.getCreationDate(), range=\'ngt\'),\n
\'portal_type\': context.getPortalType(),\n
\'title\': dict(query=context.getTitle(), key=\'ExactMatch\'),\n
\'parent_title\': dict(query=test_result.getTitle(), key=\'ExactMatch\'),\n
\'simulation_state\': \'stopped\',\n
\'portal_type\': \'Test Result\',\n
\'limit\': limit,\n
\'title\': dict(query=test_result.getTitle(), key=\'ExactMatch\'),\n
\'simulation_state\': (\'stopped\', \'public_stopped\', \'failed\'),\n
\'sort_on\': ((\'creation_date\', \'descending\'),),}\n
return context.portal_catalog(**query_params)\n
\n
result_list = []\n
expected_id = context.getId()\n
expected_title = context.getTitle()\n
for tr in context.portal_catalog(**query_params):\n
tr = tr.getObject()\n
# Optimisation: the test result line probably have the same id in the previous\n
# test result.\n
line = getattr(tr, expected_id, None)\n
if line is not None and line.getTitle() == expected_title \\\n
and line.getSimulationState() in (\'stopped\', \'public_stopped\', \'failed\'):\n
result_list.append(line)\n
else:\n
for line in tr.contentValues(portal_type=\'Test Result Line\'):\n
if line.getTitle() == context.getTitle() \\\n
and line.getSimulationState() in (\'stopped\', \'public_stopped\', \'failed\'):\n
result_list.append(line)\n
# next time, the test result line will likely have the same id as this one.\n
expected_id = line.getId()\n
\n
return result_list\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
<value> <string>limit, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -394,12 +394,18 @@
</item>
<item>
<key> <string>count_method</string> </key>
<value> <string></string> </value>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default_display_style</string> </key>
<value> <string>table</string> </value>
</item>
<item>
<key> <string>default_params</string> </key>
<value>
......@@ -410,6 +416,12 @@
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_style_list</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>domain_root_list</string> </key>
<value>
......@@ -449,6 +461,10 @@
<list/>
</value>
</item>
<item>
<key> <string>global_search_column</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
......@@ -459,7 +475,7 @@
</item>
<item>
<key> <string>lines</string> </key>
<value> <int>20</int> </value>
<value> <int>15</int> </value>
</item>
<item>
<key> <string>list_action</string> </key>
......@@ -468,7 +484,7 @@
<item>
<key> <string>list_method</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
......@@ -477,6 +493,10 @@
<list/>
</value>
</item>
<item>
<key> <string>page_navigation_template</string> </key>
<value> <string>ListBox_viewSliderPageNavigationRenderer</string> </value>
</item>
<item>
<key> <string>page_template</string> </key>
<value> <string></string> </value>
......@@ -541,6 +561,12 @@
<key> <string>stat_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>style_columns</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>listbox</string> </value>
......@@ -565,10 +591,20 @@
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="Method" module="Products.Formulator.MethodField"/>
<tuple/>
</tuple>
<global name="Method" module="Products.Formulator.MethodField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>TestResultLine_countResultHistoryList</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="Method" module="Products.Formulator.MethodField"/>
</pickle>
<pickle>
<dictionary>
......
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