fix the remaining testAlarm failures: clean-up the left-over activities and...

fix the remaining testAlarm failures: clean-up the left-over activities and capture outgoing e-mails

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31854 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a72d9514
...@@ -31,6 +31,7 @@ import transaction ...@@ -31,6 +31,7 @@ import transaction
from Testing import ZopeTestCase from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import DummyMailHost
from AccessControl.SecurityManagement import newSecurityManager, \ from AccessControl.SecurityManagement import newSecurityManager, \
getSecurityManager, setSecurityManager getSecurityManager, setSecurityManager
from AccessControl import Unauthorized from AccessControl import Unauthorized
...@@ -67,8 +68,20 @@ class TestAlarm(ERP5TypeTestCase): ...@@ -67,8 +68,20 @@ class TestAlarm(ERP5TypeTestCase):
return "Alarm" return "Alarm"
def afterSetUp(self): def afterSetUp(self):
# add a dummy mailhost to capture alarm notifications
if 'MailHost' in self.portal.objectIds():
self.portal.manage_delObjects(['MailHost'])
self.portal._setObject('MailHost', DummyMailHost('MailHost'))
self.login() self.login()
def beforeTearDown(self):
transaction.commit()
self.getActivityTool().manageClearActivities()
transaction.commit()
del self.portal.MailHost._message_list[:]
ERP5TypeTestCase.beforeTearDown(self)
def newAlarm(self, **kw): def newAlarm(self, **kw):
""" """
Create an empty alarm Create an empty alarm
...@@ -552,7 +565,7 @@ class TestAlarm(ERP5TypeTestCase): ...@@ -552,7 +565,7 @@ class TestAlarm(ERP5TypeTestCase):
def test_18_alarm_activities_execution_order(self, quiet=0, run=run_all_test): def test_18_alarm_activities_execution_order(self, quiet=0, run=run_all_test):
""" """
Make sure active process created by an alarm get the rigth tag Make sure active process created by an alarm get the right tag
""" """
if not run: return if not run: return
if not quiet: if not quiet:
...@@ -614,7 +627,7 @@ class TestAlarm(ERP5TypeTestCase): ...@@ -614,7 +627,7 @@ class TestAlarm(ERP5TypeTestCase):
# Create script that generate active process # Create script that generate active process
sense_method_id = 'Alarm_setBogusLocalProperty' sense_method_id = 'Alarm_setBogusLocalProperty'
skin_folder_id = 'custom' skin_folder_id = 'custom'
skin_folder = self.getPortal().portal_skins[skin_folder_id] skin_folder = self.portal.portal_skins[skin_folder_id]
skin_folder.manage_addProduct['PythonScripts']\ skin_folder.manage_addProduct['PythonScripts']\
.manage_addPythonScript(id=sense_method_id) .manage_addPythonScript(id=sense_method_id)
skin_folder[sense_method_id].ZPythonScript_edit('*args,**kw', skin_folder[sense_method_id].ZPythonScript_edit('*args,**kw',
......
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