Commit 545a0487 authored by Sebastien Robin's avatar Sebastien Robin

test_result: avoid duplicates of test suite title, it is used an unique identifier by api

parent 8a6c4394
......@@ -20,7 +20,7 @@
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Test Suite has to have at leat one vcs repository</string> </value>
<value> <string>Test Suite has to have at least one vcs repository</string> </value>
</item>
<item>
<key> <string>expression</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="TALES Constraint" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Title must be unique</string> </value>
</item>
<item>
<key> <string>expression</string> </key>
<value> <string>python: len([x for x in object.getPortalObject().portal_catalog(portal_type="Test Suite", validation_state="validated", title=object.getTitle()) if x.uid != object.getUid()])==0</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>title_duplicate_constraint_constraint</string> </value>
</item>
<item>
<key> <string>message_expression_false</string> </key>
<value> <string>Title must be unique, it is already used</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>TALES Constraint</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -183,6 +183,18 @@ class TestTaskDistribution(ERP5TypeTestCase):
test_suite.validate()
self.assertEqual(reference, test_suite.getReference())
def test_02d_checkTestSuiteTitleDuplication(self):
"""
Check the constraint avoiding duplicates of test suites
"""
test_suite, = self._createTestSuite()
self.tic()
test_suite_clone = test_suite.Base_createCloneDocument(batch_mode=1)
self.assertRaises(ValidationFailed, self.portal.portal_workflow.doActionFor, test_suite_clone, 'validate_action')
test_suite_clone.setTitle(test_suite_clone.getTitle() + 'a')
self.portal.portal_workflow.doActionFor(test_suite_clone, 'validate_action')
self.assertEqual('validated', test_suite_clone.getValidationState())
def _callOptimizeAlarm(self):
self.portal.portal_alarms.task_distributor_alarm_optimize.activeSense()
self.tic()
......
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