[CMF-checkins] CVS: CMF/CMFCore/tests - test_MemberDataTool.py:1.3
test_MembershipTool.py:1.7
Yvo Schubbe
schubbe at web.de
Wed Sep 24 06:02:46 EDT 2003
Update of /cvs-repository/CMF/CMFCore/tests
In directory cvs.zope.org:/tmp/cvs-serv1184/CMFCore/tests
Modified Files:
test_MemberDataTool.py test_MembershipTool.py
Log Message:
Merged yuppie-deleteMembers-branch:
- Added deleteMemberData, deleteMemberArea and deleteLocalRoles.
- Added 'recursive' argument to deleteLocalRoles.
- Renamed createMemberarea to createMemberArea.
- Moved getMembersFolder to CMFCore.
- Added CMFCoreExceptions.py.
- Added 'Change local roles' Permission.
=== CMF/CMFCore/tests/test_MemberDataTool.py 1.2 => 1.3 ===
--- CMF/CMFCore/tests/test_MemberDataTool.py:1.2 Mon Jan 6 16:04:33 2003
+++ CMF/CMFCore/tests/test_MemberDataTool.py Wed Sep 24 06:02:15 2003
@@ -2,6 +2,11 @@
import Zope
try:
+ Zope.startup()
+except AttributeError:
+ # for Zope versions before 2.6.1
+ pass
+try:
from Interface.Verify import verifyClass
except ImportError:
# for Zope versions before 2.6.0
@@ -12,6 +17,14 @@
class MemberDataToolTests(TestCase):
+
+ def test_deleteMemberData(self):
+ tool = MemberDataTool()
+ tool.registerMemberData('Dummy', 'user_foo')
+ self.failUnless( tool._members.has_key('user_foo') )
+ self.failUnless( tool.deleteMemberData('user_foo') )
+ self.failIf( tool._members.has_key('user_foo') )
+ self.failIf( tool.deleteMemberData('user_foo') )
def test_interface(self):
from Products.CMFCore.interfaces.portal_memberdata \
=== CMF/CMFCore/tests/test_MembershipTool.py 1.6 => 1.7 ===
--- CMF/CMFCore/tests/test_MembershipTool.py:1.6 Wed Jun 11 07:36:05 2003
+++ CMF/CMFCore/tests/test_MembershipTool.py Wed Sep 24 06:02:15 2003
@@ -13,11 +13,12 @@
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 DummySite
-from Products.CMFCore.tests.base.dummy import DummyTool
-from Products.CMFCore.tests.base.dummy import DummyUserFolder
-from Products.CMFCore.tests.base.testcase import SecurityTest
+from Products.CMFCore.MemberDataTool import MemberDataTool
+from Products.CMFCore.PortalFolder import PortalFolder
+from Products.CMFCore.tests.base.dummy import DummySite
+from Products.CMFCore.tests.base.dummy import DummyTool
+from Products.CMFCore.tests.base.dummy import DummyUserFolder
+from Products.CMFCore.tests.base.testcase import SecurityTest
from Products.CMFCore.MembershipTool import MembershipTool
@@ -41,25 +42,25 @@
self.site = DummySite('site').__of__(self.root)
self.mtool = MembershipTool().__of__(self.site)
- def test_createMemberarea(self):
+ def test_createMemberArea(self):
mtool = self.mtool
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')
+ mtool.createMemberArea('user_foo')
self.failIf( hasattr(members.aq_self, 'user_foo') )
newSecurityManager(None, acl_users.user_bar)
- mtool.createMemberarea('user_foo')
+ mtool.createMemberArea('user_foo')
self.failIf( hasattr(members.aq_self, 'user_foo') )
newSecurityManager(None, acl_users.user_foo)
mtool.setMemberareaCreationFlag()
- mtool.createMemberarea('user_foo')
+ mtool.createMemberArea('user_foo')
self.failIf( hasattr(members.aq_self, 'user_foo') )
newSecurityManager(None, acl_users.all_powerful_Oz)
mtool.setMemberareaCreationFlag()
- mtool.createMemberarea('user_foo')
+ mtool.createMemberArea('user_foo')
self.failUnless( hasattr(members.aq_self, 'user_foo') )
# default content
@@ -71,6 +72,27 @@
'CMF Collector issue #162 (LocalRoles broken): %s'
% str( f.get_local_roles() ) )
+ def test_deleteMembers(self):
+ mtool = self.mtool
+ members = self.site._setObject( 'Members', PortalFolder('Members') )
+ acl_users = self.site._setObject( 'acl_users', DummyUserFolder() )
+ utool = self.site._setObject( 'portal_url', DummyTool() )
+ wtool = self.site._setObject( 'portal_workflow', DummyTool() )
+ mdtool = self.site._setObject( 'portal_memberdata', MemberDataTool() )
+ newSecurityManager(None, acl_users.all_powerful_Oz)
+
+ self.assertEqual( acl_users.getUserById('user_foo'),
+ acl_users.user_foo )
+ mtool.createMemberArea('user_foo')
+ self.failUnless( hasattr(members.aq_self, 'user_foo') )
+ mdtool.registerMemberData('Dummy', 'user_foo')
+ self.failUnless( mdtool._members.has_key('user_foo') )
+
+ rval = mtool.deleteMembers( ('user_foo', 'user_baz') )
+ self.assertEqual( rval, ('user_foo',) )
+ self.failIf( acl_users.getUserById('user_foo', None) )
+ self.failIf( mdtool._members.has_key('user_foo') )
+ self.failIf( hasattr(members.aq_self, 'user_foo') )
def test_suite():
return TestSuite((
More information about the CMF-checkins
mailing list