Commit aaeb9477 authored by Stefan H. Holek's avatar Stefan H. Holek

Fixed _refreshSkinData() helper to work with CMF >= 1.5.

parent f9f42abf
......@@ -95,11 +95,12 @@ class PortalTestCase(base.TestCase):
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
......
......@@ -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.
......
......@@ -48,15 +48,16 @@ from OFS.SimpleItem import SimpleItem
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 @@ class TestPortalTestCase(ZopeTestCase.PortalTestCase):
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 @@ class TestPortalTestCase(ZopeTestCase.PortalTestCase):
# 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 @@ class TestPortalTestCase(ZopeTestCase.PortalTestCase):
# 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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment