Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Private Member Functions
CMFDefault.tests.test_DiscussionTool.DiscussionToolTests Class Reference
Inheritance diagram for CMFDefault.tests.test_DiscussionTool.DiscussionToolTests:
Inheritance graph
[legend]
Collaboration diagram for CMFDefault.tests.test_DiscussionTool.DiscussionToolTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setUp
def tearDown
def test_z2interfaces
def test_z3interfaces
def test_overrideDiscussionFor
def test_isDiscussionAllowedFor
def test_getDiscussionFor

Public Attributes

 site

Private Member Functions

def _makeOne

Detailed Description

Definition at line 31 of file test_DiscussionTool.py.


Member Function Documentation

def CMFDefault.tests.test_DiscussionTool.DiscussionToolTests._makeOne (   self,
  args,
  kw 
) [private]

Definition at line 33 of file test_DiscussionTool.py.

00033 
00034     def _makeOne(self, *args, **kw):
00035         from Products.CMFDefault.DiscussionTool import DiscussionTool
00036 
00037         return DiscussionTool(*args, **kw)

Definition at line 38 of file test_DiscussionTool.py.

00038 
00039     def setUp(self):
00040         SecurityTest.setUp(self)
00041         self.site = DummySite('site')
00042         sm = getSiteManager()
00043         self.site._setObject( 'portal_discussion', self._makeOne() )
00044         sm.registerUtility(self.site.portal_discussion, IDiscussionTool)
00045         self.site._setObject( 'portal_types', DummyTool() )

Definition at line 46 of file test_DiscussionTool.py.

00046 
00047     def tearDown(self):
00048         cleanUp()
00049         SecurityTest.tearDown(self)

Here is the call graph for this function:

Definition at line 102 of file test_DiscussionTool.py.

00102 
00103     def test_getDiscussionFor(self):
00104         dtool = self.site.portal_discussion
00105         foo = self.site._setObject( 'foo', DummyFolder() )
00106         foo.allow_discussion = 1
00107         baz = foo._setObject( 'baz', DummyFolder() )
00108         baz.allow_discussion = 1
00109 
00110         self.failIf( hasattr(foo.aq_base, 'talkback') )
00111         talkback = dtool.getDiscussionFor(foo)
00112         self.failUnless( hasattr(foo.aq_base, 'talkback') )
00113         self.failIf( hasattr(baz.aq_base, 'talkback') )
00114         talkback = dtool.getDiscussionFor(baz)
00115         self.failUnless( hasattr(baz.aq_base, 'talkback'),
00116                          'CMF Collector issue #119 (acquisition bug): '
00117                          'talkback not created' )
00118 

Definition at line 92 of file test_DiscussionTool.py.

00092 
00093     def test_isDiscussionAllowedFor(self):
00094         # Test for Collector issue #398 (allow_discussion wrongly
00095         # acquired and used from parent)
00096         dtool = self.site.portal_discussion
00097         foo = self.site._setObject( 'foo', DummyFolder() )
00098         baz = foo._setObject( 'baz', DummyFolder() )
00099         dtool.overrideDiscussionFor(foo, 1)
00100 
00101         self.failIf(dtool.isDiscussionAllowedFor(baz))

Definition at line 65 of file test_DiscussionTool.py.

00065 
00066     def test_overrideDiscussionFor(self):
00067         dtool = self.site.portal_discussion
00068         foo = self.site._setObject( 'foo', DummyFolder() )
00069         baz = foo._setObject( 'baz', DummyFolder() )
00070 
00071         dtool.overrideDiscussionFor(foo, 1)
00072         self.failUnless( hasattr(foo.aq_base, 'allow_discussion') )
00073         try:
00074             dtool.overrideDiscussionFor(baz, None)
00075         except KeyError:
00076             self.fail('CMF Collector issue #201 (acquisition bug): '
00077                       'KeyError raised')
00078         dtool.overrideDiscussionFor(foo, None)
00079         self.failIf( hasattr(foo.aq_base, 'allow_discussion') )
00080 
00081         # https://bugs.launchpad.net/zope-cmf/+bug/162532: Don't break
00082         # if allow_discussion only exists at the class level
00083         class DummyContent:
00084             allow_discussion = False
00085             def getId(self): return 'dummy'
00086 
00087         dummy = DummyContent()
00088         try:
00089             dtool.overrideDiscussionFor(dummy, None)
00090         except AttributeError:
00091             self.fail('Launchpad issue 162532: AttributeError raised')

Here is the call graph for this function:

Definition at line 50 of file test_DiscussionTool.py.

00050 
00051     def test_z2interfaces(self):
00052         from Interface.Verify import verifyClass
00053         from Products.CMFCore.interfaces.portal_discussion \
00054                 import portal_discussion as IDiscussionTool
00055         from Products.CMFDefault.DiscussionTool import DiscussionTool
00056 
00057         verifyClass(IDiscussionTool, DiscussionTool)

Definition at line 58 of file test_DiscussionTool.py.

00058 
00059     def test_z3interfaces(self):
00060         from zope.interface.verify import verifyClass
00061         from Products.CMFCore.interfaces import IDiscussionTool
00062         from Products.CMFDefault.DiscussionTool import DiscussionTool
00063 
00064         verifyClass(IDiscussionTool, DiscussionTool)


Member Data Documentation

Definition at line 40 of file test_DiscussionTool.py.


The documentation for this class was generated from the following file: