[CMF-checkins] CVS: Products/CMFDefault/tests -
test_Discussions.py:1.19.6.1
Florent Guillaume
fg at nuxeo.com
Fri Sep 3 13:04:41 EDT 2004
Update of /cvs-repository/Products/CMFDefault/tests
In directory cvs.zope.org:/tmp/cvs-serv19418/CMFDefault/tests
Modified Files:
Tag: CMF-1_5-branch
test_Discussions.py
Log Message:
Ensure workflow is notified when a DiscussionItem is created
=== Products/CMFDefault/tests/test_Discussions.py 1.19 => 1.19.6.1 ===
--- Products/CMFDefault/tests/test_Discussions.py:1.19 Wed May 5 10:18:25 2004
+++ Products/CMFDefault/tests/test_Discussions.py Fri Sep 3 13:04:36 2004
@@ -181,6 +181,31 @@
self.failUnless( has_path( catalog,
'/bar/site/test/talkback/%s' % reply.getId() ) )
+ def test_itemWorkflowNotification(self):
+ dtool = self.site.portal_discussion
+ test = self._makeDummyContent('test')
+ test.allow_discussion = 1
+ talkback = dtool.getDiscussionFor(test)
+
+ # Monkey patch into the class to test, urgh.
+ def notifyWorkflowCreated(self):
+ self.test_wf_notified = 1
+ DiscussionItem.inheritedAttribute('notifyWorkflowCreated')(self)
+ old_method = getattr(DiscussionItem, 'notifyWorkflowCreated', None)
+ DiscussionItem.notifyWorkflowCreated = notifyWorkflowCreated
+ DiscussionItem.test_wf_notified = 0
+
+ try:
+ reply_id = talkback.createReply(title='test', text='blah')
+ reply = talkback.getReplies()[0]
+ self.assertEqual(reply.test_wf_notified, 1)
+ finally:
+ delattr(DiscussionItem, 'test_wf_notified')
+ if old_method is None:
+ delattr(DiscussionItem, 'notifyWorkflowCreated')
+ else:
+ DiscussionItem.notifyWorkflowCreated = old_method
+
def test_deletePropagation( self ):
ctool = self.site._setObject( 'portal_catalog', CatalogTool() )
dtool = self.site.portal_discussion
More information about the CMF-checkins
mailing list