[Erp5-report] r24896 - /erp5/trunk/products/CMFActivity/tests/testCMFActivity.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Dec 15 15:47:02 CET 2008
Author: vincent
Date: Mon Dec 15 15:47:00 2008
New Revision: 24896
URL: http://svn.erp5.org?rev=24896&view=rev
Log:
Add a test (specific to SQLQueue) to check that activities executed after an activity invoking "changeSkin" get default skin.
Modified:
erp5/trunk/products/CMFActivity/tests/testCMFActivity.py
Modified: erp5/trunk/products/CMFActivity/tests/testCMFActivity.py
URL: http://svn.erp5.org/erp5/trunk/products/CMFActivity/tests/testCMFActivity.py?rev=24896&r1=24895&r2=24896&view=diff
==============================================================================
--- erp5/trunk/products/CMFActivity/tests/testCMFActivity.py [utf8] (original)
+++ erp5/trunk/products/CMFActivity/tests/testCMFActivity.py [utf8] Mon Dec 15 15:47:00 2008
@@ -3029,6 +3029,46 @@
# 3: activity commit raises
# 4: activity raises
+ def test_114_checkSQLQueueActivitySucceedsAfterActivityChangingSkin(self,
+ quiet=0, run=run_all_test):
+ portal = self.getPortalObject()
+ activity_tool = self.getActivityTool()
+ # Check that a reference script can be reached
+ script_id = 'ERP5Site_reindexAll'
+ self.assertTrue(getattr(portal, script_id, None) is not None)
+ # Create a new skin selection
+ skin_selection_name = 'test_114'
+ portal.portal_skins.manage_skinLayers(add_skin=1, skinpath=[''], skinname=skin_selection_name)
+ # Create a dummy document
+ organisation = portal.organisation_module.newContent(portal_type='Organisation')
+ get_transaction().commit()
+ self.tic()
+ # Set custom methods to call as activities.
+ def first(context):
+ context.changeSkin(skin_selection_name)
+ if getattr(context, script_id, None) is not None:
+ raise Exception, '%s is not supposed to be found here.' % (script_id, )
+ def second(context):
+ # If the wrong skin is selected this will raise.
+ getattr(context, script_id)
+ Organisation.firstTest = first
+ Organisation.secondTest = second
+ try:
+ organisation.activate(tag='foo', activity='SQLQueue').firstTest()
+ organisation.activate(after_tag='foo', activity='SQLQueue').secondTest()
+ get_transaction().commit()
+ import gc
+ gc.disable()
+ self.tic()
+ gc.enable()
+ # Forcibly restore skin selection, otherwise getMessageList would only
+ # emit a log when retrieving the ZSQLMethod.
+ portal.changeSkin(None)
+ self.assertEquals(len(activity_tool.getMessageList()), 0)
+ finally:
+ delattr(Organisation, 'firstTest')
+ delattr(Organisation, 'secondTest')
+
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestCMFActivity))
More information about the Erp5-report
mailing list