Commit 2e98da06 authored by Sebastien Robin's avatar Sebastien Robin

task distribution: avoid to reset reference on test suite if invalidated/revalidated

parent 87492a24
......@@ -164,6 +164,25 @@ class TestTaskDistribution(ERP5TypeTestCase):
test_suite.invalidate()
self.assertRaises(ValidationFailed, self.portal.portal_workflow.doActionFor, test_suite, 'validate_action')
def test_02c_checkTestSuiteReference(self):
"""
Make sure validation of test suite generate a reference, and revalidating
a test suite should not change reference
"""
test_suite, = self._createTestSuite()
self.assertTrue(test_suite.getReference() != None)
self.tic()
test_suite.invalidate()
self.tic()
test_suite.setReference(None)
test_suite.validate()
reference = test_suite.getReference()
self.assertTrue(reference != None)
test_suite.invalidate()
self.tic()
test_suite.validate()
self.assertEqual(reference, test_suite.getReference())
def _callOptimizeAlarm(self):
self.portal.portal_alarms.task_distributor_alarm_optimize.activeSense()
self.tic()
......
......@@ -13,8 +13,9 @@ def int2letter(i):
d, m = divmod(i, 26)
return int2letter(d - 1) + int2letter(m)
new_id = portal.portal_ids.generateNewId(id_generator="uid", id_group="test_suite_reference")
test_suite.setReference(int2letter(new_id))
if test_suite.getReference() is None:
new_id = portal.portal_ids.generateNewId(id_generator="uid", id_group="test_suite_reference")
test_suite.setReference(int2letter(new_id))
def generateRandomString(size):
tab = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
......
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