[Zope-Checkins] SVN: Zope/trunk/lib/python/Testing/ZopeTestCase/
Fixed _refreshSkinData() helper to work with CMF >= 1.5.
Stefan H. Holek
stefan at epy.co.at
Thu Apr 28 14:37:13 EDT 2005
Log message for revision 30215:
Fixed _refreshSkinData() helper to work with CMF >= 1.5.
Changed:
U Zope/trunk/lib/python/Testing/ZopeTestCase/PortalTestCase.py
U Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt
U Zope/trunk/lib/python/Testing/ZopeTestCase/testPortalTestCase.py
-=-
Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/PortalTestCase.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/PortalTestCase.py 2005-04-28 18:17:53 UTC (rev 30214)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/PortalTestCase.py 2005-04-28 18:37:13 UTC (rev 30215)
@@ -95,11 +95,12 @@
self.folder = pm.getHomeFolder(user_name)
def _refreshSkinData(self):
- '''Refreshes the magic _v_skindata attribute.'''
- if hasattr(self.portal, '_v_skindata'):
+ '''Refreshes the skin cache.'''
+ if hasattr(self.portal, 'clearCurrentSkin'):
+ self.portal.clearCurrentSkin()
+ else: # CMF 1.4
self.portal._v_skindata = None
- if hasattr(self.portal, 'setupCurrentSkin'):
- self.portal.setupCurrentSkin()
+ self.portal.setupCurrentSkin()
# Portal interface
Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt 2005-04-28 18:17:53 UTC (rev 30214)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt 2005-04-28 18:37:13 UTC (rev 30215)
@@ -8,8 +8,9 @@
- Removed doctest.py, we now use the one from zope.testing.
- Removed dochttp.py + test, we now use the one from zope.app.tests.
- ZopeLite now takes care not to monkey patch an already started Zope.
-- PortalTestCase no longer calls _refreshSkinData() as CMF is smart enough
- now (and CMF 1.5+ does not work that way anyway).
+- PortalTestCase.setUp() no longer calls _refreshSkinData() as CMF is smart
+ enough now.
+- Fixed _refreshSkinData() helper to work with CMF >= 1.5.
- Fixed a bug where using sessions in sandboxed (functional) tests would cause
connection pool depletion and subsequent hangs. Thanks to Balazs Ree.
Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/testPortalTestCase.py
===================================================================
--- Zope/trunk/lib/python/Testing/ZopeTestCase/testPortalTestCase.py 2005-04-28 18:17:53 UTC (rev 30214)
+++ Zope/trunk/lib/python/Testing/ZopeTestCase/testPortalTestCase.py 2005-04-28 18:37:13 UTC (rev 30215)
@@ -48,15 +48,16 @@
from OFS.Folder import Folder
class DummyPortal(Folder):
- _v_skindata = None
def __init__(self, id):
self.id = id
self._addRole('Member')
self._setObject('portal_membership', DummyMembershipTool())
self.manage_addFolder('Members')
+ self._called = []
+ def clearCurrentSkin(self):
+ self._called.append('clearCurrentSkin')
def setupCurrentSkin(self):
- if self._v_skindata is None:
- self._v_skindata = 'refreshed'
+ self._called.append('setupCurrentSkin')
class DummyMembershipTool(SimpleItem):
id = 'portal_membership'
@@ -148,12 +149,11 @@
self.assertEqual(owner_info, ([portal_name, 'acl_users'], user_name))
def test_refreshSkinData(self):
- # The _v_skindata attribute should be refreshed
+ # The skin cache should be refreshed
self.app = self._app()
self.portal = self.getPortal()
- self.assertEqual(self.portal._v_skindata, None)
self._refreshSkinData()
- self.assertEqual(self.portal._v_skindata, 'refreshed')
+ self.assertEqual(self.portal._called, ['clearCurrentSkin', 'setupCurrentSkin'])
def test_setRoles(self):
# Roles should be set for user
@@ -320,8 +320,6 @@
# XXX: Changed in 0.9.0
#self.assertEqual(self._called, ['afterClear', 'beforeSetUp', 'afterSetUp'])
self.assertEqual(self._called, ['beforeSetUp', 'afterSetUp'])
- # XXX: Changed in 0.9.7
- #self.assertEqual(self.portal._v_skindata, 'refreshed')
def test_tearDown(self):
# Everything should be removed
@@ -344,8 +342,6 @@
# XXX: Changed in 0.9.0
#self.assertEqual(self._called, ['afterClear', 'beforeSetUp', 'afterSetUp'])
self.assertEqual(self._called, ['beforeSetUp', 'afterSetUp'])
- # XXX: Changed in 0.9.7
- #self.assertEqual(self.portal._v_skindata, 'refreshed')
# This is crazy
More information about the Zope-Checkins
mailing list