[CMF-checkins] CVS: Products/CMFDefault/tests - test_Discussions.py:1.14.26.2

Stefan H. Holek stefan at epy.co.at
Fri Sep 10 06:06:09 EDT 2004


Update of /cvs-repository/Products/CMFDefault/tests
In directory cvs.zope.org:/tmp/cvs-serv15462/CMFDefault/tests

Modified Files:
      Tag: CMF-1_4-branch
	test_Discussions.py 
Log Message:
Backported the DiscussionItem fix (#280) to 1.4 branch (yes, I know).


=== Products/CMFDefault/tests/test_Discussions.py 1.14.26.1 => 1.14.26.2 ===
--- Products/CMFDefault/tests/test_Discussions.py:1.14.26.1	Thu Apr 22 13:47:55 2004
+++ Products/CMFDefault/tests/test_Discussions.py	Fri Sep 10 06:06:08 2004
@@ -192,6 +192,30 @@
             assert has_path( catalog
                            , '/test/talkback/%s' % reply.getId() )
 
+    def test_itemWorkflowNotification(self):
+        test = self.root.test
+        test.allow_discussion = 1
+        talkback = self.discussion_tool.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 ):
 
         test = self.root.test



More information about the CMF-checkins mailing list