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

Stefan H. Holek stefan at epy.co.at
Wed Jan 19 08:43:37 EST 2005


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

Modified Files:
	test_Discussions.py 
Log Message:
Make sure getDiscussionFor returns a wrapped talkback object.


=== Products/CMFDefault/tests/test_Discussions.py 1.20 => 1.21 ===
--- Products/CMFDefault/tests/test_Discussions.py:1.20	Fri Sep  3 13:08:41 2004
+++ Products/CMFDefault/tests/test_Discussions.py	Wed Jan 19 08:43:36 2005
@@ -4,6 +4,7 @@
 Zope.startup()
 from Interface.Verify import verifyClass
 
+from Products.CMFCore.utils import getToolByName
 from Products.CMFCore.CatalogTool import CatalogTool
 from Products.CMFCore.tests.base.dummy import DummyContent
 from Products.CMFCore.tests.base.dummy import DummySite
@@ -246,6 +247,25 @@
         talkback1 = dtool.getDiscussionFor(reply1)
         self.assertEqual(len(talkback.getReplies()), 1)
         self.assertEqual(len(talkback1.getReplies()), 0)
+
+    def test_newTalkbackIsWrapped(self):
+        test = self._makeDummyContent('test')
+        test.allow_discussion = 1
+        dtool = self.site.portal_discussion
+        talkback = dtool.getDiscussionFor(test)
+        self.failUnless(hasattr(talkback, 'aq_base'))
+        # Acquire a portal tool
+        self.failUnless(getToolByName(talkback, 'portal_discussion'))
+
+    def test_existingTalkbackIsWrapped(self):
+        test = self._makeDummyContent('test')
+        test.allow_discussion = 1
+        dtool = self.site.portal_discussion
+        talkback = dtool.getDiscussionFor(test)
+        talkback = dtool.getDiscussionFor(test)
+        self.failUnless(hasattr(talkback, 'aq_base'))
+        # Acquire a portal tool
+        self.failUnless(getToolByName(talkback, 'portal_discussion'))
 
 
 def test_suite():



More information about the CMF-checkins mailing list