Commit 309cc441 authored by Vincent Pelletier's avatar Vincent Pelletier

erp5_upgrader: Do not rely on getMessageList returning messages in executability order

The order in which messages are returned by getMessageList is undefined,
and manageInvoke refuses to execute messages which are blocked by their
dependencies. Notify depends on Alarm_runUpgrader, so it must be explicitly
ran second.
Also, avoid listing activities twice.
parent 7436e8d6
......@@ -344,12 +344,19 @@ class TestUpgrader(ERP5TypeTestCase):
def stepCheckNoActivitiesCreated(self, sequence=None):
portal_activities = self.getActivityTool()
message_list = portal_activities.getMessageList()
self.assertItemsEqual(['Alarm_runUpgrader', 'notify'],
[x.method_id for x in portal_activities.getMessageList()])
[x.method_id for x in message_list])
getTitleList = self.getTemplateTool().getInstalledBusinessTemplateTitleList
self.assertNotIn('erp5_web', getTitleList())
for message in portal_activities.getMessageList():
portal_activities.manageInvoke(message.object_path, message.method_id)
# "notify" must not be executed first as it has a dependency on
# Alarm_runUpgrader, so cast into a dict to control execution order.
message_dict = {x.method_id: x for x in message_list}
for method_id in ['Alarm_runUpgrader', 'notify']:
portal_activities.manageInvoke(
message_dict[method_id].object_path,
method_id,
)
self.assertIn('erp5_web', getTitleList())
self.commit()
self.assertEqual({'immediateReindexObject', 'unindexObject'},
......
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