Commit e4eae8ba authored by Łukasz Nowak's avatar Łukasz Nowak Committed by Eteri

Link Test Result Node with Test Node

This link allows to navigate from Test Result via its Test Result Node
to Test Node and distributor related to given Test Result.

Note: It happens only, if client will do subscribeNode before calling
createTestResult.
parent 36907b7e
......@@ -21,6 +21,9 @@
<portal_type id="Test Result Module">
<item>business_application</item>
</portal_type>
<portal_type id="Test Result Node">
<item>specialise</item>
</portal_type>
<portal_type id="Test Suite">
<item>specialise</item>
</portal_type>
......
......@@ -98,6 +98,7 @@
<value>
<list>
<string>my_title</string>
<string>my_specialise_title</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>editable</string>
<string>portal_type</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_specialise_title</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>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</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>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>editable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_relation_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value>
<list>
<tuple>
<string>Test Node</string>
<string>Test Node</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Test Node</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -383,6 +383,19 @@ class TestTaskDistribution(ERP5TypeTestCase):
test_result = self.getPortalObject().unrestrictedTraverse(test_result_path)
self.assertEqual("stopped", test_result.getSimulationState())
def test_05c_createTestResult_with_registered_test_node(self):
node_title = 'Node0OinkUink'
# "register" Test Node
test_node = self.portal.test_node_module.newContent(
portal_type='Test Node', title=node_title)
self.tic()
test_result_path, revision = self._createTestResult(node_title=node_title)
# check that Test Node Result used in Test Result is specialised
# into registered Test Node
test_result = self.getPortalObject().unrestrictedTraverse(test_result_path)
test_result_node = test_result.contentValues(portal_type='Test Result Node')[0]
self.assertEqual(test_result_node.getSpecialise(), test_node.getRelativeUrl())
def test_06_startStopUnitTest(self):
"""
We will check methods startUnitTest/stopUnitTest of task distribution tool
......
......@@ -5,6 +5,7 @@ SlapOS Software Release Unit Test | specialise
Test Node | aggregate
Test Node | specialise
Test Result Module | business_application
Test Result Node | specialise
Test Result | source_project
Test Suite Repository | aggregate
Test Suite | specialise
\ No newline at end of file
......@@ -53,6 +53,15 @@ class TaskDistributionTool(BaseTool):
"""
return 1
def _getTestNodeRelativeUrl(self, node_title):
portal = self.getPortalObject()
test_node_list = portal.portal_catalog(
portal_type="Test Node",
title=SimpleQuery(comparison_operator='=', title=node_title),
)
if len(test_node_list) == 1:
return test_node_list[0].getRelativeUrl()
def _getTestResultNode(self, test_result, node_title):
node_list = [x for x in test_result.objectValues(
portal_type='Test Result Node') if x.getTitle() == node_title]
......@@ -86,8 +95,15 @@ class TaskDistributionTool(BaseTool):
if node_title is not None:
node = self._getTestResultNode(test_result, node_title)
if node is None:
# Note: specialise might not be set. This is on purpose, in order
# to support cases, when client will call createTestResult
# without calling subscribeNode before, and this is required
# to find Test Node document returned by
# _getTestNodeRelativeUrl.
node = test_result.newContent(portal_type='Test Result Node',
title=node_title)
title=node_title,
specialise=self._getTestNodeRelativeUrl(
node_title))
node.start()
def createTestResultLineList(test_result, test_name_list):
duration_list = []
......
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