Back to index

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

List of all members.

Public Member Functions

def tearDown
def test_empty
def test_editProperties_normal
def test_editProperties_coercing
def test_editSyInformationProperties_disabled
def test_editSyInformationProperties_normal
def test_editSyInformationProperties_coercing
def test_editProperties_isAllowedOnly
def test_getSyndicatableContent

Private Member Functions

def _getTargetClass
def _makeOne

Detailed Description

Definition at line 33 of file test_SyndicationTool.py.


Member Function Documentation

Definition at line 35 of file test_SyndicationTool.py.

00035 
00036     def _getTargetClass(self):
00037         from Products.CMFDefault.SyndicationTool import SyndicationTool
00038         return SyndicationTool

def CMFDefault.tests.test_SyndicationTool.SyndicationToolTests._makeOne (   self,
  args,
  kw 
) [private]

Definition at line 39 of file test_SyndicationTool.py.

00039 
00040     def _makeOne(self, *args, **kw):
00041         return self._getTargetClass()(*args, **kw)

Definition at line 42 of file test_SyndicationTool.py.

00042 
00043     def tearDown(self):
00044         cleanUp()
00045         SecurityTest.tearDown(self)

Here is the call graph for this function:

Definition at line 77 of file test_SyndicationTool.py.

00077 
00078     def test_editProperties_coercing(self):
00079         PERIOD = 'hourly'
00080         FREQUENCY = 4
00081         NOW = DateTime()
00082         MAX_ITEMS = 42
00083 
00084         tool = self._makeOne()
00085         tool.editProperties(updatePeriod=PERIOD,
00086                             updateFrequency='%d' % FREQUENCY,
00087                             updateBase=NOW.ISO(),
00088                             isAllowed='True',
00089                             max_items='%d' % MAX_ITEMS,
00090                            )
00091 
00092         self.assertEqual(tool.syUpdatePeriod, PERIOD)
00093         self.assertEqual(tool.syUpdateFrequency, FREQUENCY)
00094         self.assertEqual(tool.syUpdateBase, DateTime(NOW.ISO()))
00095         self.failUnless(tool.isAllowed)
00096         self.assertEqual(tool.max_items, MAX_ITEMS)

Definition at line 155 of file test_SyndicationTool.py.

00155 
00156     def test_editProperties_isAllowedOnly(self):
00157         # Zope 2.8 crashes if we don't edit all properties.
00158         # This is because Zope now raises AttributeError
00159         # instead of KeyError in editProperties().
00160         tool = self._makeOne()
00161         tool.editProperties(isAllowed=1)
00162 
00163         self.failUnless(tool.isAllowed)

Definition at line 57 of file test_SyndicationTool.py.

00057 
00058     def test_editProperties_normal(self):
00059         PERIOD = 'hourly'
00060         FREQUENCY = 4
00061         NOW = DateTime()
00062         MAX_ITEMS = 42
00063 
00064         tool = self._makeOne()
00065         tool.editProperties(updatePeriod=PERIOD,
00066                             updateFrequency=FREQUENCY,
00067                             updateBase=NOW,
00068                             isAllowed=True,
00069                             max_items=MAX_ITEMS,
00070                            )
00071 
00072         self.assertEqual(tool.syUpdatePeriod, PERIOD)
00073         self.assertEqual(tool.syUpdateFrequency, FREQUENCY)
00074         self.assertEqual(tool.syUpdateBase, NOW)
00075         self.failUnless(tool.isAllowed)
00076         self.assertEqual(tool.max_items, MAX_ITEMS)

Definition at line 133 of file test_SyndicationTool.py.

00133 
00134     def test_editSyInformationProperties_coercing(self):
00135         PERIOD = 'hourly'
00136         FREQUENCY = 4
00137         NOW = DateTime()
00138         MAX_ITEMS = 42
00139 
00140         tool = self._makeOne()
00141         dummy = Dummy()
00142         info = dummy.syndication_information = Dummy()
00143 
00144         tool.editSyInformationProperties(dummy,
00145                                          updatePeriod=PERIOD,
00146                                          updateFrequency='%d' % FREQUENCY,
00147                                          updateBase=NOW.ISO(),
00148                                          max_items='%d' % MAX_ITEMS,
00149                                         )
00150 
00151         self.assertEqual(info.syUpdatePeriod, PERIOD)
00152         self.assertEqual(info.syUpdateFrequency, FREQUENCY)
00153         self.assertEqual(info.syUpdateBase, DateTime(NOW.ISO()))
00154         self.assertEqual(info.max_items, MAX_ITEMS)

Definition at line 97 of file test_SyndicationTool.py.

00097 
00098     def test_editSyInformationProperties_disabled(self):
00099         from zExceptions import Unauthorized
00100 
00101         tool = self._makeOne()
00102         dummy = Dummy()
00103         try:
00104             tool.editSyInformationProperties(object, updateFrequency=1)
00105         except Unauthorized:
00106             raise
00107         except: # WAAA! it raises a string!
00108             pass
00109         else:
00110             assert 0, "Didn't raise"

Definition at line 111 of file test_SyndicationTool.py.

00111 
00112     def test_editSyInformationProperties_normal(self):
00113         PERIOD = 'hourly'
00114         FREQUENCY = 4
00115         NOW = DateTime()
00116         MAX_ITEMS = 42
00117 
00118         tool = self._makeOne()
00119         dummy = Dummy()
00120         info = dummy.syndication_information = Dummy()
00121 
00122         tool.editSyInformationProperties(dummy,
00123                                          updatePeriod=PERIOD,
00124                                          updateFrequency=FREQUENCY,
00125                                          updateBase=NOW,
00126                                          max_items=MAX_ITEMS,
00127                                         )
00128 
00129         self.assertEqual(info.syUpdatePeriod, PERIOD)
00130         self.assertEqual(info.syUpdateFrequency, FREQUENCY)
00131         self.assertEqual(info.syUpdateBase, NOW)
00132         self.assertEqual(info.max_items, MAX_ITEMS)

Definition at line 46 of file test_SyndicationTool.py.

00046 
00047     def test_empty(self):
00048         ONE_MINUTE = (24.0 * 60.0) / 86400
00049 
00050         tool = self._makeOne()
00051 
00052         self.assertEqual(tool.syUpdatePeriod, 'daily')
00053         self.assertEqual(tool.syUpdateFrequency, 1)
00054         self.failUnless(DateTime() - tool.syUpdateBase < ONE_MINUTE)
00055         self.failIf(tool.isAllowed)
00056         self.assertEqual(tool.max_items, 15)

Definition at line 164 of file test_SyndicationTool.py.

00164 
00165     def test_getSyndicatableContent(self):
00166         # http://www.zope.org/Collectors/CMF/369
00167         # Make sure we use a suitable base class call when determining
00168         # syndicatable content
00169         from Products.CMFCore.PortalFolder import PortalFolder
00170         from Products.CMFCore.CMFBTreeFolder import CMFBTreeFolder
00171         from Products.CMFCore.TypesTool import TypesTool
00172 
00173         PERIOD = 'hourly'
00174         FREQUENCY = 4
00175         NOW = DateTime()
00176         MAX_ITEMS = 42
00177 
00178         self.root._setObject( 'portal_types', TypesTool() )
00179         self.root._setObject('pf', PortalFolder('pf'))
00180         self.root._setObject('bf', CMFBTreeFolder('bf'))
00181         self.root._setObject('portal_syndication', self._makeOne())
00182         tool = self.root.portal_syndication
00183         tool.editProperties(updatePeriod=PERIOD,
00184                             updateFrequency=FREQUENCY,
00185                             updateBase=NOW,
00186                             isAllowed=True,
00187                             max_items=MAX_ITEMS,
00188                            )
00189 
00190         self.assertEqual(len(tool.getSyndicatableContent(self.root.pf)), 0)
00191         self.assertEqual(len(tool.getSyndicatableContent(self.root.bf)), 0)
00192 


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