[CMF-checkins] CVS: CMF/CMFCore/tests - test_MembershipTool.py:1.4
Yvo Schubbe
schubbe@web.de
Mon, 2 Jun 2003 12:19:19 -0400
Update of /cvs-repository/CMF/CMFCore/tests
In directory cvs.zope.org:/tmp/cvs-serv31356/CMFCore/tests
Modified Files:
test_MembershipTool.py
Log Message:
Merged yuppie-createMemberarea-branch:
- Made logged_in page instead of wrapUser call 'createMemberarea'.
- Added a customization hook to CMFDefault 'createMemberarea'.
=== CMF/CMFCore/tests/test_MembershipTool.py 1.3 => 1.4 ===
--- CMF/CMFCore/tests/test_MembershipTool.py:1.3 Wed May 28 06:57:42 2003
+++ CMF/CMFCore/tests/test_MembershipTool.py Mon Jun 2 12:18:48 2003
@@ -11,6 +11,7 @@
except ImportError:
# for Zope versions before 2.6.0
from Interface import verify_class_implementation as verifyClass
+from AccessControl.SecurityManagement import newSecurityManager
from Products.CMFCore.PortalFolder import PortalFolder
from Products.CMFCore.tests.base.dummy import DummyFolder as DummyFolderBase
@@ -52,13 +53,27 @@
def test_createMemberarea(self):
mtool = self.mtool
- self.site._setObject( 'Members', PortalFolder('Members') )
- self.site._setObject( 'acl_users', DummyUserFolder() )
- self.site._setObject( 'portal_workflow', DummyTool() )
+ members = self.site._setObject( 'Members', PortalFolder('Members') )
+ acl_users = self.site._setObject( 'acl_users', DummyUserFolder() )
+ wtool = self.site._setObject( 'portal_workflow', DummyTool() )
+
+ # permission
+ mtool.createMemberarea('user_foo')
+ self.failIf( hasattr(members.aq_self, 'user_foo') )
+ newSecurityManager(None, acl_users.user_bar)
+ mtool.createMemberarea('user_foo')
+ self.failIf( hasattr(members.aq_self, 'user_foo') )
+ newSecurityManager(None, acl_users.user_foo)
+ mtool.setMemberareaCreationFlag()
+ mtool.createMemberarea('user_foo')
+ self.failIf( hasattr(members.aq_self, 'user_foo') )
+ mtool.setMemberareaCreationFlag()
mtool.createMemberarea('user_foo')
+ self.failUnless( hasattr(members.aq_self, 'user_foo') )
- f = self.site.Members.user_foo
- ownership = self.site.acl_users.user_foo
+ # default content
+ f = members.user_foo
+ ownership = acl_users.user_foo
localroles = ( ( 'user_foo', ('Owner',) ), )
self.assertEqual( f.getOwner(), ownership )
self.assertEqual( f.get_local_roles(), localroles,